wrfhydropy.Job
- class wrfhydropy.Job(job_id: str, model_start_time: str | datetime | None = None, model_end_time: str | datetime | None = None, restart_freq_hr: int | dict | None = None, output_freq_hr: int | dict | None = None, restart: bool = True, restart_file_time: str | datetime | dict | None = None, restart_dir: str | Path | dict | None = None, exe_cmd: str | None = None, entry_cmd: str | None = None, exit_cmd: str | None = 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(N)Clone a job object N-times using deepcopy.
pickle(path)Pickle job object to specified file path :Parameters: path -- The file path for pickle
- __init__(job_id: str, model_start_time: str | datetime | None = None, model_end_time: str | datetime | None = None, restart_freq_hr: int | dict | None = None, output_freq_hr: int | dict | None = None, restart: bool = True, restart_file_time: str | datetime | dict | None = None, restart_dir: str | Path | dict | None = None, exe_cmd: str | None = None, entry_cmd: str | None = None, exit_cmd: str | None = 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 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__(job_id[, model_start_time, ...])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 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.
clone(N)Clone a job object N-times using deepcopy.
pickle(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.
job_idThe job id.
restartStart model from a restart.
restart_file_timeTime on the restart file to use, if different from model_start_time.
restart_freq_hr_hydroHydro restart write frequency in hours.
restart_freq_hr_hrldasHrldas restart write frequency in hours.
output_freq_hr_hydroHydro output write frequency in hours.
output_freq_hr_hrldasHrldas output write frequency in hours.
exit_statusThe exit status of the model job parsed from WRF-Hydro diag files