wrfhydropy.EnsembleSimulation
- class wrfhydropy.EnsembleSimulation(ncores: int = 1)[source]
Class for a WRF-Hydro EnsembleSimulation object. The Ensemble Simulation object is used to orchestrate a set of ‘N’ WRF-Hydro simulations. It requires members with pre-compiled models and there are set and get methods across the ensemble (member_diffs & set_member_diffs). Jobs and scheduler set on the EnsembleSimulation object are set on all the members.
- Attributes:
- N
member_diffsGet method for ensemble member differences.
Methods
add(obj)Add an approparite object to an EnsembleSimulation, such as a Simulation, Job, or Scheduler.
compose([symlink_domain, force, ...])Ensemble compose simulation directories and files :Parameters: * symlink_domain -- Symlink the domain files rather than copy * force -- Compose into directory even if not empty. This is considered bad practice but * is necessary in certain circumstances. * rm_members_from_memory -- Most applications will remove the members from the * ensemble object upon compose. Testing and other reasons may keep them around. * check_nlst_warn -- Allow the namelist checking/validation to only result in warnings. * This is also not great practice, but necessary in certain circumstances..
pickle(path)Pickle ensemble sim object to specified file path :Parameters: path -- The file path for pickle
replicate_member(N[, copy_members])restore_members([ens_dir, recursive])Restore members from disk, replace paths with the loaded pickle.
rm_members()Remove members from memory, replace with their paths.
run([n_concurrent, teams, teams_exe_cmd, ...])Run the ensemble of simulations. Inputs: n_concurrent: int = 1, Only used for non-team runs. teams: bool = False, Use teams? See parallel_teams_run for details. teams_exe_cmd: str, The mpi-specific syntax needed. For example: 'mpirun --hosts {nodelist} -np {nproc} {cmd}' teams_exe_cmd_nproc: int, The number of cores per model/wrf_hydro simulation to be run. teams_node_file: dict = None, Optional file that acts like a node file. It is not currently implemented but the key specifies the scheduler format that the file follows. An example pbs node file is in tests/data and this argument is used here to test without a sched. env: dict = None, optional envionment to pass to the run. teams_dict: dict, Skip the arguments if you already have a teams_dict to use (backwards compatibility) Returns: 0 for success.
set_member_diffs(att_tuple, values)Set method for ensemble member differences.
collect
Methods
__init__([ncores])Instantiates an EnsembleSimulation object.
add(obj)Add an approparite object to an EnsembleSimulation, such as a Simulation, Job, or Scheduler.
collect([output])compose([symlink_domain, force, ...])Ensemble compose simulation directories and files :Parameters: * symlink_domain -- Symlink the domain files rather than copy * force -- Compose into directory even if not empty. This is considered bad practice but * is necessary in certain circumstances. * rm_members_from_memory -- Most applications will remove the members from the * ensemble object upon compose. Testing and other reasons may keep them around. * check_nlst_warn -- Allow the namelist checking/validation to only result in warnings. * This is also not great practice, but necessary in certain circumstances..
pickle(path)Pickle ensemble sim object to specified file path :Parameters: path -- The file path for pickle
replicate_member(N[, copy_members])restore_members([ens_dir, recursive])Restore members from disk, replace paths with the loaded pickle.
rm_members()Remove members from memory, replace with their paths.
run([n_concurrent, teams, teams_exe_cmd, ...])Run the ensemble of simulations. Inputs: n_concurrent: int = 1, Only used for non-team runs. teams: bool = False, Use teams? See parallel_teams_run for details. teams_exe_cmd: str, The mpi-specific syntax needed. For example: 'mpirun --hosts {nodelist} -np {nproc} {cmd}' teams_exe_cmd_nproc: int, The number of cores per model/wrf_hydro simulation to be run. teams_node_file: dict = None, Optional file that acts like a node file. It is not currently implemented but the key specifies the scheduler format that the file follows. An example pbs node file is in tests/data and this argument is used here to test without a sched. env: dict = None, optional envionment to pass to the run. teams_dict: dict, Skip the arguments if you already have a teams_dict to use (backwards compatibility) Returns: 0 for success.
set_member_diffs(att_tuple, values)Set method for ensemble member differences.
Attributes
Nmember_diffsGet method for ensemble member differences.
membersa list of simulations which are the members of the ensemble.
jobsa list containing Job objects
schedulerA scheduler object to use for each Job in self.jobs
ncoresinteger number of cores for running parallelizable methods.