7.3.3. Builders
- class parflow.tools.builders.CLMImporter(run)
Bases:
object- __init__(run)
- files(input='drv_clmin.dat', map=None, parameters=None)
- import_if_needed()
Imports driver files if needed
If CLM is in use and driver file data has not yet been set, then the driver files will be imported.
The default land names will be set if no land names have been set yet.
- input(clm_key_dict)
- input_file(path='drv_clmin.dat')
- map(vegm_data)
- map_file(path='drv_vegm.dat')
- parameters(vegp_data)
- parameters_file(path='drv_vegp.dat')
- set_default_land_names()
- class parflow.tools.builders.DomainBuilder(run, name='domain')
Bases:
object- __init__(run, name='domain')
- box_domain(box_input, domain_geom_name, bounds=None, patches=None)
Defining box domain and extents
- clm(met_file_name, top_patch, cycle_name, interval_name)
Setting keys associated with CLM
- clm_input(StartDate, StartTime, EndDate, EndTime, metf1d, outf1d, poutf1d, rstf, startcode=2, clm_ic=2, maxt=1, mina=0.05, udef=-9999, vclass=2, vegtf='drv_vegm.dat', vegpf='drv_vegp.dat', t_ini=300, h2osno_ini=0, surfind=2, soilind=1, snowind=0, forc_hgt_u=10.0, forc_hgt_t=2.0, forc_hgt_q=2.0, dewmx=0.1, qflx_tran_vegmx=-9999.0, rootfr=-9999.0, zlnd=0.01, zsno=0.0024, csoilc=0.0025, capr=0.34, cnfac=0.5, smpmin=-100000000.0, ssi=0.033, wimp=0.05)
Setting metadata keys to build the CLM driver input file
- fully_saturated()
Fully saturated solver settings (other than solver =’Impes’) Taken from default Impes examples - need to change
- homogeneous_subsurface(domain_name, perm=None, porosity=None, specific_storage=None, rel_perm=None, saturation=None, isotropic=False)
Setting constant parameters for homogeneous subsurface
- ic_pressure(domain_geom_name, patch, pressure)
Setting initial condition pressure from file or to constant value
- no_contaminants()
Setting key with no contaminants
- no_wells()
Setting key with no wells
- reservoir(name, Intake_X, Intake_Y, Has_Secondary_Intake_Cell, Secondary_Intake_X, Secondary_Intake_Y, Release_X, Release_Y, Release_Rate, Max_Storage, Storage, Min_Release_Storage, Overland_Flow_Solver)
Setting keys necessary to define a simple reservoir
- slopes_mannings(domain_geom_name, slope_x=None, slope_y=None, mannings=None)
Setting slopes and mannings coefficients as constant value or from an external file
- spinup_timing(initial_step, dump_interval)
Setting keys to assist a spinup run
- variably_saturated()
Setting keys for variably saturated domain. Common solver settings
- water(geom_name=None)
Setting keys for water properties and gravity
- well(name, type, x, y, z_upper, z_lower, cycle_name, interval_name, action='Extraction', saturation=1.0, phase='water', hydrostatic_pressure=None, value=None)
Setting keys necessary to define a simple well
- zero_flux(patches, cycle_name, interval_name)
Setting zero-flux boundary condition for patch or patches
- class parflow.tools.builders.NoAliasDumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)
Bases:
SafeDumper- ignore_aliases(data)
addressing alias printing when applying database properties to multiple keys
- class parflow.tools.builders.ReservoirPropertiesBuilder(run=None)
Bases:
TableToProperties- __init__(run=None)
- property db_prefix
- property default_db
- property key_root
- property reference_file
- property unit_string
- class parflow.tools.builders.SolidFileBuilder(top=1, bottom=2, side=3)
Bases:
object- __init__(top=1, bottom=2, side=3)
- bottom(patch_id)
Overwriting bottom patch ID
- Parameters:
patch_id (int) – ID of bottom patch in mask array
- bottom_ids(bottom_patch_ids)
Overwriting bottom patch ID with multiple IDs
- Parameters:
bottom_patch_ids (array) – array of bottom patch ids
- for_key(geom_item)
Setting ParFlow keys associated with solid file
- Parameters:
geom_item (str) – Name of geometric unit in ParFlow run that will
key. (bet used as a token for the ParFlow)
- mask(mask_array)
Setting mask array to SolidFileBuilder object
- Parameters:
mask_array (array) – Array of values to define the mask.
- side(patch_id)
Overwriting side patch ID
- Parameters:
patch_id (int) – ID of side patch in mask array
- side_ids(side_patch_ids)
Overwriting side patch ID with multiple IDs
- Parameters:
side_patch_ids (array) – array of side patch ids
- top(patch_id)
Overwriting top patch ID
- Parameters:
patch_id (int) – ID of top patch in mask array
- top_ids(top_patch_ids)
Overwriting top patch ID with multiple IDs
- Parameters:
top_patch_ids (array) – array of top patch ids
- write(name, xllcorner=0, yllcorner=0, cellsize=0, vtk=False, extra=None, generate_asc_files=False)
Writing out pfsol file with optional output to vtk
- Parameters:
name (str) – Name of solid file to write
xllcorner (int, float) – coordinate of lower-left corner of x-axis
yllcorner (int, float) – coordinate of lower-left corner of y-axis
cellsize (int) – size of horizontal grid cell for solid file
extra (list of strings) – Any extra arguments to pass to pfmask-to-pfsol for solid file generation; Default None
generate_asc_files (bool) – whether to generate .asc files for top/bottom/side patch matrices. Setting generate_asc_files to True results in 6 mask files being generated for top/bottom/sides: <name>_top.asc, <name>_bottom.asc, <name>_front.asc, <name>_back.asc, <name>_left.asc, <name>_right.asc When False (the default), asc mask files are not generated.
- class parflow.tools.builders.SubsurfacePropertiesBuilder(run=None)
Bases:
TableToProperties- __init__(run=None)
- property db_prefix
- property default_db
- property key_root
- property reference_file
- property unit_string
- class parflow.tools.builders.TableToProperties(run=None)
Bases:
ABC- __init__(run=None)
- apply(run=None, name_registration=True, infer_key_names=False)
- Method to apply the loaded properties to a given
run object.
- Parameters:
run=None (Run object) – Run object to which the loaded subsurface parameters will be applied. If run=None, then the run object must be passed in as an argument when the TableToProperties is instantiated.
name_registration=True (bool) – sets the auxiliary keys (e.g., GeomNames) related to the loaded subsurface properties
- assign(old=None, new=None, mapping=None)
Method to assigning subsurface properties of one unit to another
- Parameters:
old=None (str) – Source unit with existing parameters
new=None (str) – Target unit to which the parameters from old will be mapped
mapping=None (dict) – Dictionary that includes the old units as keys and new units as values.
- abstract property db_prefix
- abstract property default_db
- get_table(props_in_header=True, column_separator=' ')
Method to convert loaded subsurface properties into a table
- Parameters:
props_in_header=True (bool) – Defaults to returning a table with property values at the top of each column
' (column_separator=') – Defaults to returning a table that is space-delimited.
- Returns:
text block of table of units and parameter values
- abstract property key_root
- load_csv_file(table_file, encoding='utf-8-sig')
Method to load a .csv file of a table of parameters
- Parameters:
table_file (str) – Path to the input .csv file.
encoding='utf-8-sig' – encoding of input file.
- load_default_properties(database=None)
Method to load one of several default property databases.
- Parameters:
database=self.default_db – default database - options are:
SubsurfacePropertiesBuilder (1) for) –
‘conus_1’: soil/rock properties from Maxwell and Condon (2016) ‘washita’: soil/rock properties from Little Washita script ‘freeze_cherry’: soil/rock properties from Freeze and
Cherry (1979) Note: Freeze and Cherry only has permeability and porosity
VegParamBuilder (2) for) – ‘igbp’: parameters from IGBP land cover veg classification
- load_txt_content(txt_content)
Method to load an in-line text table of parameters
- Parameters:
txt_content (str) – In-line text string.
- load_txt_file(table_file, encoding='utf-8-sig')
Method to load a .txt file of a table of parameters
- Parameters:
table_file (str) – Path to the input .txt file.
encoding='utf-8-sig' – encoding of input file.
- print()
Method to print subsurface properties in hierarchical format
- print_as_table(props_in_header=True, column_separator=' ')
Method to print the table returned from the get_table method
- abstract property reference_file
- abstract property unit_string