w4h.core module¶
The Core module contains core functions of the package used in other modules or as primary functions in the package. This includes the main run() function that allows rapid data analysis, a function to retrieve sample data, and functions that are used throughout the package for logging and printing verbose outputs.
- w4h.core.get_resources(resource_type='filepaths', scope='local', verbose=False)[source]¶
Function to get filepaths for resources included with package
- Parameters:
- resource_typestr, {‘filepaths’, ‘data’}
If filepaths, will return dictionary with filepaths to sample data. If data, returns dictionary with data objects.
- scopestr, {‘local’, ‘statewide’}
If ‘local’, will read in sample data for a local (around county sized) project. If ‘state’, will read in sample data for a statewide project (Illinois)
- verbosebool, optional
Whether to print results to terminal, by default False
- Returns:
- resources_dictdict
Dictionary containing key, value pairs with filepaths to resources that may be of interest.
- w4h.core.logger_function(logtocommence, parameters, func_name)[source]¶
Function to log other functions, to be called from within other functions
- Parameters:
- logtocommencebool
Whether to perform logging steps
- parametersdict
Dictionary containing parameters and their values, from function
- func_namestr
Name of function within which this is called
- w4h.core.run(well_data, surf_elev_grid, bedrock_elev_grid, model_grid=None, metadata=None, keep_all_cols=True, layers=9, description_col='FORMATION', top_col='TOP', bottom_col='BOTTOM', depth_type='depth', study_area=None, xcol='LONGITUDE', ycol='LATITUDE', zcol='SURFACE_ELEV', well_id_col='API_NUMBER', lith_dict=None, lith_dict_start=None, lith_dict_wildcard=None, target_dict=None, target_name='', include_elevation_grids=True, include_elevation_coordinates=True, export_dir=None, verbose=False, log=False, **kw_params)[source]¶
w4h.run() is a function that runs the intended workflow of the wells4hydrogeology (w4h) package. This means that it runs several constituent functions. The workflow that this follows is provided in the package wiki. It accepts the parameters of the constituent functions. To see a list of these functions and parameters, use help(w4h.run).
The following functions used in w4h.run() are listed below, along with their parameters and default values for those parameters. See the documentation for the each of the individual functions for more information on a specific parameter:
file_setup
well_data | default = ‘<no default>’
metadata | default = None
data_filename | default = ‘ISGS_DOWNHOLE_DATA.txt’
metadata_filename | default = ‘ISGS_HEADER.txt’
log_dir | default = None
verbose | default = False
log | default = False
read_raw_csv
data_filepath | default = ‘<output of previous function>’
metadata_filepath | default = ‘<output of previous function>’
data_cols | default = None
metadata_cols | default = None
xcol | default = ‘LONGITUDE’
ycol | default = ‘LATITUDE’
well_key | default = ‘API_NUMBER’
encoding | default = ‘latin-1’
verbose | default = False
log | default = False
read_csv_kwargs | default = {}
define_dtypes
undefined_df | default = ‘<output of previous function>’
datatypes | default = None
verbose | default = False
log | default = False
merge_metadata
data_df | default = ‘<output of previous function>’
header_df | default = ‘<output of previous function>’
data_cols | default = None
header_cols | default = None
auto_pick_cols | default = False
drop_duplicate_cols | default = True
log | default = False
verbose | default = False
kwargs | default = {}
coords2geometry
df_no_geometry | default = ‘<output of previous function>’
xcol | default = ‘LONGITUDE’
ycol | default = ‘LATITUDE’
zcol | default = ‘ELEV_FT’
input_coords_crs | default = ‘EPSG:4269’
output_crs | default = ‘EPSG:5070’
use_z | default = False
wkt_col | default = ‘WKT’
geometry_source | default = ‘coords’
verbose | default = False
log | default = False
read_study_area
study_area | default = None
study_area_crs | default = None
output_crs | default = ‘EPSG:5070’
buffer | default = None
return_original | default = False
log | default = False
verbose | default = False
read_file_kwargs | default = {}
clip_gdf2study_area
study_area | default = ‘<output of previous function>’
gdf | default = ‘<output of previous function>’
log | default = False
verbose | default = False
read_grid
grid_path | default = None
grid_type | default = ‘model’
no_data_val_grid | default = 0
use_service | default = False
study_area | default = None
grid_crs | default = None
output_crs | default = ‘EPSG:5070’
verbose | default = False
log | default = False
kwargs | default = {}
add_control_points
df_without_control | default = ‘<output of previous function>’
df_control | default = None
xcol | default = ‘LONGITUDE’
ycol | default = ‘LATITUDE’
zcol | default = ‘ELEV_FT’
controlpoints_crs | default = ‘EPSG:4269’
output_crs | default = ‘EPSG:5070’
description_col | default = ‘FORMATION’
interp_col | default = ‘INTERPRETATION’
target_col | default = ‘TARGET’
verbose | default = False
log | default = False
kwargs | default = {}
remove_nonlocated
df_with_locations | default = ‘<output of previous function>’
xcol | default = ‘LONGITUDE’
ycol | default = ‘LATITUDE’
no_data_val_table | default = ‘’
verbose | default = False
log | default = False
remove_no_topo
df_with_topo | default = ‘<output of previous function>’
zcol | default = ‘SURFACE_ELEV’
no_data_val_table | default = ‘’
verbose | default = False
log | default = False
remove_no_depth
df_with_depth | default = ‘<output of previous function>’
top_col | default = ‘TOP’
bottom_col | default = ‘BOTTOM’
no_data_val_table | default = ‘’
verbose | default = False
log | default = False
remove_bad_depth
df_with_depth | default = ‘<output of previous function>’
top_col | default = ‘TOP’
bottom_col | default = ‘BOTTOM’
depth_type | default = ‘depth’
verbose | default = False
log | default = False
remove_no_description
df_with_descriptions | default = ‘<output of previous function>’
description_col | default = ‘FORMATION’
no_data_val_table | default = ‘’
verbose | default = False
log | default = False
get_search_terms
spec_path | default = ‘C:UsersbalikianLocalDataCodesScriptsGithubwells4hydrogeologydocs/resources/’
spec_glob_pattern | default = ‘SearchTerms-Specific’
start_path | default = None
start_glob_pattern | default = ‘SearchTerms-Start’
wildcard_path | default = None
wildcard_glob_pattern | default = ‘*SearchTerms-Wildcard’
verbose | default = False
log | default = False
read_dictionary_terms
dict_file | default = None
id_col | default = ‘ID’
search_col | default = ‘DESCRIPTION’
definition_col | default = ‘LITHOLOGY’
class_flag_col | default = ‘CLASS_FLAG’
dictionary_type | default = None
class_flag | default = 6
rem_extra_cols | default = True
verbose | default = False
log | default = False
specific_define
df | default = ‘<output of previous function>’
terms_df | default = ‘<output of previous function>’
description_col | default = ‘FORMATION’
terms_col | default = ‘DESCRIPTION’
parallel_processing | default = False
verbose | default = False
log | default = False
split_defined
df | default = ‘<output of previous function>’
classification_col | default = ‘CLASS_FLAG’
verbose | default = False
log | default = False
start_define
df | default = ‘<output of previous function>’
terms_df | default = ‘<output of previous function>’
description_col | default = ‘FORMATION’
terms_col | default = ‘DESCRIPTION’
parallel_processing | default = False
verbose | default = False
log | default = False
wildcard_define
df | default = ‘<output of previous function>’
terms_df | default = ‘<output of previous function>’
description_col | default = ‘FORMATION’
terms_col | default = ‘DESCRIPTION’
verbose | default = False
log | default = False
remerge_data
classifieddf | default = ‘<output of previous function>’
searchdf | default = ‘<output of previous function>’
parallel_processing | default = False
fill_unclassified
df | default = ‘<output of previous function>’
classification_col | default = ‘CLASS_FLAG’
read_lithologies
lith_file | default = None
interp_col | default = ‘LITHOLOGY’
target_col | default = ‘CODE’
use_cols | default = None
verbose | default = False
log | default = False
merge_lithologies
well_data_df | default = ‘<output of previous function>’
targinterps_df | default = ‘<output of previous function>’
interp_col | default = ‘INTERPRETATION’
target_col | default = ‘TARGET’
target_class | default = ‘bool’
align_rasters
grids_unaligned | default = None
model_grid | default = None
no_data_val_grid | default = 0
verbose | default = False
log | default = False
get_drift_thick
surface_elev | default = None
bedrock_elev | default = None
layers | default = 9
plot | default = False
verbose | default = False
log | default = False
sample_raster_points
raster | default = None
points_df | default = None
well_id_col | default = ‘API_NUMBER’
xcol | default = ‘LONGITUDE’
ycol | default = ‘LATITUDE’
new_col | default = ‘SAMPLED’
verbose | default = False
log | default = False
get_layer_depths
df_with_depths | default = ‘<output of previous function>’
surface_elev_col | default = ‘SURFACE_ELEV’
layer_thick_col | default = ‘LAYER_THICK’
layers | default = 9
log | default = False
layer_target_thick
df | default = ‘<output of previous function>’
layers | default = 9
return_all | default = False
export_dir | default = None
outfile_prefix | default = None
depth_top_col | default = ‘TOP’
depth_bot_col | default = ‘BOTTOM’
log | default = False
layer_interp
points | default = ‘<no default>’
model_grid | default = ‘<no default>’
layers | default = None
interp_kind | default = ‘nearest’
surface_grid | default = None
bedrock_grid | default = None
layer_thick_grid | default = None
drift_thick_grid | default = None
return_type | default = ‘dataset’
export_dir | default = None
target_col | default = ‘TARG_THICK_PER’
layer_col | default = ‘LAYER’
xcol | default = None
ycol | default = None
xcoord | default = ‘x’
ycoord | default = ‘y’
log | default = False
verbose | default = False
kwargs | default = {}
export_grids
grid_data | default = ‘<no default>’
out_path | default = ‘<no default>’
file_id | default = ‘’
filetype | default = ‘tif’
variable_sep | default = True
date_stamp | default = True
verbose | default = False
log | default = False”