wrfhydropy.Model

class wrfhydropy.Model(source_dir: str, model_config: str, hydro_namelist_config_file: str | None = None, hrldas_namelist_config_file: str | None = None, compile_options_config_file: str | None = None, compiler: str = 'gfort', pre_compile_cmd: str | None = None, compile_options: dict | None = None)[source]

Class for a WRF-Hydro model, which consitutes the model source code and compiled binary.

Methods

compile(compile_dir)

Compiles WRF-Hydro using specified compiler and compile options.

copy_files(dest_dir[, symlink])

Copy domain files to new directory :Parameters: * dest_dir -- The destination directory for files * symlink -- Symlink files instead of copy

__init__(source_dir: str, model_config: str, hydro_namelist_config_file: str | None = None, hrldas_namelist_config_file: str | None = None, compile_options_config_file: str | None = None, compiler: str = 'gfort', pre_compile_cmd: str | None = None, compile_options: dict | None = None)[source]

Instantiate a Model object. :Parameters: * source_dir – Directory containing the source code, e.g.

‘wrf_hydro_nwm/src’.

  • model_config – The configuration of the model. Used to match a model to a domain configuration. Must be a key in both the *_namelists.json of in the source directory and the *_namelist_patches.json in the domain directory.

  • machine_spec – Optional dictionary of machine specification or string containing the name of a known machine. Known machine names include ‘cheyenne’. For an example of a machine specification see the ‘cheyenne’ machine specification using wrfhydropy.get_machine_spec(‘cheyenne’).

  • hydro_namelist_config_file – Path to a hydro namelist config file external to the model repository. Default(None) implies using the model src/hydro_namelists.json.

  • hrldas_namelist_config_file – As for hydro_namelist_config_file, but for hrldas namelist.

  • compile_options_config_file – As for hydro_namelist_config_file, but for compile options.

  • compiler – The compiler to use, must be one of ‘pgi’,’gfort’, ‘ifort’, or ‘luna’.

  • compile_options – Changes to default compile-time options.

Methods

__init__(source_dir, model_config[, ...])

Instantiate a Model object. :Parameters: * source_dir -- Directory containing the source code, e.g. 'wrf_hydro_nwm/src'. * model_config -- The configuration of the model. Used to match a model to a domain configuration. Must be a key in both the _namelists.json of in the source directory and the *_namelist_patches.json in the domain directory. * **machine_spec* -- Optional dictionary of machine specification or string containing the name of a known machine. Known machine names include 'cheyenne'. For an example of a machine specification see the 'cheyenne' machine specification using wrfhydropy.get_machine_spec('cheyenne'). * hydro_namelist_config_file -- Path to a hydro namelist config file external to the model repository. Default(None) implies using the model src/hydro_namelists.json. * hrldas_namelist_config_file -- As for hydro_namelist_config_file, but for hrldas namelist. * compile_options_config_file -- As for hydro_namelist_config_file, but for compile options. * compiler -- The compiler to use, must be one of 'pgi','gfort', 'ifort', or 'luna'. * compile_options -- Changes to default compile-time options.

compile(compile_dir)

Compiles WRF-Hydro using specified compiler and compile options.

copy_files(dest_dir[, symlink])

Copy domain files to new directory :Parameters: * dest_dir -- The destination directory for files * symlink -- Symlink files instead of copy

Attributes

source_dir

pathlib.Path object for source code directory.

model_config

Specified configuration for which the model is to be used, e.g. 'nwm_ana'.

compiler

The compiler chosen at compile time.

pre_compile_cmd

Command string to be executed prior to model compilation, e.g. to load modules.

compile_options

Hydro namelist for specified model config

hydro_namelist_config_file

Hydro namelist file specified for model config

hrldas_namelist_config_file

HRLDAS namelist file specified for model config.

compile_options_config_file

Compile options file specified for model config.

hydro_namelists

Hydro namelist for specified model config

hrldas_namelists

HRLDAS namelist for specified model config

compile_dir

pathlib.Path object pointing to the compile directory.

git_hash

The git revision hash if seld.source_dir is a git repository

version

Source code version from .version file stored with the source code.

configure_log

The subprocess object generated at configure.

compile_log

The subprocess object generated at compile.

object_id

A unique id to join object to compile directory.

table_files

pathlib.Paths to *.TBL files generated at compile-time.

wrf_hydro_exe

pathlib.Path to wrf_hydro.exe file generated at compile-time.