7.3. PFTools API Reference
Each entry below includes a short description from the object’s docstring. Click a name to open the full documentation.
Parflow Module
The ParflowBinaryReader, unsurprisingly, provides functionality for reading parflow binary files. |
|
Main object that can be used to define a ParFlow simulation |
|
Read a single pfb file, and return the data therein |
|
Write a single pfb file. |
|
An efficient wrapper to read a sequence of pfb files. |
|
Python version of the tcl pftestFile procedure. |
|
Python version of the tcl pftestFileWithAbs procedure. |
Run Class
Method to generate a Run object from a file. |
|
Returns name of run |
|
Setting new name for a run |
|
Method to write database file to disk |
|
Write a table of subsurface properties assigned to each unit. |
|
Method to generate a clone of a run (for generating run ensembles, etc.) |
|
Method to run simulation |
|
Check the input files for NaNs. |
|
Distribute a PFB file using the P/Q/R settings from the run or override them with the provided arguments. |
|
Undistribute a PFB file. |
|
Return details based on a location. |
|
Return docs based on a location. |
|
Return a list of PFDBObj of a given type that are part of our children. |
|
Return global settings for our current parflow run. |
|
Gets the key names necessary for the run while skipping unset ones |
|
Allow to define any parflow key so it can be exported. Many formats are supported: - key/value: To set a single value relative to our current PFDBObj. - yaml_file: YAML file path to load and import using the current PFDBObj as root. - yaml_content: YAML string to load and import using the current PFDBObj as root. - hierarchical_map: Nested dict containing several key/value pair using the current PFDBObj as root. - flat_map: Flat dict with parflow key/value pair to set using the current PFDBObj as root. |
|
Return a PFDBObj object based on a location. |
|
Method that will return a flat map of all the ParFlow keys. |
|
Helper method returning the key to use for Parflow on a given field key. |
|
Method to validate sub hierarchy |
|
Return a value based on a location. |
|
Return a DataAccessor to streamline access to numpy array of the various field this run is linked to. |
|
Helper method returning the full name of a given ParFlow key. |
|
Helper function that can be used to parse ParFlow output file |
|
Helper function to extract ParFlow version |
|
General processing of script arguments |
|
Push processed args onto run properties. |
Builders
IO Module
The ParflowBinaryReader, unsurprisingly, provides functionality for reading parflow binary files. |
|
Helper for extracting numpy array from a given run |
|
Read a single pfb file, and return the data therein |
|
Write a single pfb file. |
|
An efficient wrapper to read a sequence of pfb files. |
|
Read a ParFlow scattered binary file (pfsb) and return the data. |
|
Write a distfile. |
|
Undistribute PFB files. |
|
Write asc for pfsol |
|
Write asc for pfsol |
|
Load pfidb file into a Python dict |
|
Load yaml file into a Python dict |
|
Write a Python dict into a file_name using the extension to determine its format. |
|
Write a Python dict in a pfidb format inside the provided file_name |
|
Write a Python dict in a pfidb format inside the provided file_name |
|
Write a Python dict in a json format inside the provided file_name |
|
Converting a string to a value in native format. |
|
Determines the sizes of the subgrids. |
|
Translate an integer subgrid to the location in 3d subgrid space. |
|
Get the index of the lower left corner of a subgrid. |
|
Get the size of a subgrid |
|
Computes all necessary subgrid information to index and read or write a pfb file. |
Hydrology Module
Calculate gridded evapotranspiration across several layers. |
|
Calculate overland outflow out of a domain |
|
Calculate overland outflow per grid cell of a domain |
|
Calculate overland fluxes across grid faces |
|
Calculate gridded subsurface storage across several layers. |
|
Calculate gridded surface storage on the top layer. |
|
Calculate water table depth from the land surface :param pressure: A nz-by-ny-by-nx ndarray of pressure values (bottom layer to top layer) :param saturation: A nz-by-ny-by-nx ndarray of saturation values (bottom layer to top layer) :param dz: An ndarray of shape (nz,) of thickness values (bottom layer to top layer) :return: A ny-by-nx ndarray of water table depth values (measured from the top) |
|
Compute hydraulic head from a 3D pressure ndarray considering elevation. |
|
Computes the water table depth as the first cell with a saturation=1 starting from top. |
FS Module
Copying file/directory within python script |
|
Helper function to resolve a file path while using the proper working directory. |
|
mkdir within python script |
|
Deleting file/directory within python script |
|
Read a text file and return its contents as a string. |
|
Return True if the given path exists. |
|
Change the current working directory. |
Export Module
Compare Module
Python version of the tcl pftestFile procedure. |
|
Python version of the tcl pftestFileWithAbs procedure. |
|
Python version of the C MSigDiff function. |
Top Module
Python version of the C ComputeTop function. |
|
Python version of the C ExtractTop function. |
Settings Module
This will set the working directory to use for all the relative file path. |
|
Calling that method will enable line feedback on validation error |
|
Calling that method will disable line feedback on validation error |
|
Calling that method will force the program to exit on validation error. |
|
Calling that method will force the program to not exit on validation error. |
|
Globally store the ParFlow version to test against |
PF Backend Module
Provides an entrypoint for xarray to read Parflow input/output Note: Users should never instantiate, import, or call any of this code directly. |
|
Backend array that allows for lazy indexing on pfb-based data. |