pywatershed.utils.DomainSubset#

class pywatershed.utils.DomainSubset(full_control_file, sub_nhm_ids, sub_nhm_segs, full_cbh_nc_files_dict, start_one_below_nhm_seg=False, output_format=None, from_seg_calc_parallel=False, from_seg_calc_check=False, start_time=None, end_time=None)[source]#

Subset a domain.

Parameters:
  • full_control_file (Path) – A pathlib.Path to the full domain control file. Currently, the “param_file” field must a be a scalar (multiple parameter files specified will throw an error).

  • sub_nhm_ids (Optional[ndarray]) – Either an np.ndarray of the nhm_ids or None if subsetting above a single nhm_seg.

  • sub_nhm_segs (Union[ndarray, int64]) – Either an np.ndarray of the nhm_segs or a np.int64 if subsetting above a single nhm_seg.

  • full_cbh_nc_files_dict (Optional[dict[str, Path]]) –

    Only used when NetCDF CBH files are being

    used, which should not be specified in a PRMS control file. If the CBH files in the control file are to be used, this argument is None. The argument is to be a dict of name:pathlib.Path where the names are in the list: [“albedo_day”, “cloud_cover_day”, “humidity_day”, “potet_day”,

    ”precip_day”, “swrad_day”, “tmax_day”, “tmin_day”, “transp_day”, “windspeed_day”, “AET_cbh_file”, “PET_cbh_file”]

    output_format: Either “pywatershed” (default) or “PRMS”.

__init__(full_control_file, sub_nhm_ids, sub_nhm_segs, full_cbh_nc_files_dict, start_one_below_nhm_seg=False, output_format=None, from_seg_calc_parallel=False, from_seg_calc_check=False, start_time=None, end_time=None)[source]#

Methods

__init__(full_control_file, sub_nhm_ids, ...)

write(write_dir, output_format)

Write the subset domain to file.

Attributes

property sub_nhm_ids: ndarray#
property sub_nhm_segs: ndarray#
write(write_dir, output_format)[source]#

Write the subset domain to file.

Parameters:
  • write_dir (Path) – An NON-EXISTENT directory into which to write domain files. The reason is so that existing domain files are not overwritten.

  • output_format (Literal['pywatershed', 'PRMS', None]) – Optional choice of format. If not supplied, this argument supplied at __init__ is consulted. An error is raised if None is found.

Return type:

None