wrfhydropy.Job¶
-
class
wrfhydropy.Job(job_id: str, model_start_time: Union[str, datetime.datetime] = None, model_end_time: Union[str, datetime.datetime] = None, restart_freq_hr: Union[int, dict] = None, output_freq_hr: Union[int, dict] = None, restart: bool = True, restart_file_time: Union[str, datetime.datetime, dict] = None, restart_dir: Union[str, pathlib.Path, dict] = None, exe_cmd: str = None, entry_cmd: str = None, exit_cmd: str = None)[source]¶ A Job represents run-time specific information for a given WRF-Hydro run. A Simulation consists of one or more jobs. For example, adding multiple Jobs can be used to split a Simulation into multiple runs to limit the wall-clock duration of each individual run.
Attributes: - hrldas_namelist
- hrldas_times
- hydro_namelist
- hydro_times
job_dirPath: Path to the run directory
model_end_timedatetime: The model time at the end of the execution.
model_start_timedatetime: The model time at the start of the execution.
Methods
clone(self, N)Clone a job object N-times using deepcopy. pickle(self, path)Pickle job object to specified file path :Parameters: path – The file path for pickle -
__init__(self, job_id:str, model_start_time:Union[str, datetime.datetime]=None, model_end_time:Union[str, datetime.datetime]=None, restart_freq_hr:Union[int, dict]=None, output_freq_hr:Union[int, dict]=None, restart:bool=True, restart_file_time:Union[str, datetime.datetime, dict]=None, restart_dir:Union[str, pathlib.Path, dict]=None, exe_cmd:str=None, entry_cmd:str=None, exit_cmd:str=None)[source]¶ Instatiate a Job object. Args: job_id: A string identify the job model_start_time: The model start time to use for the WRF-Hydro model run. Can be
a pandas.to_datetime compatible string or a pandas datetime object.- model_end_time: The model end time to use for the WRF-Hydro model run. Can be
- a pandas.to_datetime compatible string or a pandas datetime object.
- restart_freq_hr: Restart write frequency, hours. Either an int or a dict. If int: Output
- write frequency, hours. If dict, must be of the form {‘hydro’: int, ‘hrldas’: int} which sets them independently. Non-positive values (those <=0) set the restart frequency for both models to -99999, which gives restarts at start of each month.
- output_freq_hr: Either an int or a dict. If int: Output write frequency, hours. If dict,
- must be of the form {‘hydro’: int, ‘hrldas’: int} which sets them independently.
restart: Job is starting from a restart file. Use False for a cold start. restart_dir: The path in which to look for the restart files. restart_file_time: The time on the restart file, if not the same as the model_start_time.
Eithera string (e.g. ‘2000-01-01 00’) or a datetime object (datetime or pandas) or a dict the form {‘hydro’: date1, ‘hrldas’: date2} where dates are either strings or datetime objects.- exe_cmd: The system-specific command to execute WRF-Hydro, for example ‘mpirun -np
- 36 ./wrf_hydro.exe’. Can be left as None if jobs is added to a scheduler or if a scheduler is used in a simulation.
- entry_cmd: A command to run prior to executing WRF-Hydro, such as loading modules or
- libraries.
exit_cmd: A command to run after completion of the job.
Methods
__init__(self, job_id, model_start_time, …)Instatiate a Job object. clone(self, N)Clone a job object N-times using deepcopy. pickle(self, path)Pickle job object to specified file path :Parameters: path – The file path for pickle Attributes
hrldas_namelisthrldas_timeshydro_namelisthydro_timesjob_dirPath to the run directory model_end_timeThe model time at the end of the execution. model_start_timeThe model time at the start of the execution.