-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
RJbalikian edited this page Jun 29, 2023
·
1 revision
Example using w4h.run() with all data and files preformatted either for the defaults accepted for each intermediate function (see here) or with the parameters as specified in the w4h.run() function in the snippet below.
In this case it is worth pointing out:
- The well_data parameter is for a directory that contains both the well_data file and the well_metadata file
- The pattern that the code will search for each file is specified in data_filename and metadata_filename
- The asterisks indicate where there can be any characters can be present. It will find all filenames that fit that pattern.
- For example, a file called "Countywide_WELL_DESCRIPTION_DATA_2023-01-01.txt" would fit that pattern, but "WELL_DESCRIPTIONS.txt" would not
- data_filename and metadata_filename are parameters of the file_setup() function. It is accepted by the w4h.run() function, but then passed through to file_setup().
- This can be done with any parameters of any of the functions used in w4h.run() see here for all possible functions and parameters.
import w4h
#Well data file and #metadata file are in the same directory.
#The databases containing these files are periodically updated, so there are multiple versions of the file
#This package will find the most recent version, given the right pattern specification
#we could also specify the filepath directly to the data file (instead of a directory)
#and we could also specify a filepath to a metadata file
#or we could specify a filepath to one file with both data and metadata)
dataDir = "/filepath/to/directory/with/well_datafiles/and/metadata_files"
#Direct filepaths to the raster files
modelGridPath = "/filepath/to/model_grid_raster.tif"
surfaceElevPath = "/filepath/to/surface_raster.tif"
bedrockElevPath = "/filepath/to/bedrock_raster.tif"
#Read in the study area
#The files above should be as big or bigger than the study area so they can be clipped
studyAreaPath = "/filepath/to/StudyArea.shp"
#Filepaths to dictionaries with terms (descriptions) matched up with classifications (lithologies)
specific_DictPath = "filepath/to/dictionary/with/exact_match/search/terms/DICTIONARY_SearchTerms-Specific_2023-06-27.csv"
start_DictPath = "filepath/to/dictionary/with/starts_with/search/terms/SearchTerms-Start.csv"
#Filepath to second file matching lithologies to target variables of interest of modelling (e.g., "Fine or Coarse materials)
targetPath = "/filepath/to/target/code/interpretations/Lithology_Interp_FineCoarse.csv"
#specify directory path for exporting all files, including logs
procDir = "/path/to/directory/where/processed/data/will/be/exported/"
w4h.run(well_data=dataDir,
data_filename='*WELL_DESCRIPTION_DATA*.txt',
metadata_filename='*WELL_HEADER_DATA*.txt',
layers=9,
description_col='FORMATION', top_col='TOP', bottom_col='BOTTOM', depth_type='depth',
study_area=studyAreaPath, xcol='LONGITUDE', ycol='LATITUDE', zcol='ELEVATION', idcol='API_NUMBER', output_crs='EPSG:4269',
surf_elev_file=surfaceElevPath, bedrock_elev_file=bedrockElevPath, model_grid=modelGridPath,
lith_dict=specDictPath, lith_dict_start=startDictPath, lith_dict_wildcard=None,
target_dict=targetPath,
export_dir=procDir,
verbose=True,
log=False
)