Run Class

class parflow.tools.core.Run(name, basescript=None)

Bases: BaseRun

Main object that can be used to define a ParFlow simulation

Parameters:
  • name (str) – Name for the given run.

  • basescript (str) – Path to current file so the simulation execution and relative path will be assumed to have the script directory as their working directory. If not provided, the working directory will be the directory where the python executable was run from.

Methods

parflow.tools.core.Run.from_definition

Method to generate a Run object from a file.

parflow.tools.core.Run.get_name

Returns name of run

parflow.tools.core.Run.set_name

Setting new name for a run

parflow.tools.core.Run.write

Method to write database file to disk

parflow.tools.core.Run.write_subsurface_table

Write a table of subsurface properties assigned to each unit.

parflow.tools.core.Run.clone

Method to generate a clone of a run (for generating run ensembles, etc.)

parflow.tools.core.Run.run

Method to run simulation

parflow.tools.core.Run.check_nans

Check the input files for NaNs.

parflow.tools.core.Run.dist

Distribute a PFB file using the P/Q/R settings from the run or override them with the provided arguments.

parflow.tools.core.Run.undist

Undistribute a PFB file.

Inherited Methods

parflow.tools.core.Run.details

Return details based on a location.

parflow.tools.core.Run.doc

Return docs based on a location.

parflow.tools.core.Run.get_children_of_type

Return a list of PFDBObj of a given type that are part of our children.

parflow.tools.core.Run.get_context_settings

Return global settings for our current parflow run.

parflow.tools.core.Run.keys

Gets the key names necessary for the run while skipping unset ones

parflow.tools.core.Run.pfset

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.

parflow.tools.core.Run.select

Return a PFDBObj object based on a location.

parflow.tools.core.Run.to_dict

Method that will return a flat map of all the ParFlow keys.

parflow.tools.core.Run.to_pf_name

Helper method returning the key to use for Parflow on a given field key.

parflow.tools.core.Run.validate

Method to validate sub hierarchy

parflow.tools.core.Run.value

Return a value based on a location.

Attributes

parflow.tools.core.Run.data_accessor

Return a DataAccessor to streamline access to numpy array of the various field this run is linked to.

parflow.tools.core.Run.full_name

Helper method returning the full name of a given ParFlow key.

core module

This module provide the core objects for controlling ParFlow.

  • A Run() object for configuring and running ParFlow simulations.

  • A check_parflow_execution(out_file) function to parse output file

  • A get_current_parflow_version() function to extract current ParFlow version

parflow.tools.core.check_parflow_execution(out_file)

Helper function that can be used to parse ParFlow output file

Parameters:

out_file (str) – Path to the output run file.

Returns:

True for success, False otherwise.

Return type:

bool

parflow.tools.core.get_current_parflow_version()

Helper function to extract ParFlow version

That method rely on PARFLOW_DIR environment variable to parse and extract the version of your installed version of ParFlow.

TODO: This not a very good way to get the version. Should get from cmake processed file.

Returns:

Return ParFlow version like ‘3.6.0’

Return type:

str

parflow.tools.core.get_process_args()

General processing of script arguments

parflow.tools.core.update_run_from_args(run, args)

Push processed args onto run properties.