User API

Execution

Main module.

class ravenpy.ravenpy.Emulator(config: Config, workdir: str | PathLike | None = None, modelname: str | None = None, overwrite: bool = False)[source]
property config: Config

Read-only model configuration.

property modelname: str

File name stem of configuration files.

property output: OutputReader

Return simulation output object.

property output_path: Path | None

Path to model outputs.

resume(timestamp: bool = True) Config[source]

Return new model configuration using state variables from the end of the run.

timestamp: bool

If False, ignore time stamp information in the solution. If True, the solution will set StartDate to the solution’s timestamp.

run(overwrite: bool = False) OutputReader[source]

Run the model. This will write RV files if not already done.

Parameters:

overwrite (bool) – If True, overwrite existing files.

property workdir: Path

Path to RV files and output subdirectory.

class ravenpy.ravenpy.EnsembleReader(*, run_name: str | None = None, paths: List[str | PathLike] | None = None, runs: List[OutputReader] | None = None, dim: str = 'member')[source]
property files
property hydrograph
property storage
class ravenpy.ravenpy.OutputReader(run_name: str | None = None, path: str | Path | None = None)[source]
property diagnostics: dict | None

Return model diagnostics.

property files: dict

Return paths to output files.

property hydrograph: Dataset

Return the hydrograph.

property messages: str | None
property path: Path

Path to output directory.

property solution: dict | None

Return solution file content.

property storage: Dataset

Return the storage variables.

exception ravenpy.ravenpy.RavenError[source]

This is an error that is meant to be raised whenever a message of type “ERROR” is found in the Raven_errors.txt file resulting from a Raven (i.e. the C program) run.

exception ravenpy.ravenpy.RavenWarning[source]

This is a warning corresponding to a message of type “WARNING” in the Raven_errors.txt file resulting from a Raven (i.e. the C program) run.

ravenpy.ravenpy.run(modelname: str, configdir: str | Path, outputdir: str | Path | None = None, overwrite: bool = True, verbose: bool = False) Path[source]

Run Raven given the path to an existing model configuration.

Parameters:
  • modelname (str) – Configuration files stem, i.e. the file name without extension.

  • configdir (Path or str) – Path to configuration files directory.

  • outputdir (Path or str, optional) – Path to model simulation output. If None, will write to configdir/output.

  • overwrite (bool) – If True, overwrite existing files.

  • verbose (bool) – If True, always display Raven warnings. If False, warnings will only be printed if an error occurs.

Returns:

Path to model outputs.

Return type:

Path

Configuration

class ravenpy.config.commands.AssimilateStreamflow(*, sb_id: str)[source]

Subbasin ID to assimilate streamflow for.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'coerce_numbers_to_str': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'sb_id': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sb_id: str
class ravenpy.config.commands.AssimilatedState(*, state: Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'] | Literal['STREAMFLOW'], group: str)[source]
group: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'group': FieldInfo(annotation=str, required=True), 'state': FieldInfo(annotation=Union[Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'], Literal['STREAMFLOW']], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

state: Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'] | Literal['STREAMFLOW']
class ravenpy.config.commands.BasinIndex(*, sb_id: int = 1, name: str = 'watershed', ChannelStorage: float = 0.0, RivuletStorage: float = 0.0, Qout: Sequence[float] = (1.0, 0.0, 0.0), Qlat: Sequence[float] | None = None, Qin: Sequence[float] | None = None)[source]

Initial conditions for a flow segment.

channel_storage: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'coerce_numbers_to_str': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'channel_storage': FieldInfo(annotation=float, required=False, default=0.0, alias='ChannelStorage', alias_priority=2), 'name': FieldInfo(annotation=str, required=False, default='watershed'), 'qin': FieldInfo(annotation=Union[Sequence[float], NoneType], required=False, alias='Qin', alias_priority=2), 'qlat': FieldInfo(annotation=Union[Sequence[float], NoneType], required=False, alias='Qlat', alias_priority=2), 'qout': FieldInfo(annotation=Sequence[float], required=False, default=(1.0, 0.0, 0.0), alias='Qout', alias_priority=2), 'rivulet_storage': FieldInfo(annotation=float, required=False, default=0.0, alias='RivuletStorage', alias_priority=2), 'sb_id': FieldInfo(annotation=int, required=False, default=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
classmethod parse(s)[source]
qin: Sequence[float] | None
qlat: Sequence[float] | None
qout: Sequence[float]
rivulet_storage: float
sb_id: int
class ravenpy.config.commands.BasinStateVariables(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.BasinIndex], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

classmethod parse(sol)[source]
root: Sequence[BasinIndex]
class ravenpy.config.commands.ChannelProfile(*, name: str = 'chn_XXX', bed_slope: float = 0, survey_points: Tuple[Tuple[float, float], ...] = (), roughness_zones: Tuple[Tuple[float, float], ...] = ())[source]

ChannelProfile command (RVP).

bed_slope: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'bed_slope': FieldInfo(annotation=float, required=False, default=0), 'name': FieldInfo(annotation=str, required=False, default='chn_XXX'), 'roughness_zones': FieldInfo(annotation=Tuple[Tuple[float, float], ...], required=False, default=()), 'survey_points': FieldInfo(annotation=Tuple[Tuple[float, float], ...], required=False, default=())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
roughness_zones: Tuple[Tuple[float, float], ...]
survey_points: Tuple[Tuple[float, float], ...]
to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.CustomOutput(*, time_per: Literal['DAILY', 'MONTHLY', 'YEARLY', 'WATER_YEARLY', 'CONTINUOUS'], stat: Literal['AVERAGE', 'MAXIMUM', 'MINIMUM', 'RANGE', 'MEDIAN', 'QUARTILES'], variable: str, space_agg: Literal['BY_BASIN', 'BY_HRU', 'BY_HRU_GROUP', 'BY_SB_GROUP', 'ENTIRE_WATERSHED'], filename: str = '')[source]

Create custom output file to track a single variable, parameter or forcing function over time at a number of basins, HRUs, or across the watershed.

Parameters:
  • time_per ({'DAILY', 'MONTHLY', 'YEARLY', 'WATER_YEARLY', 'CONTINUOUS'}) – Time period.

  • stat ({'AVERAGE', 'MAXIMUM', 'MINIMUM', 'RANGE', 'MEDIAN', 'QUARTILES', 'HISTOGRAM [min] [max] [# bins]') – Statistic reported for each time interval.

  • variable (str) – Variable or parameter name. Consult the Raven documentation for the list of allowed names.

  • space_agg ({'BY_BASIN', 'BY_HRU', 'BY_HRU_GROUP', 'BY_SB_GROUP', 'ENTIRE_WATERSHED'}) – Spatial evaluation domain.

  • filename (str) – Output file name. Defaults to something approximately like <run name>_<variable>_<time_per>_<stat>_<space_agg>.nc

filename: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'filename': FieldInfo(annotation=str, required=False, default=''), 'space_agg': FieldInfo(annotation=Literal['BY_BASIN', 'BY_HRU', 'BY_HRU_GROUP', 'BY_SB_GROUP', 'ENTIRE_WATERSHED'], required=True), 'stat': FieldInfo(annotation=Literal['AVERAGE', 'MAXIMUM', 'MINIMUM', 'RANGE', 'MEDIAN', 'QUARTILES'], required=True), 'time_per': FieldInfo(annotation=Literal['DAILY', 'MONTHLY', 'YEARLY', 'WATER_YEARLY', 'CONTINUOUS'], required=True), 'variable': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

space_agg: Literal['BY_BASIN', 'BY_HRU', 'BY_HRU_GROUP', 'BY_SB_GROUP', 'ENTIRE_WATERSHED']
stat: Literal['AVERAGE', 'MAXIMUM', 'MINIMUM', 'RANGE', 'MEDIAN', 'QUARTILES']
time_per: Literal['DAILY', 'MONTHLY', 'YEARLY', 'WATER_YEARLY', 'CONTINUOUS']
variable: str
class ravenpy.config.commands.Data(*, data_type: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'] = '', units: str = '', ReadFromNetCDF: ReadFromNetCDF)[source]
data_type: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR']
classmethod from_nc(fn, data_type, station_idx=1, alt_names=(), **kwds)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'data_type': FieldInfo(annotation=Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'], required=False, default=''), 'read_from_netcdf': FieldInfo(annotation=ReadFromNetCDF, required=True, alias='ReadFromNetCDF', alias_priority=2), 'units': FieldInfo(annotation=str, required=False, default='')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

read_from_netcdf: ReadFromNetCDF
units: str
class ravenpy.config.commands.EnsembleMode(*, mode: Literal['ENSEMBLE_ENKF'] = 'ENSEMBLE_ENKF', n: int)[source]
mode: Literal['ENSEMBLE_ENKF']
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'mode': FieldInfo(annotation=Literal['ENSEMBLE_ENKF'], required=False, default='ENSEMBLE_ENKF'), 'n': FieldInfo(annotation=int, required=True, description='Number of members')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

n: int
class ravenpy.config.commands.EvaluationPeriod(*, name: str, start: date, end: date)[source]

:EvaluationPeriod [period_name] [start yyyy-mm-dd] [end yyyy-mm-dd]

end: date
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'end': FieldInfo(annotation=date, required=True), 'name': FieldInfo(annotation=str, required=True), 'start': FieldInfo(annotation=date, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
start: date
class ravenpy.config.commands.ForcingPerturbation(*, forcing: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'], dist: Literal['DIST_UNIFORM', 'DIST_NORMAL', 'DIST_GAMMA'], p1: float, p2: float, adj: Literal['ADDITIVE', 'MULTIPLICATIVE'], hru_grp: str = '')[source]
adj: Literal['ADDITIVE', 'MULTIPLICATIVE']
dist: Literal['DIST_UNIFORM', 'DIST_NORMAL', 'DIST_GAMMA']
forcing: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR']
hru_grp: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adj': FieldInfo(annotation=Literal['ADDITIVE', 'MULTIPLICATIVE'], required=True), 'dist': FieldInfo(annotation=Literal['DIST_UNIFORM', 'DIST_NORMAL', 'DIST_GAMMA'], required=True), 'forcing': FieldInfo(annotation=Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'], required=True), 'hru_grp': FieldInfo(annotation=str, required=False, default=''), 'p1': FieldInfo(annotation=float, required=True), 'p2': FieldInfo(annotation=float, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

p1: float
p2: float
class ravenpy.config.commands.Gauge(*, name: str = 'default', Latitude: float, Longitude: float, Elevation: float | None = None, RainCorrection: Variable | Expression | float | None = None, SnowCorrection: Variable | Expression | float | None = None, MonthlyAveEvaporation: Sequence | None = None, MonthlyAveTemperature: Sequence | None = None, MonthlyMinTemperature: Sequence | None = None, MonthlyMaxTemperature: Sequence | None = None, Data: Sequence[Data] | None = None)[source]
classmethod confirm_monthly(v)[source]
data: Sequence[Data] | None
property ds: Dataset

Return xarray Dataset with forcing variables keyed by Raven forcing names.

elevation: float | None
classmethod from_nc(fn: str | Path | Sequence[Path], data_type: Sequence[str] | None = None, station_idx: int = 1, alt_names: Dict[str, str] | None = None, mon_ave: bool = False, data_kwds: Dict[str, Any] | None = None, **kwds) Gauge[source]

Return Gauge instance with configuration options inferred from the netCDF itself.

Parameters:
  • fn (Union[str, Path, Sequence[Path]],) – NetCDF file path or paths.

  • data_type (Sequence[str], None) – Raven data types to extract from netCDF files, e.g. ‘PRECIP’, ‘AVE_TEMP’. The algorithm tries to find all forcings in each file until one is found, then it stops searching for it in the following files.

  • station_idx (int) – Index along station dimension. Starts at 1. Should be the same for all netCDF files.

  • alt_names (dict) – Alternative variable names keyed by data type. Use this if variables do not correspond to CF standard defaults.

  • mon_ave (bool) – If True, compute the monthly average.

  • data_kwds (Dict[options.Forcings, Dict[str, str]]]) – Additional :Data parameters keyed by forcing type and station id. Overrides inferred parameters. Use keyword “ALL” to pass parameters to all variables.

  • **kwds – Additional arguments for Gauge.

Returns:

Gauge instance.

Return type:

Gauge

latitude: float
longitude: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'data': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.Data], NoneType], required=False, alias='Data', alias_priority=2), 'elevation': FieldInfo(annotation=Union[float, NoneType], required=False, alias='Elevation', alias_priority=2), 'latitude': FieldInfo(annotation=float, required=True, alias='Latitude', alias_priority=2), 'longitude': FieldInfo(annotation=float, required=True, alias='Longitude', alias_priority=2), 'monthly_ave_evaporation': FieldInfo(annotation=Union[Sequence, NoneType], required=False, alias='MonthlyAveEvaporation', alias_priority=2), 'monthly_ave_temperature': FieldInfo(annotation=Union[Sequence, NoneType], required=False, alias='MonthlyAveTemperature', alias_priority=2), 'monthly_max_temperature': FieldInfo(annotation=Union[Sequence, NoneType], required=False, alias='MonthlyMaxTemperature', alias_priority=2), 'monthly_min_temperature': FieldInfo(annotation=Union[Sequence, NoneType], required=False, alias='MonthlyMinTemperature', alias_priority=2), 'name': FieldInfo(annotation=str, required=False, default='default'), 'rain_correction': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, alias='RainCorrection', alias_priority=2, description='Rain correction'), 'snow_correction': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, alias='SnowCorrection', alias_priority=2, description='Snow correction')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

monthly_ave_evaporation: Sequence | None
monthly_ave_temperature: Sequence | None
monthly_max_temperature: Sequence | None
monthly_min_temperature: Sequence | None
name: str
rain_correction: Variable | Expression | float | None
snow_correction: Variable | Expression | float | None
class ravenpy.config.commands.GridWeights(*, NumberHRUs: int = 1, NumberGridCells: int = 1, data: Sequence[GWRecord] = (GWRecord(root=(1, 0, 1.0)),))[source]

GridWeights command.

Notes

command can be embedded in both a GriddedForcing or a StationForcing.

The default is to have a single cell that covers an entire single HRU, with a weight of 1.

class GWRecord(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Tuple[int, int, float], required=False, default=(1, 0, 1.0))}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

root: Tuple[int, int, float]
data: Sequence[GWRecord]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'data': FieldInfo(annotation=Sequence[ravenpy.config.commands.GridWeights.GWRecord], required=False, default=(GWRecord(root=(1, 0, 1.0)),)), 'number_grid_cells': FieldInfo(annotation=int, required=False, default=1, alias='NumberGridCells', alias_priority=2), 'number_hrus': FieldInfo(annotation=int, required=False, default=1, alias='NumberHRUs', alias_priority=2)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

number_grid_cells: int
number_hrus: int
classmethod parse(s)[source]
class ravenpy.config.commands.GriddedForcing(*, FileNameNC: Url | Path, VarNameNC: str, DimNamesNC: Sequence[str], station_idx: int | None = None, TimeShift: float | None = None, LinearTransform: LinearTransform | None = None, Deaccumulate: bool | None = None, LatitudeVarNameNC: str | None = None, LongitudeVarNameNC: str | None = None, ElevationVarNameNC: str | None = None, name: str = '', ForcingType: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'] | None = None, GridWeights: GridWeights | RedirectToFile = GridWeights(number_hrus=1, number_grid_cells=1, data=(GWRecord(root=(1, 0, 1.0)),)))[source]

GriddedForcing command (RVT).

classmethod check_dims(v)[source]
deaccumulate: bool | None
dim_names_nc: Sequence[str]
elevation_var_name_nc: str | None
file_name_nc: HttpUrl | Path
forcing_type: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'] | None
grid_weights: GridWeights | RedirectToFile
latitude_var_name_nc: str | None
linear_transform: LinearTransform | None
longitude_var_name_nc: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'deaccumulate': FieldInfo(annotation=Union[bool, NoneType], required=False, alias='Deaccumulate', alias_priority=2), 'dim_names_nc': FieldInfo(annotation=Sequence[str], required=True, alias='DimNamesNC', alias_priority=2), 'elevation_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='ElevationVarNameNC', alias_priority=2), 'file_name_nc': FieldInfo(annotation=Union[Annotated[pydantic_core._pydantic_core.Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)], Path], required=True, alias='FileNameNC', alias_priority=2, description='NetCDF file name.'), 'forcing_type': FieldInfo(annotation=Union[Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'], NoneType], required=False, alias='ForcingType', alias_priority=2), 'grid_weights': FieldInfo(annotation=Union[GridWeights, RedirectToFile], required=False, default=GridWeights(number_hrus=1, number_grid_cells=1, data=(GWRecord(root=(1, 0, 1.0)),)), alias='GridWeights', alias_priority=2), 'latitude_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='LatitudeVarNameNC', alias_priority=2), 'linear_transform': FieldInfo(annotation=Union[LinearTransform, NoneType], required=False, alias='LinearTransform', alias_priority=2), 'longitude_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='LongitudeVarNameNC', alias_priority=2), 'name': FieldInfo(annotation=str, required=False, default=''), 'station_idx': FieldInfo(annotation=Union[int, NoneType], required=False), 'time_shift': FieldInfo(annotation=Union[float, NoneType], required=False, alias='TimeShift', alias_priority=2, description='Time stamp shift in days.'), 'var_name_nc': FieldInfo(annotation=str, required=True, alias='VarNameNC', alias_priority=2, description='NetCDF variable name.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
station_idx: int | None
time_shift: float | None
var_name_nc: str
class ravenpy.config.commands.HRU(*, hru_id: int = 1, area: Variable | Expression | float | None = 0, elevation: float = 0, latitude: float = 0, longitude: float = 0, subbasin_id: int = 1, land_use_class: str = '[NONE]', veg_class: str = '[NONE]', soil_profile: str = '[NONE]', aquifer_profile: str = '[NONE]', terrain_class: str = '[NONE]', slope: float = 0.0, aspect: float = 0.0, hru_type: str | None = None)[source]

Record to populate :HRUs command internal table (RVH).

aquifer_profile: str
area: Variable | Expression | float | None
aspect: float
elevation: float
hru_id: int
hru_type: str | None
land_use_class: str
latitude: float
longitude: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'aquifer_profile': FieldInfo(annotation=str, required=False, default='[NONE]'), 'area': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, default=0), 'aspect': FieldInfo(annotation=float, required=False, default=0.0, metadata=[Ge(ge=0), Le(le=360)]), 'elevation': FieldInfo(annotation=float, required=False, default=0), 'hru_id': FieldInfo(annotation=int, required=False, default=1, metadata=[Gt(gt=0)]), 'hru_type': FieldInfo(annotation=Union[str, NoneType], required=False), 'land_use_class': FieldInfo(annotation=str, required=False, default='[NONE]'), 'latitude': FieldInfo(annotation=float, required=False, default=0), 'longitude': FieldInfo(annotation=float, required=False, default=0), 'slope': FieldInfo(annotation=float, required=False, default=0.0, metadata=[Ge(ge=0)]), 'soil_profile': FieldInfo(annotation=str, required=False, default='[NONE]'), 'subbasin_id': FieldInfo(annotation=int, required=False, default=1, metadata=[Gt(gt=0)]), 'terrain_class': FieldInfo(annotation=str, required=False, default='[NONE]'), 'veg_class': FieldInfo(annotation=str, required=False, default='[NONE]')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

slope: float
soil_profile: str
subbasin_id: int
terrain_class: str
veg_class: str
class ravenpy.config.commands.HRUGroup(*, name: str, groups: _Rec)[source]
groups: _Rec
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'groups': FieldInfo(annotation=HRUGroup._Rec, required=True), 'name': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
class ravenpy.config.commands.HRUState(*, hru_id: int = 1, data: Dict[str, Variable | Expression | float | None] = None)[source]
data: Dict[str, Variable | Expression | float | None]
hru_id: int
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'data': FieldInfo(annotation=Dict[str, Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], required=False, default_factory=dict), 'hru_id': FieldInfo(annotation=int, required=False, default=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

classmethod parse(sol, names=None)[source]
class ravenpy.config.commands.HRUStateVariableTable(root: RootModelRootType = PydanticUndefined)[source]

Table of HRU state variables.

If the HRUState include different attributes, the states will be modified to include all attributes.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.HRUState], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

classmethod parse(sol: str)[source]
root: Sequence[HRUState]
set_attributes()[source]
class ravenpy.config.commands.HRUs(root: RootModelRootType = PydanticUndefined)[source]

HRUs command (RVH).

classmethod ignore_unrecognized_hrus(values)[source]

Ignore HRUs with unrecognized hru_type.

HRUs are ignored only if all allowed HRU classes define hru_type, and if the values passed include it.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.HRU], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

root: Sequence[HRU]
ravenpy.config.commands.LU

alias of LandUseClass

class ravenpy.config.commands.LandUseClass(*, name: str = '', impermeable_frac: Variable | Expression | float | None = 0.0, forest_coverage: Variable | Expression | float | None = 0.0)[source]
forest_coverage: Variable | Expression | float | None
impermeable_frac: Variable | Expression | float | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'forest_coverage': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, default=0.0), 'impermeable_frac': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, default=0.0), 'name': FieldInfo(annotation=str, required=False, default='')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
class ravenpy.config.commands.LandUseClasses(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.LandUseClass], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

root: Sequence[LandUseClass]
class ravenpy.config.commands.LandUseParameterList(*, Parameters: Sequence[Literal['FOREST_COVERAGE', 'IMPERMEABLE_FRAC', 'ROUGHNESS', 'FOREST_SPARSENESS', 'DEP_MAX', 'MAX_DEP_AREA_FRAC', 'DD_MELT_TEMP', 'MELT_FACTOR', 'DD_REFREEZE_TEMP', 'MIN_MELT_FACTOR', 'MAX_MELT_FACTOR', 'REFREEZE_FACTOR', 'REFREEZE_EXP', 'DD_AGGRADATION', 'SNOW_PATCH_LIMIT', 'HBV_MELT_FOR_CORR', 'HBV_MELT_ASP_CORR', 'GLAC_STORAGE_COEFF', 'HBV_MELT_GLACIER_CORR', 'HBV_GLACIER_KMIN', 'HBV_GLACIER_AG', 'CC_DECAY_COEFF', 'SCS_CN', 'SCS_IA_FRACTION', 'PARTITION_COEFF', 'MAX_SAT_AREA_FRAC', 'B_EXP', 'ABST_PERCENT', 'DEP_MAX_FLOW', 'DEP_N', 'DEP_SEEP_K', 'DEP_K', 'DEP_THRESHOLD', 'PDMROF_B', 'PONDED_EXP', 'OW_PET_CORR', 'LAKE_PET_CORR', 'LAKE_REL_COEFF', 'FOREST_PET_CORR', 'GAMMA_SCALE', 'GAMMA_SHAPE', 'GAMMA_SCALE2', 'GAMMA_SHAPE2', 'HMETS_RUNOFF_COEFF', 'AET_COEFF', 'GR4J_X4', 'UBC_ICEPT_FACTOR', 'STREAM_FRACTION', 'BF_LOSS_FRACTION']] | None = None, Units: Sequence[str] | None = None, pl: Sequence[ParameterList])[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'parameters': FieldInfo(annotation=Union[Sequence[Literal['FOREST_COVERAGE', 'IMPERMEABLE_FRAC', 'ROUGHNESS', 'FOREST_SPARSENESS', 'DEP_MAX', 'MAX_DEP_AREA_FRAC', 'DD_MELT_TEMP', 'MELT_FACTOR', 'DD_REFREEZE_TEMP', 'MIN_MELT_FACTOR', 'MAX_MELT_FACTOR', 'REFREEZE_FACTOR', 'REFREEZE_EXP', 'DD_AGGRADATION', 'SNOW_PATCH_LIMIT', 'HBV_MELT_FOR_CORR', 'HBV_MELT_ASP_CORR', 'GLAC_STORAGE_COEFF', 'HBV_MELT_GLACIER_CORR', 'HBV_GLACIER_KMIN', 'HBV_GLACIER_AG', 'CC_DECAY_COEFF', 'SCS_CN', 'SCS_IA_FRACTION', 'PARTITION_COEFF', 'MAX_SAT_AREA_FRAC', 'B_EXP', 'ABST_PERCENT', 'DEP_MAX_FLOW', 'DEP_N', 'DEP_SEEP_K', 'DEP_K', 'DEP_THRESHOLD', 'PDMROF_B', 'PONDED_EXP', 'OW_PET_CORR', 'LAKE_PET_CORR', 'LAKE_REL_COEFF', 'FOREST_PET_CORR', 'GAMMA_SCALE', 'GAMMA_SHAPE', 'GAMMA_SCALE2', 'GAMMA_SHAPE2', 'HMETS_RUNOFF_COEFF', 'AET_COEFF', 'GR4J_X4', 'UBC_ICEPT_FACTOR', 'STREAM_FRACTION', 'BF_LOSS_FRACTION']], NoneType], required=False, alias='Parameters', alias_priority=2), 'pl': FieldInfo(annotation=Sequence[ravenpy.config.base.ParameterList], required=True), 'units': FieldInfo(annotation=Union[Sequence[str], NoneType], required=False, alias='Units', alias_priority=2)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

parameters: Sequence[Literal['FOREST_COVERAGE', 'IMPERMEABLE_FRAC', 'ROUGHNESS', 'FOREST_SPARSENESS', 'DEP_MAX', 'MAX_DEP_AREA_FRAC', 'DD_MELT_TEMP', 'MELT_FACTOR', 'DD_REFREEZE_TEMP', 'MIN_MELT_FACTOR', 'MAX_MELT_FACTOR', 'REFREEZE_FACTOR', 'REFREEZE_EXP', 'DD_AGGRADATION', 'SNOW_PATCH_LIMIT', 'HBV_MELT_FOR_CORR', 'HBV_MELT_ASP_CORR', 'GLAC_STORAGE_COEFF', 'HBV_MELT_GLACIER_CORR', 'HBV_GLACIER_KMIN', 'HBV_GLACIER_AG', 'CC_DECAY_COEFF', 'SCS_CN', 'SCS_IA_FRACTION', 'PARTITION_COEFF', 'MAX_SAT_AREA_FRAC', 'B_EXP', 'ABST_PERCENT', 'DEP_MAX_FLOW', 'DEP_N', 'DEP_SEEP_K', 'DEP_K', 'DEP_THRESHOLD', 'PDMROF_B', 'PONDED_EXP', 'OW_PET_CORR', 'LAKE_PET_CORR', 'LAKE_REL_COEFF', 'FOREST_PET_CORR', 'GAMMA_SCALE', 'GAMMA_SHAPE', 'GAMMA_SCALE2', 'GAMMA_SHAPE2', 'HMETS_RUNOFF_COEFF', 'AET_COEFF', 'GR4J_X4', 'UBC_ICEPT_FACTOR', 'STREAM_FRACTION', 'BF_LOSS_FRACTION']] | None
pl: Sequence[ParameterList]
units: Sequence[str] | None
class ravenpy.config.commands.LinearTransform(*, scale: float = 1, offset: float = 0)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'offset': FieldInfo(annotation=float, required=False, default=0), 'scale': FieldInfo(annotation=float, required=False, default=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

offset: float
scale: float
to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.ObservationData(*, data_type: Literal['HYDROGRAPH'] = 'HYDROGRAPH', units: str = '', ReadFromNetCDF: ReadFromNetCDF, uid: str = '1')[source]
data_type: Literal['HYDROGRAPH']
classmethod from_nc(fn, station_idx: int = 1, alt_names=(), **kwds)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'coerce_numbers_to_str': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'data_type': FieldInfo(annotation=Literal['HYDROGRAPH'], required=False, default='HYDROGRAPH'), 'read_from_netcdf': FieldInfo(annotation=ReadFromNetCDF, required=True, alias='ReadFromNetCDF', alias_priority=2), 'uid': FieldInfo(annotation=str, required=False, default='1'), 'units': FieldInfo(annotation=str, required=False, default='')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

read_from_netcdf: ReadFromNetCDF
uid: str
units: str
class ravenpy.config.commands.ObservationErrorModel(*, state: Literal['STREAMFLOW'], dist: Literal['DIST_UNIFORM', 'DIST_NORMAL', 'DIST_GAMMA'], p1: float, p2: float, adj: Literal['ADDITIVE', 'MULTIPLICATIVE'])[source]
adj: Literal['ADDITIVE', 'MULTIPLICATIVE']
dist: Literal['DIST_UNIFORM', 'DIST_NORMAL', 'DIST_GAMMA']
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'adj': FieldInfo(annotation=Literal['ADDITIVE', 'MULTIPLICATIVE'], required=True), 'dist': FieldInfo(annotation=Literal['DIST_UNIFORM', 'DIST_NORMAL', 'DIST_GAMMA'], required=True), 'p1': FieldInfo(annotation=float, required=True), 'p2': FieldInfo(annotation=float, required=True), 'state': FieldInfo(annotation=Literal['STREAMFLOW'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

p1: float
p2: float
state: Literal['STREAMFLOW']
class ravenpy.config.commands.Process(*, algo: str = 'RAVEN_DEFAULT', source: str | None = None, to: Sequence[str] = ())[source]

Process type embedded in HydrologicProcesses command.

See processes.py for list of processes.

algo: str
classmethod is_list(v)[source]
classmethod is_source_state_variable(v: str)[source]
classmethod is_to_state_variable(v: Sequence)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'algo': FieldInfo(annotation=str, required=False, default='RAVEN_DEFAULT'), 'source': FieldInfo(annotation=Union[str, NoneType], required=False), 'to': FieldInfo(annotation=Sequence[str], required=False, default=())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

source: str | None
to: Sequence[str]
to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.RainSnowTransition(*, temp: Variable | Expression | float | None, delta: Variable | Expression | float | None)[source]

Specify the range of temperatures over which there will be a rain/snow mix when partitioning total precipitation into rain and snow components.

delta: Variable | Expression | float | None

Range [C].

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'delta': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=True), 'temp': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

temp: Variable | Expression | float | None

Midpoint of the temperature range [C].

to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.ReadFromNetCDF(*, FileNameNC: Url | Path, VarNameNC: str, DimNamesNC: Sequence[str], StationIdx: int = 1, TimeShift: float | None = None, LinearTransform: LinearTransform | None = None, Deaccumulate: bool | None = None, LatitudeVarNameNC: str | None = None, LongitudeVarNameNC: str | None = None, ElevationVarNameNC: str | None = None)[source]
property da: DataArray

Return DataArray from configuration.

deaccumulate: bool | None
dim_names_nc: Sequence[str]
elevation_var_name_nc: str | None
file_name_nc: Url | Path
classmethod from_nc(fn, data_type, station_idx=1, alt_names=(), **kwds)[source]

Instantiate class from netCDF dataset.

latitude_var_name_nc: str | None
linear_transform: LinearTransform | None
longitude_var_name_nc: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'deaccumulate': FieldInfo(annotation=Union[bool, NoneType], required=False, alias='Deaccumulate', alias_priority=2), 'dim_names_nc': FieldInfo(annotation=Sequence[str], required=True, alias='DimNamesNC', alias_priority=2), 'elevation_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='ElevationVarNameNC', alias_priority=2), 'file_name_nc': FieldInfo(annotation=Union[Annotated[pydantic_core._pydantic_core.Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)], Path], required=True, alias='FileNameNC', alias_priority=2, description='NetCDF file name.'), 'latitude_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='LatitudeVarNameNC', alias_priority=2), 'linear_transform': FieldInfo(annotation=Union[LinearTransform, NoneType], required=False, alias='LinearTransform', alias_priority=2), 'longitude_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='LongitudeVarNameNC', alias_priority=2), 'station_idx': FieldInfo(annotation=int, required=False, default=1, alias='StationIdx', alias_priority=2, description='NetCDF index along station dimension. Starts at 1.'), 'time_shift': FieldInfo(annotation=Union[float, NoneType], required=False, alias='TimeShift', alias_priority=2, description='Time stamp shift in days.'), 'var_name_nc': FieldInfo(annotation=str, required=True, alias='VarNameNC', alias_priority=2, description='NetCDF variable name.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

classmethod reorder_time(v)[source]

TODO: Return dimensions as x, y, t. Currently only puts time at the end.

station_idx: int
time_shift: float | None
var_name_nc: str
class ravenpy.config.commands.RedirectToFile(root: RootModelRootType = PydanticUndefined)[source]

RedirectToFile command (RVT).

Notes

For the moment, this command can only be used in the context of a GriddedForcingCommand or a StationForcingCommand, as a grid_weights field replacement when inlining is not desired.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Path, required=True, metadata=[PathType(path_type='file')])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

root: Path
to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.Reservoir(*, name: str = 'Lake_XXX', SubBasinID: int = 0, HRUID: int = 0, Type: str = 'RESROUTE_STANDARD', WeirCoefficient: float = 0, CrestWidth: float = 0, MaxDepth: float = 0, LakeArea: float = 0)[source]

Reservoir command (RVH).

crest_width: float
hru_id: int
lake_area: float
max_depth: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'crest_width': FieldInfo(annotation=float, required=False, default=0, alias='CrestWidth', alias_priority=2), 'hru_id': FieldInfo(annotation=int, required=False, default=0, alias='HRUID', alias_priority=2), 'lake_area': FieldInfo(annotation=float, required=False, default=0, alias='LakeArea', alias_priority=2, description='Lake area in m2'), 'max_depth': FieldInfo(annotation=float, required=False, default=0, alias='MaxDepth', alias_priority=2), 'name': FieldInfo(annotation=str, required=False, default='Lake_XXX'), 'subbasin_id': FieldInfo(annotation=int, required=False, default=0, alias='SubBasinID', alias_priority=2), 'type': FieldInfo(annotation=str, required=False, default='RESROUTE_STANDARD', alias='Type', alias_priority=2), 'weir_coefficient': FieldInfo(annotation=float, required=False, default=0, alias='WeirCoefficient', alias_priority=2)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
subbasin_id: int
type: str
weir_coefficient: float
ravenpy.config.commands.SB

alias of SubBasin

class ravenpy.config.commands.SBGroupPropertyMultiplier(*, group_name: str, parameter_name: str, mult: float)[source]
group_name: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'group_name': FieldInfo(annotation=str, required=True), 'mult': FieldInfo(annotation=float, required=True), 'parameter_name': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

mult: float
parameter_name: str
ravenpy.config.commands.SC

alias of SoilClass

ravenpy.config.commands.SP

alias of SoilProfile

class ravenpy.config.commands.SeasonalRelativeHeight(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands._MonthlyRecord], required=False, default=(<ravenpy.config.commands._MonthlyRecord object>,))}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

root: Sequence[_MonthlyRecord]
class ravenpy.config.commands.SeasonalRelativeLAI(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands._MonthlyRecord], required=False, default=(<ravenpy.config.commands._MonthlyRecord object>,))}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

root: Sequence[_MonthlyRecord]
class ravenpy.config.commands.SoilClasses(root: RootModelRootType = PydanticUndefined)[source]
class SoilClass(*, name: str, mineral: Tuple[float, float, float] | None = None, organic: float | None = None)[source]
mineral: Tuple[float, float, float] | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'mineral': FieldInfo(annotation=Union[Tuple[float, float, float], NoneType], required=False), 'name': FieldInfo(annotation=str, required=True), 'organic': FieldInfo(annotation=Union[float, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
organic: float | None
classmethod validate_mineral(v)[source]

Assert sum of mineral fraction is 1.

classmethod validate_mineral_pct(v: Tuple)[source]
classmethod validate_organic_pct(v: float)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.SoilClasses.SoilClass], required=False, default=())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

root: Sequence[SoilClass]
class ravenpy.config.commands.SoilModel(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=int, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

root: int
to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.SoilParameterList(*, Parameters: Sequence[Literal['SAND_CON', 'CLAY_CON', 'SILT_CON', 'ORG_CON', 'POROSITY', 'STONE_FRAC', 'SAT_WILT', 'FIELD_CAPACITY', 'BULK_DENSITY', 'HYDRAUL_COND', 'CLAPP_B', 'CLAPP N,CLAPP M', 'SAT_RES', 'AIR_ENTRY_PRESSURE', 'WILTING_PRESSURE', 'HEAT_CAPACITY', 'THERMAL_COND', 'WETTING_FRONT_PSI', 'EVAP_RES_FC', 'SHUTTLEWORTH_B', 'ALBEDO_WET', 'ALBEDO_DRY', 'VIZ_ZMIN', 'VIC_ZMAX', 'VIC ALPHA', 'VIC_EVAP_GAMMA', 'MAX_PERC_RATE', 'PERC_N', 'PERC_COEFF', 'SAC_PERC_ALPHA', 'SAC_PERC_EXPON', 'SAC_PERC_PFREE', 'UNAVAIL_FRAC', 'HBV_BETA', 'MAX_BASEFLOW_RATE', 'BASEFLOW_N', 'BASEFLOW_COEFF', 'BASEFLOW_COEFF2', 'BASEFLOW_THRESH', 'BF_LOSS_FRACTION', 'STORAGE_THRESHOLD', 'MAX_CAP_RISE_RATE', 'MAX_INTERFLOW_RATE', 'INTERFLOW_COEF', 'UBC_EVAL_SOIL_DEF', 'UBC_INFIL_SOIL_DEF', 'GR4J_X2', 'GR4J_X3', 'B_EXP', 'PET_CORRECTION']] | None = None, Units: Sequence[str] | None = None, pl: Sequence[ParameterList])[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'parameters': FieldInfo(annotation=Union[Sequence[Literal['SAND_CON', 'CLAY_CON', 'SILT_CON', 'ORG_CON', 'POROSITY', 'STONE_FRAC', 'SAT_WILT', 'FIELD_CAPACITY', 'BULK_DENSITY', 'HYDRAUL_COND', 'CLAPP_B', 'CLAPP N,CLAPP M', 'SAT_RES', 'AIR_ENTRY_PRESSURE', 'WILTING_PRESSURE', 'HEAT_CAPACITY', 'THERMAL_COND', 'WETTING_FRONT_PSI', 'EVAP_RES_FC', 'SHUTTLEWORTH_B', 'ALBEDO_WET', 'ALBEDO_DRY', 'VIZ_ZMIN', 'VIC_ZMAX', 'VIC ALPHA', 'VIC_EVAP_GAMMA', 'MAX_PERC_RATE', 'PERC_N', 'PERC_COEFF', 'SAC_PERC_ALPHA', 'SAC_PERC_EXPON', 'SAC_PERC_PFREE', 'UNAVAIL_FRAC', 'HBV_BETA', 'MAX_BASEFLOW_RATE', 'BASEFLOW_N', 'BASEFLOW_COEFF', 'BASEFLOW_COEFF2', 'BASEFLOW_THRESH', 'BF_LOSS_FRACTION', 'STORAGE_THRESHOLD', 'MAX_CAP_RISE_RATE', 'MAX_INTERFLOW_RATE', 'INTERFLOW_COEF', 'UBC_EVAL_SOIL_DEF', 'UBC_INFIL_SOIL_DEF', 'GR4J_X2', 'GR4J_X3', 'B_EXP', 'PET_CORRECTION']], NoneType], required=False, alias='Parameters', alias_priority=2), 'pl': FieldInfo(annotation=Sequence[ravenpy.config.base.ParameterList], required=True), 'units': FieldInfo(annotation=Union[Sequence[str], NoneType], required=False, alias='Units', alias_priority=2)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

parameters: Sequence[Literal['SAND_CON', 'CLAY_CON', 'SILT_CON', 'ORG_CON', 'POROSITY', 'STONE_FRAC', 'SAT_WILT', 'FIELD_CAPACITY', 'BULK_DENSITY', 'HYDRAUL_COND', 'CLAPP_B', 'CLAPP N,CLAPP M', 'SAT_RES', 'AIR_ENTRY_PRESSURE', 'WILTING_PRESSURE', 'HEAT_CAPACITY', 'THERMAL_COND', 'WETTING_FRONT_PSI', 'EVAP_RES_FC', 'SHUTTLEWORTH_B', 'ALBEDO_WET', 'ALBEDO_DRY', 'VIZ_ZMIN', 'VIC_ZMAX', 'VIC ALPHA', 'VIC_EVAP_GAMMA', 'MAX_PERC_RATE', 'PERC_N', 'PERC_COEFF', 'SAC_PERC_ALPHA', 'SAC_PERC_EXPON', 'SAC_PERC_PFREE', 'UNAVAIL_FRAC', 'HBV_BETA', 'MAX_BASEFLOW_RATE', 'BASEFLOW_N', 'BASEFLOW_COEFF', 'BASEFLOW_COEFF2', 'BASEFLOW_THRESH', 'BF_LOSS_FRACTION', 'STORAGE_THRESHOLD', 'MAX_CAP_RISE_RATE', 'MAX_INTERFLOW_RATE', 'INTERFLOW_COEF', 'UBC_EVAL_SOIL_DEF', 'UBC_INFIL_SOIL_DEF', 'GR4J_X2', 'GR4J_X3', 'B_EXP', 'PET_CORRECTION']] | None
pl: Sequence[ParameterList]
units: Sequence[str] | None
class ravenpy.config.commands.SoilProfile(*, name: str = '', soil_classes: Sequence[str] = (), thicknesses: Sequence[Variable | Expression | float | None] = ())[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'name': FieldInfo(annotation=str, required=False, default=''), 'soil_classes': FieldInfo(annotation=Sequence[str], required=False, default=()), 'thicknesses': FieldInfo(annotation=Sequence[Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], required=False, default=())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
soil_classes: Sequence[str]
thicknesses: Sequence[Variable | Expression | float | None]
class ravenpy.config.commands.SoilProfiles(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.SoilProfile], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

root: Sequence[SoilProfile]
class ravenpy.config.commands.StationForcing(*, FileNameNC: Url | Path, VarNameNC: str, DimNamesNC: Sequence[str], station_idx: int | None = None, TimeShift: float | None = None, LinearTransform: LinearTransform | None = None, Deaccumulate: bool | None = None, LatitudeVarNameNC: str | None = None, LongitudeVarNameNC: str | None = None, ElevationVarNameNC: str | None = None, name: str = '', ForcingType: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'] | None = None, GridWeights: GridWeights | RedirectToFile = GridWeights(number_hrus=1, number_grid_cells=1, data=(GWRecord(root=(1, 0, 1.0)),)))[source]

StationForcing command (RVT).

classmethod check_dims(v)[source]
deaccumulate: bool | None
dim_names_nc: Sequence[str]
elevation_var_name_nc: str | None
file_name_nc: HttpUrl | Path
forcing_type: Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'] | None
classmethod from_nc(fn, data_type, alt_names=(), **kwds)[source]

Instantiate class from netCDF dataset.

grid_weights: GridWeights | RedirectToFile
latitude_var_name_nc: str | None
linear_transform: LinearTransform | None
longitude_var_name_nc: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'deaccumulate': FieldInfo(annotation=Union[bool, NoneType], required=False, alias='Deaccumulate', alias_priority=2), 'dim_names_nc': FieldInfo(annotation=Sequence[str], required=True, alias='DimNamesNC', alias_priority=2), 'elevation_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='ElevationVarNameNC', alias_priority=2), 'file_name_nc': FieldInfo(annotation=Union[Annotated[pydantic_core._pydantic_core.Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)], Path], required=True, alias='FileNameNC', alias_priority=2, description='NetCDF file name.'), 'forcing_type': FieldInfo(annotation=Union[Literal['PRECIP', 'PRECIP_DAILY_AVE', 'PRECIP_5DAY', 'SNOW_FRAC', 'SNOWFALL', 'RAINFALL', 'RECHARGE', 'TEMP_AVE', 'TEMP_DAILY_AVE', 'TEMP_MIN', 'TEMP_DAILY_MIN', 'TEMP_MAX', 'TEMP_DAILY_MAX', 'TEMP_MONTH_MAX', 'TEMP_MONTH_MIN', 'TEMP_MONTH_AVE', 'TEMP_AVE_UNC', 'TEMP_MAX_UNC', 'TEMP_MIN_UNC', 'AIR_DENS', 'AIR_PRES', 'REL_HUMIDITY', 'ET_RADIA', 'SHORTWAVE', 'SW_RADIA', 'SW_RADIA_NET', 'LW_RADIA_NET', 'LW_INCOMING', 'CLOUD_COVER', 'DAY_LENGTH', 'DAY_ANGLE', 'WIND_VEL', 'PET', 'OW_PET', 'PET_MONTH_AVE', 'POTENTIAL_MELT', 'SUBDAILY_CORR'], NoneType], required=False, alias='ForcingType', alias_priority=2), 'grid_weights': FieldInfo(annotation=Union[GridWeights, RedirectToFile], required=False, default=GridWeights(number_hrus=1, number_grid_cells=1, data=(GWRecord(root=(1, 0, 1.0)),)), alias='GridWeights', alias_priority=2), 'latitude_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='LatitudeVarNameNC', alias_priority=2), 'linear_transform': FieldInfo(annotation=Union[LinearTransform, NoneType], required=False, alias='LinearTransform', alias_priority=2), 'longitude_var_name_nc': FieldInfo(annotation=Union[str, NoneType], required=False, alias='LongitudeVarNameNC', alias_priority=2), 'name': FieldInfo(annotation=str, required=False, default=''), 'station_idx': FieldInfo(annotation=Union[int, NoneType], required=False), 'time_shift': FieldInfo(annotation=Union[float, NoneType], required=False, alias='TimeShift', alias_priority=2, description='Time stamp shift in days.'), 'var_name_nc': FieldInfo(annotation=str, required=True, alias='VarNameNC', alias_priority=2, description='NetCDF variable name.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
station_idx: int | None
time_shift: float | None
var_name_nc: str
class ravenpy.config.commands.SubBasin(*, subbasin_id: int = 1, name: str = 'sub_001', downstream_id: int = -1, profile: str = 'NONE', reach_length: float = 0, gauged: bool = True, gauge_id: str | None = '')[source]

Record to populate RVH :SubBasins command internal table.

downstream_id: int
gauge_id: str | None
gauged: bool
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'coerce_numbers_to_str': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'downstream_id': FieldInfo(annotation=int, required=False, default=-1), 'gauge_id': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'gauged': FieldInfo(annotation=bool, required=False, default=True), 'name': FieldInfo(annotation=str, required=False, default='sub_001'), 'profile': FieldInfo(annotation=str, required=False, default='NONE'), 'reach_length': FieldInfo(annotation=float, required=False, default=0), 'subbasin_id': FieldInfo(annotation=int, required=False, default=1, metadata=[Gt(gt=0)])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
profile: str
reach_length: float
subbasin_id: int
class ravenpy.config.commands.SubBasinGroup(*, name: str = '', sb_ids: Sequence[int] = ())[source]

SubBasinGroup command (RVH).

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'name': FieldInfo(annotation=str, required=False, default=''), 'sb_ids': FieldInfo(annotation=Sequence[int], required=False, default=())}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
sb_ids: Sequence[int]
to_rv()[source]

Return Raven configuration string.

class ravenpy.config.commands.SubBasinProperties(*, Parameters: Sequence[Literal['TIME_TO_PEAK', 'TIME_CONC', 'TIME_LAG', 'NUM_RESERVOIRS', 'RES_CONSTANT', 'GAMMA_SHAPE', 'GAMMA_SCALE', 'Q_REFERENCE', 'MANNINGS_N', 'SLOPE', 'DIFFUSIVITY', 'CELERITY', 'RAIN_CORR', 'SNOW_CORR']] | None = None, records: Sequence[SubBasinProperty] | None = None)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'parameters': FieldInfo(annotation=Union[Sequence[Literal['TIME_TO_PEAK', 'TIME_CONC', 'TIME_LAG', 'NUM_RESERVOIRS', 'RES_CONSTANT', 'GAMMA_SHAPE', 'GAMMA_SCALE', 'Q_REFERENCE', 'MANNINGS_N', 'SLOPE', 'DIFFUSIVITY', 'CELERITY', 'RAIN_CORR', 'SNOW_CORR']], NoneType], required=False, alias='Parameters', alias_priority=2), 'records': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.SubBasinProperty], NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

parameters: Sequence[Literal['TIME_TO_PEAK', 'TIME_CONC', 'TIME_LAG', 'NUM_RESERVOIRS', 'RES_CONSTANT', 'GAMMA_SHAPE', 'GAMMA_SCALE', 'Q_REFERENCE', 'MANNINGS_N', 'SLOPE', 'DIFFUSIVITY', 'CELERITY', 'RAIN_CORR', 'SNOW_CORR']] | None
records: Sequence[SubBasinProperty] | None
class ravenpy.config.commands.SubBasinProperty(*, sb_id: str, values: Sequence[Variable | Expression | float | None])[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'coerce_numbers_to_str': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'sb_id': FieldInfo(annotation=str, required=True), 'values': FieldInfo(annotation=Sequence[Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sb_id: str
values: Sequence[Variable | Expression | float | None]
class ravenpy.config.commands.SubBasins(root: RootModelRootType = PydanticUndefined)[source]

SubBasins command (RVH).

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.SubBasin], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

root: Sequence[SubBasin]
ravenpy.config.commands.TC

alias of TerrainClass

class ravenpy.config.commands.TerrainClass(*, name: str, hillslope_length: Variable | Expression | float | None, drainage_density: Variable | Expression | float | None, topmodel_lambda: Variable | Expression | float | None = None)[source]
drainage_density: Variable | Expression | float | None
hillslope_length: Variable | Expression | float | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'drainage_density': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=True), 'hillslope_length': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=True), 'name': FieldInfo(annotation=str, required=True), 'topmodel_lambda': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
topmodel_lambda: Variable | Expression | float | None
class ravenpy.config.commands.TerrainClasses(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.TerrainClass], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

root: Sequence[TerrainClass]
ravenpy.config.commands.VC

alias of VegetationClass

class ravenpy.config.commands.VegetationClass(*, name: str = '', max_ht: Variable | Expression | float | None = 0.0, max_lai: Variable | Expression | float | None = 0.0, max_leaf_cond: Variable | Expression | float | None = 0.0)[source]
max_ht: Variable | Expression | float | None
max_lai: Variable | Expression | float | None
max_leaf_cond: Variable | Expression | float | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'max_ht': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, default=0.0), 'max_lai': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, default=0.0), 'max_leaf_cond': FieldInfo(annotation=Union[Variable, Expression, float, NoneType], required=False, default=0.0), 'name': FieldInfo(annotation=str, required=False, default='')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

name: str
class ravenpy.config.commands.VegetationClasses(root: RootModelRootType = PydanticUndefined)[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Sequence[ravenpy.config.commands.VegetationClass], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

root: Sequence[VegetationClass]
class ravenpy.config.commands.VegetationParameterList(*, Parameters: Sequence[Literal['MAX_HEIGHT', 'MAX_LEAF_COND', 'MAX_LAI', 'SVF_EXTINCTION', 'RAIN_ICEPT_PCT', 'SNOW_ICEPT_PCT', 'RAIN_ICEPT_FACT', 'SNOW_ICEPT_FACT', 'SAI_HT_RATIO', 'TRUNK_FRACTION', 'STEMFLOW_FRAC', 'ALBEDO', 'ALBEDO_WET', 'MAX_CAPACITY', 'MAX_SNOW_CAPACITY', 'ROOT_EXTINCT', 'MAX_ROOT_LENGTH', 'MIN_RESISTIVITY', 'XYLEM_FRAC', 'ROOTRADIUS', 'PSI_CRITICAL', 'DRIP_PROPORTION', 'MAX_INTERCEPT_RATE', 'CHU_MATURITY', 'VEG_DIAM', 'VEG_MBETA', 'VEG_DENSPET_VEG_CORR', 'TFRAIN', 'TFSNOW', 'RELATIVE_HT', 'RELATIVE_LAI', 'CAP_LAI_RATIO', 'SNOCAP_LAI_RATIO']] | None = None, Units: Sequence[str] | None = None, pl: Sequence[ParameterList])[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'parameters': FieldInfo(annotation=Union[Sequence[Literal['MAX_HEIGHT', 'MAX_LEAF_COND', 'MAX_LAI', 'SVF_EXTINCTION', 'RAIN_ICEPT_PCT', 'SNOW_ICEPT_PCT', 'RAIN_ICEPT_FACT', 'SNOW_ICEPT_FACT', 'SAI_HT_RATIO', 'TRUNK_FRACTION', 'STEMFLOW_FRAC', 'ALBEDO', 'ALBEDO_WET', 'MAX_CAPACITY', 'MAX_SNOW_CAPACITY', 'ROOT_EXTINCT', 'MAX_ROOT_LENGTH', 'MIN_RESISTIVITY', 'XYLEM_FRAC', 'ROOTRADIUS', 'PSI_CRITICAL', 'DRIP_PROPORTION', 'MAX_INTERCEPT_RATE', 'CHU_MATURITY', 'VEG_DIAM', 'VEG_MBETA', 'VEG_DENSPET_VEG_CORR', 'TFRAIN', 'TFSNOW', 'RELATIVE_HT', 'RELATIVE_LAI', 'CAP_LAI_RATIO', 'SNOCAP_LAI_RATIO']], NoneType], required=False, alias='Parameters', alias_priority=2), 'pl': FieldInfo(annotation=Sequence[ravenpy.config.base.ParameterList], required=True), 'units': FieldInfo(annotation=Union[Sequence[str], NoneType], required=False, alias='Units', alias_priority=2)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

parameters: Sequence[Literal['MAX_HEIGHT', 'MAX_LEAF_COND', 'MAX_LAI', 'SVF_EXTINCTION', 'RAIN_ICEPT_PCT', 'SNOW_ICEPT_PCT', 'RAIN_ICEPT_FACT', 'SNOW_ICEPT_FACT', 'SAI_HT_RATIO', 'TRUNK_FRACTION', 'STEMFLOW_FRAC', 'ALBEDO', 'ALBEDO_WET', 'MAX_CAPACITY', 'MAX_SNOW_CAPACITY', 'ROOT_EXTINCT', 'MAX_ROOT_LENGTH', 'MIN_RESISTIVITY', 'XYLEM_FRAC', 'ROOTRADIUS', 'PSI_CRITICAL', 'DRIP_PROPORTION', 'MAX_INTERCEPT_RATE', 'CHU_MATURITY', 'VEG_DIAM', 'VEG_MBETA', 'VEG_DENSPET_VEG_CORR', 'TFRAIN', 'TFSNOW', 'RELATIVE_HT', 'RELATIVE_LAI', 'CAP_LAI_RATIO', 'SNOCAP_LAI_RATIO']] | None
pl: Sequence[ParameterList]
units: Sequence[str] | None
class ravenpy.config.rvs.Config(*, EnKFMode: EnKFMode | None = None, WindowSize: int | None = None, SolutionRunName: str | None = None, ExtraRVTFilename: str | None = None, OutputDirectoryFormat: str | Path | None = None, ForecastRVTFilename: str | None = None, TruncateHindcasts: bool | None = None, ForcingPerturbation: Sequence[ForcingPerturbation] | None = None, AssimilatedState: Sequence[AssimilatedState] | None = None, AssimilateStreamflow: Sequence[AssimilateStreamflow] | None = None, ObservationErrorModel: Sequence[ObservationErrorModel] | None = None, params: Any = None, SoilClasses: SoilClasses | None = None, SoilProfiles: SoilProfiles | None = None, VegetationClasses: VegetationClasses | None = None, LandUseClasses: LandUseClasses | None = None, TerrainClasses: TerrainClasses | None = None, SoilParameterList: SoilParameterList | None = None, LandUseParameterList: LandUseParameterList | None = None, VegetationParameterList: VegetationParameterList | None = None, ChannelProfile: Sequence[ChannelProfile] | None = None, GlobalParameter: Dict[str, Variable | Expression | float | None] | None = {}, RainSnowTransition: RainSnowTransition | None = None, SeasonalRelativeLAI: SeasonalRelativeLAI | None = None, SeasonalRelativeHeight: SeasonalRelativeHeight | None = None, Gauge: Sequence[Gauge] | None = None, StationForcing: Sequence[StationForcing] | None = None, GriddedForcing: Sequence[GriddedForcing] | None = None, ObservationData: Sequence[ObservationData] | None = None, SubBasins: SubBasins | None = None, SubBasinGroup: Sequence[SubBasinGroup] | None = None, SubBasinProperties: SubBasinProperties | None = None, SBGroupPropertyMultiplier: Sequence[SBGroupPropertyMultiplier] | None = None, HRUs: HRUs | None = None, HRUGroup: Sequence[HRUGroup] | None = None, Reservoirs: Sequence[Reservoir] | None = None, HRUStateVariableTable: HRUStateVariableTable | None = None, BasinStateVariables: BasinStateVariables | None = None, UniformInitialConditions: Dict[str, Variable | Expression | float | None] | None = None, SilentMode: bool | None = None, NoisyMode: bool | None = None, RunName: str | None = None, Calendar: Calendar | None = None, StartDate: date | datetime | datetime | None = None, AssimilationStartTime: date | datetime | datetime | None = None, EndDate: date | datetime | datetime | None = None, Duration: float | None = None, TimeStep: float | str | None = None, Routing: Routing | None = None, CatchmentRoute: CatchmentRoute | None = None, Evaporation: Evaporation | None = None, OW_Evaporation: Evaporation | None = None, SWRadiationMethod: SWRadiationMethod | None = None, SWCloudCorrect: SWCloudCorrect | None = None, SWCanopyCorrect: SWCanopyCorrect | None = None, LWRadiationMethod: LWRadiationMethod | None = None, WindspeedMethod: WindspeedMethod | None = None, RainSnowFraction: RainSnowFraction | None = None, PotentialMeltMethod: PotentialMeltMethod | None = None, OroTempCorrect: OroTempCorrect | None = None, OroPrecipCorrect: OroPrecipCorrect | None = None, OroPETCorrect: OroPETCorrect | None = None, CloudCoverMethod: CloudCoverMethod | None = None, PrecipIceptFract: PrecipIceptFract | None = None, SubdailyMethod: SubdailyMethod | None = None, MonthlyInterpolationMethod: MonthlyInterpolationMethod | None = None, SoilModel: SoilModel | None = None, TemperatureCorrection: bool | None = None, LakeStorage: Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'] | None = None, DefineHRUGroups: Sequence[str] | None = None, HydrologicProcesses: Sequence[Process | Conditional | ProcessGroup] | None = None, EvaluationMetrics: Sequence[EvaluationMetrics] | None = None, EvaluationPeriod: Sequence[EvaluationPeriod] | None = None, EnsembleMode: EnsembleMode | None = None, WriteNetcdfFormat: bool | None = None, NetCDFAttribute: Dict[str, str] | None = None, CustomOutput: Sequence[CustomOutput] | None = None, DirectEvaporation: bool | None = None, DeltaresFEWSMode: bool | None = None, DebugMode: bool | None = None, DontWriteWatershedStorage: bool | None = None, PavicsMode: bool | None = None, SuppressOutput: bool | None = None, WriteForcingFunctions: bool | None = None, WriteSubbasinFile: bool | None = None, WriteLocalFlows: bool | None = None)[source]
assimilate_streamflow: Sequence[rc.AssimilateStreamflow] | None
assimilated_state: Sequence[rc.AssimilatedState] | None
assimilation_start_time: date | datetime | datetime | None
basin_state_variables: rc.BasinStateVariables | None
calendar: Calendar | None
catchment_route: CatchmentRoute | None
channel_profile: Sequence[rc.ChannelProfile] | None
cloud_cover_method: CloudCoverMethod | None
custom_output: Sequence[CustomOutput] | None
debug_mode: bool | None
define_hru_groups: Sequence[str] | None
deltares_fews_mode: bool | None
direct_evaporation: bool | None
dont_write_watershed_storage: bool | None
duplicate(**kwds)[source]

Duplicate this model, changing the values given in the keywords.

duration: float | None
end_date: date | datetime | datetime | None
enkf_mode: o.EnKFMode | None
ensemble_mode: EnsembleMode | None
evaluation_metrics: Sequence[EvaluationMetrics] | None
evaluation_period: Sequence[EvaluationPeriod] | None
evaporation: Evaporation | None
extra_rvt_filename: str | None
forcing_perturbation: Sequence[rc.ForcingPerturbation] | None
forecast_rvt_filename: str | None
gauge: Sequence[rc.Gauge] | None
global_parameter: Dict[str, Sym] | None
gridded_forcing: Sequence[rc.GriddedForcing] | None
header(rv)[source]

Return the header to print at the top of each RV file.

hru_group: Sequence[rc.HRUGroup] | None
hru_state_variable_table: rc.HRUStateVariableTable | None
hrus: rc.HRUs | None
hydrologic_processes: Sequence[Process | Conditional | ProcessGroup] | None
property is_symbolic

Return True if configuration contains symbolic expressions.

lake_storage: Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'] | None
land_use_classes: rc.LandUseClasses | None
land_use_parameter_list: rc.LandUseParameterList | None
lw_radiation_method: LWRadiationMethod | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'assimilate_streamflow': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.AssimilateStreamflow], NoneType], required=False, default_factory=<lambda>, alias='AssimilateStreamflow', alias_priority=2, validate_default=False), 'assimilated_state': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.AssimilatedState], NoneType], required=False, default_factory=<lambda>, alias='AssimilatedState', alias_priority=2, validate_default=False), 'assimilation_start_time': FieldInfo(annotation=Union[date, datetime, datetime, NoneType], required=False, default_factory=<lambda>, alias='AssimilationStartTime', alias_priority=2, validate_default=False), 'basin_state_variables': FieldInfo(annotation=Union[BasinStateVariables, NoneType], required=False, default_factory=<lambda>, alias='BasinStateVariables', alias_priority=2, validate_default=False), 'calendar': FieldInfo(annotation=Union[Calendar, NoneType], required=False, default_factory=<lambda>, alias='Calendar', alias_priority=2, validate_default=False), 'catchment_route': FieldInfo(annotation=Union[CatchmentRoute, NoneType], required=False, default_factory=<lambda>, alias='CatchmentRoute', alias_priority=2, validate_default=False), 'channel_profile': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ChannelProfile], NoneType], required=False, default_factory=<lambda>, alias='ChannelProfile', alias_priority=2, validate_default=False), 'cloud_cover_method': FieldInfo(annotation=Union[CloudCoverMethod, NoneType], required=False, default_factory=<lambda>, alias='CloudCoverMethod', alias_priority=2, validate_default=False), 'custom_output': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.CustomOutput], NoneType], required=False, default_factory=<lambda>, alias='CustomOutput', alias_priority=2, validate_default=False), 'debug_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DebugMode', alias_priority=2, validate_default=False), 'define_hru_groups': FieldInfo(annotation=Union[Sequence[str], NoneType], required=False, default_factory=<lambda>, alias='DefineHRUGroups', alias_priority=2, validate_default=False), 'deltares_fews_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DeltaresFEWSMode', alias_priority=2, validate_default=False), 'direct_evaporation': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DirectEvaporation', alias_priority=2, description='Rainfall is automatically reduced through evapotranspiration up to the limit of the calculated PET.', validate_default=False), 'dont_write_watershed_storage': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DontWriteWatershedStorage', alias_priority=2, description='Do not write watershed storage variables to disk.', validate_default=False), 'duration': FieldInfo(annotation=Union[float, NoneType], required=False, default_factory=<lambda>, alias='Duration', alias_priority=2, validate_default=False), 'end_date': FieldInfo(annotation=Union[date, datetime, datetime, NoneType], required=False, default_factory=<lambda>, alias='EndDate', alias_priority=2, validate_default=False), 'enkf_mode': FieldInfo(annotation=Union[EnKFMode, NoneType], required=False, default_factory=<lambda>, alias='EnKFMode', alias_priority=2, validate_default=False), 'ensemble_mode': FieldInfo(annotation=Union[EnsembleMode, NoneType], required=False, default_factory=<lambda>, alias='EnsembleMode', alias_priority=2, validate_default=False), 'evaluation_metrics': FieldInfo(annotation=Union[Sequence[ravenpy.config.options.EvaluationMetrics], NoneType], required=False, default_factory=<lambda>, alias='EvaluationMetrics', alias_priority=2, validate_default=False), 'evaluation_period': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.EvaluationPeriod], NoneType], required=False, default_factory=<lambda>, alias='EvaluationPeriod', alias_priority=2, validate_default=False), 'evaporation': FieldInfo(annotation=Union[Evaporation, NoneType], required=False, default_factory=<lambda>, alias='Evaporation', alias_priority=2, validate_default=False), 'extra_rvt_filename': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='ExtraRVTFilename', alias_priority=2, validate_default=False), 'forcing_perturbation': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ForcingPerturbation], NoneType], required=False, default_factory=<lambda>, alias='ForcingPerturbation', alias_priority=2, validate_default=False), 'forecast_rvt_filename': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='ForecastRVTFilename', alias_priority=2, validate_default=False), 'gauge': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.Gauge], NoneType], required=False, default_factory=<lambda>, alias='Gauge', alias_priority=2, validate_default=False), 'global_parameter': FieldInfo(annotation=Union[Dict[str, Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], NoneType], required=False, default={}, alias='GlobalParameter', alias_priority=2), 'gridded_forcing': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.GriddedForcing], NoneType], required=False, default_factory=<lambda>, alias='GriddedForcing', alias_priority=2, validate_default=False), 'hru_group': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.HRUGroup], NoneType], required=False, default_factory=<lambda>, alias='HRUGroup', alias_priority=2, validate_default=False), 'hru_state_variable_table': FieldInfo(annotation=Union[HRUStateVariableTable, NoneType], required=False, default_factory=<lambda>, alias='HRUStateVariableTable', alias_priority=2, validate_default=False), 'hrus': FieldInfo(annotation=Union[HRUs, NoneType], required=False, default_factory=<lambda>, alias='HRUs', alias_priority=2, validate_default=False), 'hydrologic_processes': FieldInfo(annotation=Union[Sequence[Union[ravenpy.config.commands.Process, ravenpy.config.processes.Conditional, ravenpy.config.processes.ProcessGroup]], NoneType], required=False, default_factory=<lambda>, alias='HydrologicProcesses', alias_priority=2, validate_default=False), 'lake_storage': FieldInfo(annotation=Union[Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'], NoneType], required=False, default_factory=<lambda>, alias='LakeStorage', alias_priority=2, validate_default=False), 'land_use_classes': FieldInfo(annotation=Union[LandUseClasses, NoneType], required=False, default_factory=<lambda>, alias='LandUseClasses', alias_priority=2, validate_default=False), 'land_use_parameter_list': FieldInfo(annotation=Union[LandUseParameterList, NoneType], required=False, default_factory=<lambda>, alias='LandUseParameterList', alias_priority=2, validate_default=False), 'lw_radiation_method': FieldInfo(annotation=Union[LWRadiationMethod, NoneType], required=False, default_factory=<lambda>, alias='LWRadiationMethod', alias_priority=2, validate_default=False), 'monthly_interpolation_method': FieldInfo(annotation=Union[MonthlyInterpolationMethod, NoneType], required=False, default_factory=<lambda>, alias='MonthlyInterpolationMethod', alias_priority=2, validate_default=False), 'netcdf_attribute': FieldInfo(annotation=Union[Dict[str, str], NoneType], required=False, default_factory=<lambda>, alias='NetCDFAttribute', alias_priority=2, validate_default=False), 'noisy_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='NoisyMode', alias_priority=2, validate_default=False), 'observation_data': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ObservationData], NoneType], required=False, default_factory=<lambda>, alias='ObservationData', alias_priority=2, validate_default=False), 'observation_error_model': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ObservationErrorModel], NoneType], required=False, default_factory=<lambda>, alias='ObservationErrorModel', alias_priority=2, validate_default=False), 'oro_pet_correct': FieldInfo(annotation=Union[OroPETCorrect, NoneType], required=False, default_factory=<lambda>, alias='OroPETCorrect', alias_priority=2, validate_default=False), 'oro_precip_correct': FieldInfo(annotation=Union[OroPrecipCorrect, NoneType], required=False, default_factory=<lambda>, alias='OroPrecipCorrect', alias_priority=2, validate_default=False), 'oro_temp_correct': FieldInfo(annotation=Union[OroTempCorrect, NoneType], required=False, default_factory=<lambda>, alias='OroTempCorrect', alias_priority=2, validate_default=False), 'output_directory_format': FieldInfo(annotation=Union[str, Path, NoneType], required=False, default_factory=<lambda>, alias='OutputDirectoryFormat', alias_priority=2, validate_default=False), 'ow_evaporation': FieldInfo(annotation=Union[Evaporation, NoneType], required=False, default_factory=<lambda>, alias='OW_Evaporation', alias_priority=2, validate_default=False), 'params': FieldInfo(annotation=Any, required=False), 'pavics_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='PavicsMode', alias_priority=2, validate_default=False), 'potential_melt_method': FieldInfo(annotation=Union[PotentialMeltMethod, NoneType], required=False, default_factory=<lambda>, alias='PotentialMeltMethod', alias_priority=2, validate_default=False), 'precip_icept_frac': FieldInfo(annotation=Union[PrecipIceptFract, NoneType], required=False, default_factory=<lambda>, alias='PrecipIceptFract', alias_priority=2, validate_default=False), 'rain_snow_fraction': FieldInfo(annotation=Union[RainSnowFraction, NoneType], required=False, default_factory=<lambda>, alias='RainSnowFraction', alias_priority=2, validate_default=False), 'rain_snow_transition': FieldInfo(annotation=Union[RainSnowTransition, NoneType], required=False, default_factory=<lambda>, alias='RainSnowTransition', alias_priority=2, validate_default=False), 'reservoirs': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.Reservoir], NoneType], required=False, default_factory=<lambda>, alias='Reservoirs', alias_priority=2, validate_default=False), 'routing': FieldInfo(annotation=Union[Routing, NoneType], required=False, default_factory=<lambda>, alias='Routing', alias_priority=2, validate_default=False), 'run_name': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='RunName', alias_priority=2, validate_default=False), 'sb_group_property_multiplier': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.SBGroupPropertyMultiplier], NoneType], required=False, default_factory=<lambda>, alias='SBGroupPropertyMultiplier', alias_priority=2, validate_default=False), 'seasonal_relative_height': FieldInfo(annotation=Union[SeasonalRelativeHeight, NoneType], required=False, default_factory=<lambda>, alias='SeasonalRelativeHeight', alias_priority=2, validate_default=False), 'seasonal_relative_lai': FieldInfo(annotation=Union[SeasonalRelativeLAI, NoneType], required=False, default_factory=<lambda>, alias='SeasonalRelativeLAI', alias_priority=2, validate_default=False), 'silent_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='SilentMode', alias_priority=2, validate_default=False), 'soil_classes': FieldInfo(annotation=Union[SoilClasses, NoneType], required=False, default_factory=<lambda>, alias='SoilClasses', alias_priority=2, validate_default=False), 'soil_model': FieldInfo(annotation=Union[SoilModel, NoneType], required=False, default_factory=<lambda>, alias='SoilModel', alias_priority=2, validate_default=False), 'soil_parameter_list': FieldInfo(annotation=Union[SoilParameterList, NoneType], required=False, default_factory=<lambda>, alias='SoilParameterList', alias_priority=2, validate_default=False), 'soil_profiles': FieldInfo(annotation=Union[SoilProfiles, NoneType], required=False, default_factory=<lambda>, alias='SoilProfiles', alias_priority=2, validate_default=False), 'solution_run_name': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='SolutionRunName', alias_priority=2, validate_default=False), 'start_date': FieldInfo(annotation=Union[date, datetime, datetime, NoneType], required=False, default_factory=<lambda>, alias='StartDate', alias_priority=2, validate_default=False), 'station_forcing': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.StationForcing], NoneType], required=False, default_factory=<lambda>, alias='StationForcing', alias_priority=2, validate_default=False), 'sub_basin_group': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.SubBasinGroup], NoneType], required=False, default_factory=<lambda>, alias='SubBasinGroup', alias_priority=2, validate_default=False), 'sub_basin_properties': FieldInfo(annotation=Union[SubBasinProperties, NoneType], required=False, default_factory=<lambda>, alias='SubBasinProperties', alias_priority=2, validate_default=False), 'sub_basins': FieldInfo(annotation=Union[SubBasins, NoneType], required=False, default_factory=<lambda>, alias='SubBasins', alias_priority=2, validate_default=False), 'subdaily_method': FieldInfo(annotation=Union[SubdailyMethod, NoneType], required=False, default_factory=<lambda>, alias='SubdailyMethod', alias_priority=2, validate_default=False), 'suppress_output': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='SuppressOutput', alias_priority=2, description='Write minimal output to disk when enabled.', validate_default=False), 'sw_canopy_correct': FieldInfo(annotation=Union[SWCanopyCorrect, NoneType], required=False, default_factory=<lambda>, alias='SWCanopyCorrect', alias_priority=2, validate_default=False), 'sw_cloud_correct': FieldInfo(annotation=Union[SWCloudCorrect, NoneType], required=False, default_factory=<lambda>, alias='SWCloudCorrect', alias_priority=2, validate_default=False), 'sw_radiation_method': FieldInfo(annotation=Union[SWRadiationMethod, NoneType], required=False, default_factory=<lambda>, alias='SWRadiationMethod', alias_priority=2, validate_default=False), 'temperature_correction': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='TemperatureCorrection', alias_priority=2, description='Gridded or gauged temperature bias correction.', validate_default=False), 'terrain_classes': FieldInfo(annotation=Union[TerrainClasses, NoneType], required=False, default_factory=<lambda>, alias='TerrainClasses', alias_priority=2, validate_default=False), 'time_step': FieldInfo(annotation=Union[float, str, NoneType], required=False, default_factory=<lambda>, alias='TimeStep', alias_priority=2, validate_default=False), 'truncate_hindcasts': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='TruncateHindcasts', alias_priority=2, validate_default=False), 'uniform_initial_conditions': FieldInfo(annotation=Union[Dict[str, Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], NoneType], required=False, default_factory=<lambda>, alias='UniformInitialConditions', alias_priority=2, validate_default=False), 'vegetation_classes': FieldInfo(annotation=Union[VegetationClasses, NoneType], required=False, default_factory=<lambda>, alias='VegetationClasses', alias_priority=2, validate_default=False), 'vegetation_parameter_list': FieldInfo(annotation=Union[VegetationParameterList, NoneType], required=False, default_factory=<lambda>, alias='VegetationParameterList', alias_priority=2, validate_default=False), 'window_size': FieldInfo(annotation=Union[int, NoneType], required=False, default_factory=<lambda>, alias='WindowSize', alias_priority=2, validate_default=False), 'windspeed_method': FieldInfo(annotation=Union[WindspeedMethod, NoneType], required=False, default_factory=<lambda>, alias='WindspeedMethod', alias_priority=2, validate_default=False), 'write_forcing_functions': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteForcingFunctions', alias_priority=2, description='Write watershed averaged forcing functions (e.g. rainfall, radiation, PET, etc).', validate_default=False), 'write_local_flows': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteLocalFlows', alias_priority=2, description='Write local contribution to hydrograph in hydrograph.csv', validate_default=False), 'write_netcdf_format': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteNetcdfFormat', alias_priority=2, validate_default=False), 'write_subbasin_file': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteSubbasinFile', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

monthly_interpolation_method: MonthlyInterpolationMethod | None
netcdf_attribute: Dict[str, str] | None
noisy_mode: bool | None
observation_data: Sequence[rc.ObservationData] | None
observation_error_model: Sequence[rc.ObservationErrorModel] | None
oro_pet_correct: OroPETCorrect | None
oro_precip_correct: OroPrecipCorrect | None
oro_temp_correct: OroTempCorrect | None
output_directory_format: str | Path | None
ow_evaporation: Evaporation | None
params: Any
pavics_mode: bool | None
potential_melt_method: PotentialMeltMethod | None
precip_icept_frac: PrecipIceptFract | None
rain_snow_fraction: RainSnowFraction | None
rain_snow_transition: rc.RainSnowTransition | None
reservoirs: Sequence[rc.Reservoir] | None
routing: Routing | None
run_name: str | None
property rvc
property rve
property rvh
property rvi
property rvp
property rvt
sb_group_property_multiplier: Sequence[rc.SBGroupPropertyMultiplier] | None
seasonal_relative_height: rc.SeasonalRelativeHeight | None
seasonal_relative_lai: rc.SeasonalRelativeLAI | None
set_params(params) Config[source]

Return a new instance of Config with params set to their numerical values.

set_solution(fn: Path, timestamp: bool = True) Config[source]

Return a new instance of Config with hru, basin states and start date set from an existing solution.

Parameters:
  • fn (Path) – Path to solution file.

  • timestamp (bool) – If False, ignore time stamp information in the solution. If True, the solution will set StartDate to the solution’s timestamp.

Returns:

Config with internal state set from the solution file.

Return type:

Config

silent_mode: bool | None
soil_classes: rc.SoilClasses | None
soil_model: SoilModel | None
soil_parameter_list: rc.SoilParameterList | None
soil_profiles: rc.SoilProfiles | None
solution_run_name: str | None
start_date: date | datetime | datetime | None
station_forcing: Sequence[rc.StationForcing] | None
sub_basin_group: Sequence[rc.SubBasinGroup] | None
sub_basin_properties: rc.SubBasinProperties | None
sub_basins: rc.SubBasins | None
subdaily_method: SubdailyMethod | None
suppress_output: bool | None
sw_canopy_correct: SWCanopyCorrect | None
sw_cloud_correct: SWCloudCorrect | None
sw_radiation_method: SWRadiationMethod | None
temperature_correction: bool | None
terrain_classes: rc.TerrainClasses | None
time_step: float | str | None
truncate_hindcasts: bool | None
uniform_initial_conditions: Dict[str, Sym] | None
vegetation_classes: rc.VegetationClasses | None
vegetation_parameter_list: rc.VegetationParameterList | None
window_size: int | None
windspeed_method: WindspeedMethod | None
write_forcing_functions: bool | None
write_local_flows: bool | None
write_netcdf_format: bool | None
write_rv(workdir: str | Path, modelname=None, overwrite=False, header=True)[source]

Write configuration files to disk.

Parameters:
  • workdir (str, Path) – A directory where rv files will be written to disk.

  • modelname (str) – File name stem for rv files. If not given, defaults to RunName if set, otherwise raven.

  • overwrite (bool) – If True, overwrite existing configuration files.

  • header (bool) – If True, write a header at the top of each RV file.

write_subbasin_file: bool | None
zip(workdir: str | Path, modelname=None, overwrite=False)[source]

Write configuration to zip file.

Parameters:
  • workdir (Path, str) – Path to zip archive storing RV files.

  • modelname (str) – File name stem for rv files. If not given, defaults to RunName if set, otherwise raven.

  • overwrite (bool) – If True, overwrite existing configuration zip file.

class ravenpy.config.rvs.RVC(*, HRUStateVariableTable: HRUStateVariableTable | None = None, BasinStateVariables: BasinStateVariables | None = None, UniformInitialConditions: Dict[str, Variable | Expression | float | None] | None = None)[source]
basin_state_variables: BasinStateVariables | None
hru_state_variable_table: HRUStateVariableTable | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'basin_state_variables': FieldInfo(annotation=Union[BasinStateVariables, NoneType], required=False, default_factory=<lambda>, alias='BasinStateVariables', alias_priority=2, validate_default=False), 'hru_state_variable_table': FieldInfo(annotation=Union[HRUStateVariableTable, NoneType], required=False, default_factory=<lambda>, alias='HRUStateVariableTable', alias_priority=2, validate_default=False), 'uniform_initial_conditions': FieldInfo(annotation=Union[Dict[str, Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], NoneType], required=False, default_factory=<lambda>, alias='UniformInitialConditions', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

uniform_initial_conditions: Dict[str, Variable | Expression | float | None] | None
class ravenpy.config.rvs.RVE(*, EnKFMode: EnKFMode | None = None, WindowSize: int | None = None, SolutionRunName: str | None = None, ExtraRVTFilename: str | None = None, OutputDirectoryFormat: str | Path | None = None, ForecastRVTFilename: str | None = None, TruncateHindcasts: bool | None = None, ForcingPerturbation: Sequence[ForcingPerturbation] | None = None, AssimilatedState: Sequence[AssimilatedState] | None = None, AssimilateStreamflow: Sequence[AssimilateStreamflow] | None = None, ObservationErrorModel: Sequence[ObservationErrorModel] | None = None)[source]
assimilate_streamflow: Sequence[AssimilateStreamflow] | None
assimilated_state: Sequence[AssimilatedState] | None
enkf_mode: EnKFMode | None
extra_rvt_filename: str | None
forcing_perturbation: Sequence[ForcingPerturbation] | None
forecast_rvt_filename: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'assimilate_streamflow': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.AssimilateStreamflow], NoneType], required=False, default_factory=<lambda>, alias='AssimilateStreamflow', alias_priority=2, validate_default=False), 'assimilated_state': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.AssimilatedState], NoneType], required=False, default_factory=<lambda>, alias='AssimilatedState', alias_priority=2, validate_default=False), 'enkf_mode': FieldInfo(annotation=Union[EnKFMode, NoneType], required=False, default_factory=<lambda>, alias='EnKFMode', alias_priority=2, validate_default=False), 'extra_rvt_filename': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='ExtraRVTFilename', alias_priority=2, validate_default=False), 'forcing_perturbation': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ForcingPerturbation], NoneType], required=False, default_factory=<lambda>, alias='ForcingPerturbation', alias_priority=2, validate_default=False), 'forecast_rvt_filename': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='ForecastRVTFilename', alias_priority=2, validate_default=False), 'observation_error_model': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ObservationErrorModel], NoneType], required=False, default_factory=<lambda>, alias='ObservationErrorModel', alias_priority=2, validate_default=False), 'output_directory_format': FieldInfo(annotation=Union[str, Path, NoneType], required=False, default_factory=<lambda>, alias='OutputDirectoryFormat', alias_priority=2, validate_default=False), 'solution_run_name': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='SolutionRunName', alias_priority=2, validate_default=False), 'truncate_hindcasts': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='TruncateHindcasts', alias_priority=2, validate_default=False), 'window_size': FieldInfo(annotation=Union[int, NoneType], required=False, default_factory=<lambda>, alias='WindowSize', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

observation_error_model: Sequence[ObservationErrorModel] | None
output_directory_format: str | Path | None
solution_run_name: str | None
truncate_hindcasts: bool | None
window_size: int | None
class ravenpy.config.rvs.RVH(*, SubBasins: SubBasins | None = None, SubBasinGroup: Sequence[SubBasinGroup] | None = None, SubBasinProperties: SubBasinProperties | None = None, SBGroupPropertyMultiplier: Sequence[SBGroupPropertyMultiplier] | None = None, HRUs: HRUs | None = None, HRUGroup: Sequence[HRUGroup] | None = None, Reservoirs: Sequence[Reservoir] | None = None)[source]
hru_group: Sequence[HRUGroup] | None
hrus: HRUs | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'hru_group': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.HRUGroup], NoneType], required=False, default_factory=<lambda>, alias='HRUGroup', alias_priority=2, validate_default=False), 'hrus': FieldInfo(annotation=Union[HRUs, NoneType], required=False, default_factory=<lambda>, alias='HRUs', alias_priority=2, validate_default=False), 'reservoirs': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.Reservoir], NoneType], required=False, default_factory=<lambda>, alias='Reservoirs', alias_priority=2, validate_default=False), 'sb_group_property_multiplier': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.SBGroupPropertyMultiplier], NoneType], required=False, default_factory=<lambda>, alias='SBGroupPropertyMultiplier', alias_priority=2, validate_default=False), 'sub_basin_group': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.SubBasinGroup], NoneType], required=False, default_factory=<lambda>, alias='SubBasinGroup', alias_priority=2, validate_default=False), 'sub_basin_properties': FieldInfo(annotation=Union[SubBasinProperties, NoneType], required=False, default_factory=<lambda>, alias='SubBasinProperties', alias_priority=2, validate_default=False), 'sub_basins': FieldInfo(annotation=Union[SubBasins, NoneType], required=False, default_factory=<lambda>, alias='SubBasins', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

reservoirs: Sequence[Reservoir] | None
sb_group_property_multiplier: Sequence[SBGroupPropertyMultiplier] | None
sub_basin_group: Sequence[SubBasinGroup] | None
sub_basin_properties: SubBasinProperties | None
sub_basins: SubBasins | None
class ravenpy.config.rvs.RVI(*, SilentMode: bool | None = None, NoisyMode: bool | None = None, RunName: str | None = None, Calendar: Calendar | None = None, StartDate: date | datetime | datetime | None = None, AssimilationStartTime: date | datetime | datetime | None = None, EndDate: date | datetime | datetime | None = None, Duration: float | None = None, TimeStep: float | str | None = None, Routing: Routing | None = None, CatchmentRoute: CatchmentRoute | None = None, Evaporation: Evaporation | None = None, OW_Evaporation: Evaporation | None = None, SWRadiationMethod: SWRadiationMethod | None = None, SWCloudCorrect: SWCloudCorrect | None = None, SWCanopyCorrect: SWCanopyCorrect | None = None, LWRadiationMethod: LWRadiationMethod | None = None, WindspeedMethod: WindspeedMethod | None = None, RainSnowFraction: RainSnowFraction | None = None, PotentialMeltMethod: PotentialMeltMethod | None = None, OroTempCorrect: OroTempCorrect | None = None, OroPrecipCorrect: OroPrecipCorrect | None = None, OroPETCorrect: OroPETCorrect | None = None, CloudCoverMethod: CloudCoverMethod | None = None, PrecipIceptFract: PrecipIceptFract | None = None, SubdailyMethod: SubdailyMethod | None = None, MonthlyInterpolationMethod: MonthlyInterpolationMethod | None = None, SoilModel: SoilModel | None = None, TemperatureCorrection: bool | None = None, LakeStorage: Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'] | None = None, DefineHRUGroups: Sequence[str] | None = None, HydrologicProcesses: Sequence[Process | Conditional | ProcessGroup] | None = None, EvaluationMetrics: Sequence[EvaluationMetrics] | None = None, EvaluationPeriod: Sequence[EvaluationPeriod] | None = None, EnsembleMode: EnsembleMode | None = None, WriteNetcdfFormat: bool | None = None, NetCDFAttribute: Dict[str, str] | None = None, CustomOutput: Sequence[CustomOutput] | None = None, DirectEvaporation: bool | None = None, DeltaresFEWSMode: bool | None = None, DebugMode: bool | None = None, DontWriteWatershedStorage: bool | None = None, PavicsMode: bool | None = None, SuppressOutput: bool | None = None, WriteForcingFunctions: bool | None = None, WriteSubbasinFile: bool | None = None, WriteLocalFlows: bool | None = None)[source]
assimilation_start_time: date | datetime | datetime | None
calendar: Calendar | None
catchment_route: CatchmentRoute | None
cloud_cover_method: CloudCoverMethod | None
custom_output: Sequence[CustomOutput] | None
classmethod dates2cf(v, info)[source]

Convert dates to cftime dates.

debug_mode: bool | None
define_hru_groups: Sequence[str] | None
deltares_fews_mode: bool | None
direct_evaporation: bool | None
dont_write_watershed_storage: bool | None
duration: float | None
end_date: date | datetime | datetime | None
ensemble_mode: EnsembleMode | None
evaluation_metrics: Sequence[EvaluationMetrics] | None
evaluation_period: Sequence[EvaluationPeriod] | None
evaporation: Evaporation | None
hydrologic_processes: Sequence[Process | Conditional | ProcessGroup] | None
classmethod init_soil_model(v)[source]
lake_storage: Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'] | None
lw_radiation_method: LWRadiationMethod | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'assimilation_start_time': FieldInfo(annotation=Union[date, datetime, datetime, NoneType], required=False, default_factory=<lambda>, alias='AssimilationStartTime', alias_priority=2, validate_default=False), 'calendar': FieldInfo(annotation=Union[Calendar, NoneType], required=False, default_factory=<lambda>, alias='Calendar', alias_priority=2, validate_default=False), 'catchment_route': FieldInfo(annotation=Union[CatchmentRoute, NoneType], required=False, default_factory=<lambda>, alias='CatchmentRoute', alias_priority=2, validate_default=False), 'cloud_cover_method': FieldInfo(annotation=Union[CloudCoverMethod, NoneType], required=False, default_factory=<lambda>, alias='CloudCoverMethod', alias_priority=2, validate_default=False), 'custom_output': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.CustomOutput], NoneType], required=False, default_factory=<lambda>, alias='CustomOutput', alias_priority=2, validate_default=False), 'debug_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DebugMode', alias_priority=2, validate_default=False), 'define_hru_groups': FieldInfo(annotation=Union[Sequence[str], NoneType], required=False, default_factory=<lambda>, alias='DefineHRUGroups', alias_priority=2, validate_default=False), 'deltares_fews_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DeltaresFEWSMode', alias_priority=2, validate_default=False), 'direct_evaporation': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DirectEvaporation', alias_priority=2, description='Rainfall is automatically reduced through evapotranspiration up to the limit of the calculated PET.', validate_default=False), 'dont_write_watershed_storage': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='DontWriteWatershedStorage', alias_priority=2, description='Do not write watershed storage variables to disk.', validate_default=False), 'duration': FieldInfo(annotation=Union[float, NoneType], required=False, default_factory=<lambda>, alias='Duration', alias_priority=2, validate_default=False), 'end_date': FieldInfo(annotation=Union[date, datetime, datetime, NoneType], required=False, default_factory=<lambda>, alias='EndDate', alias_priority=2, validate_default=False), 'ensemble_mode': FieldInfo(annotation=Union[EnsembleMode, NoneType], required=False, default_factory=<lambda>, alias='EnsembleMode', alias_priority=2, validate_default=False), 'evaluation_metrics': FieldInfo(annotation=Union[Sequence[ravenpy.config.options.EvaluationMetrics], NoneType], required=False, default_factory=<lambda>, alias='EvaluationMetrics', alias_priority=2, validate_default=False), 'evaluation_period': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.EvaluationPeriod], NoneType], required=False, default_factory=<lambda>, alias='EvaluationPeriod', alias_priority=2, validate_default=False), 'evaporation': FieldInfo(annotation=Union[Evaporation, NoneType], required=False, default_factory=<lambda>, alias='Evaporation', alias_priority=2, validate_default=False), 'hydrologic_processes': FieldInfo(annotation=Union[Sequence[Union[ravenpy.config.commands.Process, ravenpy.config.processes.Conditional, ravenpy.config.processes.ProcessGroup]], NoneType], required=False, default_factory=<lambda>, alias='HydrologicProcesses', alias_priority=2, validate_default=False), 'lake_storage': FieldInfo(annotation=Union[Literal['SURFACE_WATER', 'ATMOSPHERE', 'ATMOS_PRECIP', 'PONDED_WATER', 'SOIL', 'SOIL[0]', 'SOIL[1]', 'SOIL[2]', 'GROUNDWATER', 'CANOPY', 'CANOPY_SNOW', 'TRUNK', 'ROOT', 'DEPRESSION', 'WETLAND', 'LAKE_STORAGE', 'SNOW', 'SNOW_LIQ', 'GLACIER', 'GLACIER_ICE', 'CONVOLUTION', 'CONV_STOR', 'SURFACE_WATER_TEMP', 'SNOW_TEMP', 'COLD_CONTENT', 'GLACIER_CC', 'SOIL_TEMP', 'CANOPY_TEMP', 'SNOW_DEPTH', 'PERMAFROST_DEPTH', 'SNOW_COVER', 'SNOW_AGE', 'SNOW_ALBEDO', 'CROP_HEAT_UNITS', 'CUM_INFIL', 'CUM_SNOWMELT', 'CONSTITUENT', 'CONSTITUENT_SRC', 'CONSTITUENT_SW', 'CONSTITUENT_SINK', 'MULTIPLE'], NoneType], required=False, default_factory=<lambda>, alias='LakeStorage', alias_priority=2, validate_default=False), 'lw_radiation_method': FieldInfo(annotation=Union[LWRadiationMethod, NoneType], required=False, default_factory=<lambda>, alias='LWRadiationMethod', alias_priority=2, validate_default=False), 'monthly_interpolation_method': FieldInfo(annotation=Union[MonthlyInterpolationMethod, NoneType], required=False, default_factory=<lambda>, alias='MonthlyInterpolationMethod', alias_priority=2, validate_default=False), 'netcdf_attribute': FieldInfo(annotation=Union[Dict[str, str], NoneType], required=False, default_factory=<lambda>, alias='NetCDFAttribute', alias_priority=2, validate_default=False), 'noisy_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='NoisyMode', alias_priority=2, validate_default=False), 'oro_pet_correct': FieldInfo(annotation=Union[OroPETCorrect, NoneType], required=False, default_factory=<lambda>, alias='OroPETCorrect', alias_priority=2, validate_default=False), 'oro_precip_correct': FieldInfo(annotation=Union[OroPrecipCorrect, NoneType], required=False, default_factory=<lambda>, alias='OroPrecipCorrect', alias_priority=2, validate_default=False), 'oro_temp_correct': FieldInfo(annotation=Union[OroTempCorrect, NoneType], required=False, default_factory=<lambda>, alias='OroTempCorrect', alias_priority=2, validate_default=False), 'ow_evaporation': FieldInfo(annotation=Union[Evaporation, NoneType], required=False, default_factory=<lambda>, alias='OW_Evaporation', alias_priority=2, validate_default=False), 'pavics_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='PavicsMode', alias_priority=2, validate_default=False), 'potential_melt_method': FieldInfo(annotation=Union[PotentialMeltMethod, NoneType], required=False, default_factory=<lambda>, alias='PotentialMeltMethod', alias_priority=2, validate_default=False), 'precip_icept_frac': FieldInfo(annotation=Union[PrecipIceptFract, NoneType], required=False, default_factory=<lambda>, alias='PrecipIceptFract', alias_priority=2, validate_default=False), 'rain_snow_fraction': FieldInfo(annotation=Union[RainSnowFraction, NoneType], required=False, default_factory=<lambda>, alias='RainSnowFraction', alias_priority=2, validate_default=False), 'routing': FieldInfo(annotation=Union[Routing, NoneType], required=False, default_factory=<lambda>, alias='Routing', alias_priority=2, validate_default=False), 'run_name': FieldInfo(annotation=Union[str, NoneType], required=False, default_factory=<lambda>, alias='RunName', alias_priority=2, validate_default=False), 'silent_mode': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='SilentMode', alias_priority=2, validate_default=False), 'soil_model': FieldInfo(annotation=Union[SoilModel, NoneType], required=False, default_factory=<lambda>, alias='SoilModel', alias_priority=2, validate_default=False), 'start_date': FieldInfo(annotation=Union[date, datetime, datetime, NoneType], required=False, default_factory=<lambda>, alias='StartDate', alias_priority=2, validate_default=False), 'subdaily_method': FieldInfo(annotation=Union[SubdailyMethod, NoneType], required=False, default_factory=<lambda>, alias='SubdailyMethod', alias_priority=2, validate_default=False), 'suppress_output': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='SuppressOutput', alias_priority=2, description='Write minimal output to disk when enabled.', validate_default=False), 'sw_canopy_correct': FieldInfo(annotation=Union[SWCanopyCorrect, NoneType], required=False, default_factory=<lambda>, alias='SWCanopyCorrect', alias_priority=2, validate_default=False), 'sw_cloud_correct': FieldInfo(annotation=Union[SWCloudCorrect, NoneType], required=False, default_factory=<lambda>, alias='SWCloudCorrect', alias_priority=2, validate_default=False), 'sw_radiation_method': FieldInfo(annotation=Union[SWRadiationMethod, NoneType], required=False, default_factory=<lambda>, alias='SWRadiationMethod', alias_priority=2, validate_default=False), 'temperature_correction': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='TemperatureCorrection', alias_priority=2, description='Gridded or gauged temperature bias correction.', validate_default=False), 'time_step': FieldInfo(annotation=Union[float, str, NoneType], required=False, default_factory=<lambda>, alias='TimeStep', alias_priority=2, validate_default=False), 'windspeed_method': FieldInfo(annotation=Union[WindspeedMethod, NoneType], required=False, default_factory=<lambda>, alias='WindspeedMethod', alias_priority=2, validate_default=False), 'write_forcing_functions': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteForcingFunctions', alias_priority=2, description='Write watershed averaged forcing functions (e.g. rainfall, radiation, PET, etc).', validate_default=False), 'write_local_flows': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteLocalFlows', alias_priority=2, description='Write local contribution to hydrograph in hydrograph.csv', validate_default=False), 'write_netcdf_format': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteNetcdfFormat', alias_priority=2, validate_default=False), 'write_subbasin_file': FieldInfo(annotation=Union[bool, NoneType], required=False, default_factory=<lambda>, alias='WriteSubbasinFile', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

monthly_interpolation_method: MonthlyInterpolationMethod | None
netcdf_attribute: Dict[str, str] | None
noisy_mode: bool | None
oro_pet_correct: OroPETCorrect | None
oro_precip_correct: OroPrecipCorrect | None
oro_temp_correct: OroTempCorrect | None
ow_evaporation: Evaporation | None
pavics_mode: bool | None
potential_melt_method: PotentialMeltMethod | None
precip_icept_frac: PrecipIceptFract | None
rain_snow_fraction: RainSnowFraction | None
routing: Routing | None
run_name: str | None
silent_mode: bool | None
soil_model: SoilModel | None
start_date: date | datetime | datetime | None
subdaily_method: SubdailyMethod | None
suppress_output: bool | None
sw_canopy_correct: SWCanopyCorrect | None
sw_cloud_correct: SWCloudCorrect | None
sw_radiation_method: SWRadiationMethod | None
temperature_correction: bool | None
time_step: float | str | None
windspeed_method: WindspeedMethod | None
write_forcing_functions: bool | None
write_local_flows: bool | None
write_netcdf_format: bool | None
write_subbasin_file: bool | None
class ravenpy.config.rvs.RVP(*, params: Any = None, SoilClasses: SoilClasses | None = None, SoilProfiles: SoilProfiles | None = None, VegetationClasses: VegetationClasses | None = None, LandUseClasses: LandUseClasses | None = None, TerrainClasses: TerrainClasses | None = None, SoilParameterList: SoilParameterList | None = None, LandUseParameterList: LandUseParameterList | None = None, VegetationParameterList: VegetationParameterList | None = None, ChannelProfile: Sequence[ChannelProfile] | None = None, GlobalParameter: Dict[str, Variable | Expression | float | None] | None = {}, RainSnowTransition: RainSnowTransition | None = None, SeasonalRelativeLAI: SeasonalRelativeLAI | None = None, SeasonalRelativeHeight: SeasonalRelativeHeight | None = None)[source]
channel_profile: Sequence[ChannelProfile] | None
global_parameter: Dict[str, Variable | Expression | float | None] | None
land_use_classes: LandUseClasses | None
land_use_parameter_list: LandUseParameterList | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'channel_profile': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ChannelProfile], NoneType], required=False, default_factory=<lambda>, alias='ChannelProfile', alias_priority=2, validate_default=False), 'global_parameter': FieldInfo(annotation=Union[Dict[str, Union[pymbolic.primitives.Variable, pymbolic.primitives.Expression, float, NoneType]], NoneType], required=False, default={}, alias='GlobalParameter', alias_priority=2), 'land_use_classes': FieldInfo(annotation=Union[LandUseClasses, NoneType], required=False, default_factory=<lambda>, alias='LandUseClasses', alias_priority=2, validate_default=False), 'land_use_parameter_list': FieldInfo(annotation=Union[LandUseParameterList, NoneType], required=False, default_factory=<lambda>, alias='LandUseParameterList', alias_priority=2, validate_default=False), 'params': FieldInfo(annotation=Any, required=False), 'rain_snow_transition': FieldInfo(annotation=Union[RainSnowTransition, NoneType], required=False, default_factory=<lambda>, alias='RainSnowTransition', alias_priority=2, validate_default=False), 'seasonal_relative_height': FieldInfo(annotation=Union[SeasonalRelativeHeight, NoneType], required=False, default_factory=<lambda>, alias='SeasonalRelativeHeight', alias_priority=2, validate_default=False), 'seasonal_relative_lai': FieldInfo(annotation=Union[SeasonalRelativeLAI, NoneType], required=False, default_factory=<lambda>, alias='SeasonalRelativeLAI', alias_priority=2, validate_default=False), 'soil_classes': FieldInfo(annotation=Union[SoilClasses, NoneType], required=False, default_factory=<lambda>, alias='SoilClasses', alias_priority=2, validate_default=False), 'soil_parameter_list': FieldInfo(annotation=Union[SoilParameterList, NoneType], required=False, default_factory=<lambda>, alias='SoilParameterList', alias_priority=2, validate_default=False), 'soil_profiles': FieldInfo(annotation=Union[SoilProfiles, NoneType], required=False, default_factory=<lambda>, alias='SoilProfiles', alias_priority=2, validate_default=False), 'terrain_classes': FieldInfo(annotation=Union[TerrainClasses, NoneType], required=False, default_factory=<lambda>, alias='TerrainClasses', alias_priority=2, validate_default=False), 'vegetation_classes': FieldInfo(annotation=Union[VegetationClasses, NoneType], required=False, default_factory=<lambda>, alias='VegetationClasses', alias_priority=2, validate_default=False), 'vegetation_parameter_list': FieldInfo(annotation=Union[VegetationParameterList, NoneType], required=False, default_factory=<lambda>, alias='VegetationParameterList', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

params: Any
rain_snow_transition: RainSnowTransition | None
seasonal_relative_height: SeasonalRelativeHeight | None
seasonal_relative_lai: SeasonalRelativeLAI | None
soil_classes: SoilClasses | None
soil_parameter_list: SoilParameterList | None
soil_profiles: SoilProfiles | None
terrain_classes: TerrainClasses | None
vegetation_classes: VegetationClasses | None
vegetation_parameter_list: VegetationParameterList | None
class ravenpy.config.rvs.RVT(*, Gauge: Sequence[Gauge] | None = None, StationForcing: Sequence[StationForcing] | None = None, GriddedForcing: Sequence[GriddedForcing] | None = None, ObservationData: Sequence[ObservationData] | None = None)[source]
gauge: Sequence[Gauge] | None
gridded_forcing: Sequence[GriddedForcing] | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'gauge': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.Gauge], NoneType], required=False, default_factory=<lambda>, alias='Gauge', alias_priority=2, validate_default=False), 'gridded_forcing': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.GriddedForcing], NoneType], required=False, default_factory=<lambda>, alias='GriddedForcing', alias_priority=2, validate_default=False), 'observation_data': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.ObservationData], NoneType], required=False, default_factory=<lambda>, alias='ObservationData', alias_priority=2, validate_default=False), 'station_forcing': FieldInfo(annotation=Union[Sequence[ravenpy.config.commands.StationForcing], NoneType], required=False, default_factory=<lambda>, alias='StationForcing', alias_priority=2, validate_default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

observation_data: Sequence[ObservationData] | None
station_forcing: Sequence[StationForcing] | None
ravenpy.config.rvs.is_symbolic(params: dict) bool[source]

Return True if parameters include a symbolic variable.

Emulators

ravenpy.config.emulators.get_model(name)[source]

Return the corresponding Raven emulator configuration class.

Parameters:

name (str) – Model class name or model identifier.

Return type:

Raven model configuration class

Extractors

class ravenpy.extractors.routing_product.BasinMakerExtractor(df, hru_aspect_convention='GRASS', routing_product_version='2.1')[source]

This is a class to encapsulate the logic of converting the Routing Product into the required data structures to generate the RVH file format.

Parameters:
  • df (GeoDataFrame) – Sub-basin information.

  • hru_aspect_convention ({"GRASS", "ArcGIS"}) – How sub-basin aspect is defined.

  • routing_product_version ({"2.1", "1.0"}) – Version of the BasinMaker data.

HRU_ASPECT_CONVENTION = 'GRASS'
MANNING_DEFAULT = 0.035
MAX_RIVER_SLOPE = 1e-05
ROUTING_PRODUCT_VERSION = '2.1'
USE_LAKE_AS_GAUGE = False
USE_LAND_AS_GAUGE = False
USE_MANNING_COEFF = False
WEIR_COEFFICIENT = 0.6
extract(hru_from_sb: bool = False) dict[source]

Extract data from the Routing Product shapefile and return dictionaries that can be parsed into Raven Commands.

Parameters:

hru_from_sb (bool) – If True, draw HRU information from subbasin information. This is likely to yield crude results.

Returns:

“sub_basins”

Sequence of dictionaries with SubBasin attributes.

”sub_basin_group”

Sequence of dictionaries with SubBasinGroup attributes.

”reservoirs”

Sequence of dictionaries with Reservoir attributes.

”channel_profile”

Sequence of dictionaries with ChannelProfile attributes.

”hrus”

Sequence of dictionaries with HRU attributes.

Return type:

dict

class ravenpy.extractors.routing_product.GridWeightExtractor(input_file_path, routing_file_path, dim_names=('lon_dim', 'lat_dim'), var_names=('longitude', 'latitude'), routing_id_field='SubId', netcdf_input_field='NetCDF_col', gauge_ids=None, sub_ids=None, area_error_threshold=0.05)[source]

Class to extract grid weights.

Notes

The original version of this algorithm can be found at: https://github.com/julemai/GridWeightsGenerator

AREA_ERROR_THRESHOLD = 0.05
CRS_CAEA = 3573
CRS_LLDEG = 4326
DIM_NAMES = ('lon_dim', 'lat_dim')
NETCDF_INPUT_FIELD = 'NetCDF_col'
ROUTING_ID_FIELD = 'SubId'
VAR_NAMES = ('longitude', 'latitude')
extract() dict[source]

Return dictionary to create a GridWeights command.

ravenpy.extractors.routing_product.open_shapefile(path: str | PathLike)[source]

Return GeoDataFrame from shapefile path.

ravenpy.extractors.routing_product.upstream_from_coords(lon: float, lat: float, df: DataFrame | geopandas.GeoDataFrame) DataFrame | geopandas.GeoDataFrame[source]

Return the sub-basins located upstream from outlet.

Parameters:
  • lon (float) – Longitude of outlet.

  • lat (float) – Latitude of outlet.

  • df (pandas.DataFrame or geopandas.GeoDataFrame) – Routing product.

Returns:

Sub-basins located upstream from outlet.

Return type:

pandas.DataFrame or geopandas.GeoDataFrame

ravenpy.extractors.routing_product.upstream_from_id(fid: int, df: DataFrame | geopandas.GeoDataFrame) DataFrame | geopandas.GeoDataFrame[source]

Return upstream sub-basins by evaluating the downstream networks.

Parameters:
  • fid (int) – feature ID of the downstream feature of interest.

  • df (pandas.DataFrame or geopandas.GeoDataFrame) – A GeoDataframe comprising the watershed attributes.

Returns:

Basins ids including fid and its upstream contributors.

Return type:

pandas.DataFrame or geopandas.GeoDataFrame

ravenpy.extractors.forecasts.get_CASPAR_dataset(climate_model: str, date: datetime, thredds: str = 'https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/', directory: str = 'dodsC/birdhouse/disk2/caspar/daily/') Tuple[Dataset, List[DatetimeIndex | Series | Timestamp | Any]][source]

Return CASPAR dataset.

Parameters:
  • climate_model (str) – Type of climate model, for now only “GEPS” is supported.

  • date (dt.datetime) – The date of the forecast.

  • thredds (str) – The thredds server url. Default: “https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/

  • directory (str) – The directory on the thredds server where the data is stored. Default: “dodsC/birdhouse/disk2/caspar/daily/”

Returns:

The forecast dataset.

Return type:

xr.Dataset

ravenpy.extractors.forecasts.get_ECCC_dataset(climate_model: str, thredds: str = 'https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/', directory: str = 'dodsC/datasets/forecasts/eccc_geps/') Tuple[Dataset, List[DatetimeIndex | Series | Timestamp | Any]][source]

Return latest GEPS forecast dataset.

Parameters:
  • climate_model (str) – Type of climate model, for now only “GEPS” is supported.

  • thredds (str) – The thredds server url. Default: “https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/

  • directory (str) – The directory on the thredds server where the data is stored. Default: “dodsC/datasets/forecasts/eccc_geps/”

Returns:

The forecast dataset.

Return type:

xr.Dataset

ravenpy.extractors.forecasts.get_hindcast_day(region_coll: fiona.Collection, date, climate_model='GEPS')[source]

Generate a forecast dataset that can be used to run raven.

Data comes from the CASPAR archive and must be aggregated such that each file contains forecast data for a single day, but for all forecast timesteps and all members.

The code takes the region shapefile, the forecast date required, and the climate_model to use, here GEPS by default, but eventually could be GEPS, GDPS, REPS or RDPS.

ravenpy.extractors.forecasts.get_recent_ECCC_forecast(region_coll: fiona.Collection, climate_model: str = 'GEPS') Dataset[source]

Generate a forecast dataset that can be used to run raven.

Data comes from the ECCC datamart and collected daily. It is aggregated such that each file contains forecast data for a single day, but for all forecast timesteps and all members.

The code takes the region shapefile and the climate_model to use, here GEPS by default, but eventually could be GEPS, GDPS, REPS or RDPS.

Parameters:
  • region_coll (fiona.Collection) – The region vectors.

  • climate_model (str) – Type of climate model, for now only “GEPS” is supported.

Returns:

The forecast dataset.

Return type:

xr.Dataset

ravenpy.extractors.forecasts.get_subsetted_forecast(region_coll: fiona.Collection, ds: Dataset, times: datetime | DataArray, is_caspar: bool) Dataset[source]

Get Subsetted Forecast.

This function takes a dataset, a region and the time sampling array and returns the subsetted values for the given region and times.

Parameters:
  • region_coll (fiona.Collection) – The region vectors.

  • ds (xr.Dataset) – The dataset containing the raw, worldwide forecast data

  • times (dt.datetime or xr.DataArray) – The array of times required to do the forecast.

  • is_caspar (bool) – True if the data comes from Caspar, false otherwise. Used to define lat/lon on rotated grid.

Returns:

The forecast dataset.

Return type:

xr.Dataset

Utilities

Geospatial

Tools for reading and writing geospatial data formats.

ravenpy.utilities.io.address_append(address: str | Path) str[source]

Format a URL/URI to be more easily read with libraries such as “rasterstats”.

Parameters:

address (Union[str, Path]) – URL/URI to a potential zip or tar file

Returns:

URL/URI prefixed for archive type

Return type:

str

ravenpy.utilities.io.archive_sniffer(archives: str | Path | List[str | Path], working_dir: str | Path | None = None, extensions: Sequence[str] | None = None) List[str | Path][source]

Return a list of locally unarchived files that match the desired extensions.

Parameters:
  • archives (str or Path or list of str or Path) – Archive location or list of archive locations.

  • working_dir (str or Path, optional) – String or Path to a working location.

  • extensions (Sequence of str, optional) – List of accepted extensions.

Returns:

List of files with matching accepted extensions.

Return type:

list of str or Path

ravenpy.utilities.io.crs_sniffer(*args: str | Path | Sequence[str | Path]) List[str | int] | str | int[source]

Return the list of CRS found in files.

Parameters:

args (Union[str, Path, Sequence[Union[str, Path]]]) – Path(s) to the file(s) to examine.

Returns:

Returns either a list of CRSes or a single CRS definition, depending on the number of instances found.

Return type:

Union[List[str], str]

ravenpy.utilities.io.generic_extract_archive(resources: str | Path | List[bytes | str | Path], output_dir: str | Path | None = None) List[str][source]

Extract archives (tar/zip) to a working directory.

Parameters:
  • resources (str or Path or list of bytes or str or Path) – List of archive files (if netCDF files are in list, they are passed and returned as well in the return).

  • output_dir (str or Path, optional) – String or Path to a working location (default: temporary folder).

Returns:

List of original or of extracted files.

Return type:

list

ravenpy.utilities.io.get_bbox(vector: str | Path, all_features: bool = True) Tuple[float, float, float, float][source]

Return bounding box of all features or the first feature in file.

Parameters:
  • vector (str or Path) – A path to file storing vector features.

  • all_features (bool) – Return the bounding box for all features. Default: True.

Returns:

Geographic coordinates of the bounding box (lon0, lat0, lon1, lat1).

Return type:

float, float, float, float

ravenpy.utilities.io.is_within_directory(directory: str | PathLike, target: str | PathLike) bool[source]
ravenpy.utilities.io.raster_datatype_sniffer(file: str | Path) str[source]

Return the type of the raster stored in the file.

Parameters:

file (Union[str, Path]) – Path to file.

Returns:

rasterio datatype of array values

Return type:

str

ravenpy.utilities.io.safe_extract(tar: TarFile, path: str = '.', members=None, *, numeric_owner=False) None[source]

Tools for performing geospatial translations and transformations.

ravenpy.utilities.geo.determine_upstream_ids(fid: str, df: DataFrame | geopandas.GeoDataFrame, basin_field: str | None = None, downstream_field: str | None = None, basin_family: str | None = None) DataFrame | geopandas.GeoDataFrame[source]

Return a list of upstream features by evaluating the downstream networks.

Parameters:
  • fid (str) – feature ID of the downstream feature of interest.

  • df (pd.DataFrame) – A Dataframe comprising the watershed attributes.

  • basin_field (str) – The field used to determine the id of the basin according to hydro project.

  • downstream_field (str) – The field identifying the downstream sub-basin for the hydro project.

  • basin_family (str, optional) – Regional watershed code (For HydroBASINS dataset).

Returns:

Basins ids including fid and its upstream contributors.

Return type:

pd.DataFrame

ravenpy.utilities.geo.find_geometry_from_coord(lon: float, lat: float, df: geopandas.GeoDataFrame) geopandas.GeoDataFrame[source]

Return the geometry containing the given coordinates.

lonfloat

Longitude.

latfloat

Latitude.

dfGeoDataFrame

Data.

Returns:

Record whose geometry contains the point.

Return type:

GeoDataFrame

ravenpy.utilities.geo.generic_raster_clip(raster: str | Path, output: str | Path, geometry: shapely.geometry.Polygon | shapely.geometry.MultiPolygon | List[shapely.geometry.Polygon | shapely.geometry.MultiPolygon], touches: bool = False, fill_with_nodata: bool = True, padded: bool = True, raster_compression: str = 'lzw') None[source]

Crop a raster file to a given geometry.

Parameters:
  • raster (Union[str, Path]) – Path to input raster.

  • output (Union[str, Path]) – Path to output raster.

  • geometry (Union[Polygon, MultiPolygon, List[Union[Polygon, MultiPolygon]]) – Geometry defining the region to crop.

  • touches (bool) – Whether to include cells that intersect the geometry or not. Default: True.

  • fill_with_nodata (bool) – Whether to keep pixel values for regions outside of shape or set as nodata or not. Default: True.

  • padded (bool) – Whether to add a half-pixel buffer to shape before masking or not. Default: True.

  • raster_compression (str) – Level of data compression. Default: ‘lzw’.

Return type:

None

ravenpy.utilities.geo.generic_raster_warp(raster: str | Path, output: str | Path, target_crs: str | dict | pyproj.CRS, raster_compression: str = 'lzw') None[source]

Reproject a raster file.

Parameters:
  • raster (Union[str, Path]) – Path to input raster.

  • output (Union[str, Path]) – Path to output raster.

  • target_crs (str or dict) – Target projection identifier.

  • raster_compression (str) – Level of data compression. Default: ‘lzw’.

Return type:

None

ravenpy.utilities.geo.generic_vector_reproject(vector: str | Path, projected: str | Path, source_crs: str | pyproj.CRS = 4326, target_crs: str | pyproj.CRS | None = None) None[source]

Reproject all features and layers within a vector file and return a GeoJSON

Parameters:
  • vector (Union[str, Path]) – Path to a file containing a valid vector layer.

  • projected (Union[str, Path]) – Path to a file to be written.

  • source_crs (Union[str, pyproj.crs.CRS]) – CRS for the source geometry. Default: 4326.

  • target_crs (Union[str, pyproj.crs.CRS]) – CRS for the target geometry.

Return type:

None

ravenpy.utilities.geo.geom_transform(geom: shapely.geometry.GeometryCollection | shapely.geometry.shape, source_crs: str | int | pyproj.CRS = 4326, target_crs: str | int | pyproj.CRS | None = None) shapely.geometry.GeometryCollection[source]

Change the projection of a geometry.

Assuming a geometry’s coordinates are in a source_crs, compute the new coordinates under the target_crs.

Parameters:
  • geom (Union[GeometryCollection, shape]) – Source geometry.

  • source_crs (Union[str, int, CRS]) – Projection identifier (proj4) for the source geometry, e.g. ‘+proj=longlat +datum=WGS84 +no_defs’.

  • target_crs (Union[str, int, CRS]) – Projection identifier (proj4) for the target geometry.

Returns:

Reprojected geometry.

Return type:

GeometryCollection

GeoServer interaction operations.

Working assumptions for this module: * Point coordinates are passed as shapely.geometry.Point instances. * BBox coordinates are passed as (lon1, lat1, lon2, lat2). * Shapes (polygons) are passed as shapely.geometry.shape parsable objects. * All functions that require a CRS have a CRS argument with a default set to WGS84. * GEOSERVER_URL points to the GeoServer instance hosting all files. * For legacy reasons, we also accept the GEO_URL environment variable.

TODO: Refactor to remove functions that are just 2-lines of code. For example, many function’s logic essentially consists in creating the layer name. We could have a function that returns the layer name, and then other functions expect the layer name.

ravenpy.utilities.geoserver.filter_hydro_routing_attributes_wfs(attribute: str | None = None, value: str | float | int | None = None, level: int = 12, lakes: str = '1km', geoserver: str = 'https://pavics.ouranos.ca/geoserver/') str[source]

Return a URL that formats and returns a remote GetFeatures request from hydro routing dataset.

For geographic rasters, subsetting is based on WGS84 (Long, Lat) boundaries. If not geographic, subsetting based on projected coordinate system (Easting, Northing) boundaries.

Parameters:
  • attribute (list) – Attributes/fields to be queried.

  • value (str or int or float) – The requested value for the attribute.

  • level (int) – Level of granularity requested for the lakes vector (range(7,13)). Default: 12.

  • lakes ({"1km", "all"}) – Query the version of dataset with lakes under 1km in width removed (“1km”) or return all lakes (“all”).

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

URL to the GeoJSON-encoded WFS response.

Return type:

str

ravenpy.utilities.geoserver.filter_hydrobasins_attributes_wfs(attribute: str, value: str | float | int, domain: str, geoserver: str = 'https://pavics.ouranos.ca/geoserver/') str[source]

Return a URL that formats and returns a remote GetFeatures request from the USGS HydroBASINS dataset.

For geographic raster grids, subsetting is based on WGS84 (Long, Lat) boundaries. If not geographic, subsetting based on projected coordinate system (Easting, Northing) boundaries.

Parameters:
  • attribute (str) – Attribute/field to be queried.

  • value (str or float or int) – Value for attribute queried.

  • domain ({"na", "ar"}) – The domain of the HydroBASINS data.

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

URL to the GeoJSON-encoded WFS response.

Return type:

str

ravenpy.utilities.geoserver.get_hydro_routing_attributes_wfs(attribute: Sequence[str], level: int = 12, lakes: str = '1km', geoserver: str = 'https://pavics.ouranos.ca/geoserver/') str[source]

Return a URL that formats and returns a remote GetFeatures request from hydro routing dataset.

For geographic rasters, subsetting is based on WGS84 (Long, Lat) boundaries. If not geographic, subsetting based on projected coordinate system (Easting, Northing) boundaries.

Parameters:
  • attribute (list) – Attributes/fields to be queried.

  • level (int) – Level of granularity requested for the lakes vector (range(7,13)). Default: 12.

  • lakes ({"1km", "all"}) – Query the version of dataset with lakes under 1km in width removed (“1km”) or return all lakes (“all”).

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

URL to the GeoJSON-encoded WFS response.

Return type:

str

ravenpy.utilities.geoserver.get_hydro_routing_location_wfs(coordinates: Tuple[int | float | str, str | float | int], lakes: str, level: int = 12, geoserver: str = 'https://pavics.ouranos.ca/geoserver/') dict[source]

Return features from the hydro routing data set using bounding box coordinates.

For geographic rasters, subsetting is based on WGS84 (Long, Lat) boundaries. If not geographic, subsetting based on projected coordinate system (Easting, Northing) boundaries.

Parameters:
  • coordinates (Tuple[str or float or int, str or float or int]) – Geographic coordinates of the bounding box (left, down, right, up).

  • lakes ({"1km", "all"}) – Query the version of dataset with lakes under 1km in width removed (“1km”) or return all lakes (“all”).

  • level (int) – Level of granularity requested for the lakes vector (range(7,13)). Default: 12.

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

A GeoJSON-derived dictionary of vector features (FeatureCollection).

Return type:

dict

ravenpy.utilities.geoserver.get_hydrobasins_location_wfs(coordinates: Tuple[int | float | str, str | float | int], domain: str | None = None, geoserver: str = 'https://pavics.ouranos.ca/geoserver/') Dict[str, str | int | float][source]

Return features from the USGS HydroBASINS data set using bounding box coordinates.

For geographic raster grids, subsetting is based on WGS84 (Long, Lat) boundaries. If not geographic, subsetting based on projected coordinate system (Easting, Northing) boundaries.

Parameters:
  • coordinates (Tuple[str or float or int, str or float or int]) – Geographic coordinates of the bounding box (left, down, right, up).

  • domain ({"na", "ar"}) – The domain of the HydroBASINS data.

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

A GeoJSON-encoded vector feature.

Return type:

dict

ravenpy.utilities.geoserver.get_raster_wcs(coordinates: Iterable | Sequence[float | str], geographic: bool = True, layer: str | None = None, geoserver: str = 'https://pavics.ouranos.ca/geoserver/') bytes[source]

Return a subset of a raster image from the local GeoServer via WCS 2.0.1 protocol.

For geographic raster grids, subsetting is based on WGS84 (Long, Lat) boundaries. If not geographic, subsetting based on projected coordinate system (Easting, Northing) boundaries.

Parameters:
  • coordinates (Sequence of int or float or str) – Geographic coordinates of the bounding box (left, down, right, up)

  • geographic (bool) – If True, uses “Long” and “Lat” in WCS call. Otherwise, uses “E” and “N”.

  • layer (str) – Layer name of raster exposed on GeoServer instance, e.g. ‘public:CEC_NALCMS_LandUse_2010’

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

A GeoTIFF array.

Return type:

bytes

ravenpy.utilities.geoserver.hydro_routing_upstream(fid: str | float | int, level: int = 12, lakes: str = '1km', geoserver: str = 'https://pavics.ouranos.ca/geoserver/') Series[source]

Return a list of hydro routing features located upstream.

Parameters:
  • fid (str or float or int) – Basin feature ID code of the downstream feature.

  • level (int) – Level of granularity requested for the lakes vector (range(7,13)). Default: 12.

  • lakes ({"1km", "all"}) – Query the version of dataset with lakes under 1km in width removed (“1km”) or return all lakes (“all”).

  • geoserver (str) – The address of the geoserver housing the layer to be queried. Default: https://pavics.ouranos.ca/geoserver/.

Returns:

Basins ids including fid and its upstream contributors.

Return type:

pd.Series

ravenpy.utilities.geoserver.hydrobasins_aggregate(gdf: DataFrame) DataFrame[source]

Aggregate multiple HydroBASINS watersheds into a single geometry.

Parameters:

gdf (pd.DataFrame) – Watershed attributes indexed by HYBAS_ID

Return type:

pd.DataFrame

ravenpy.utilities.geoserver.hydrobasins_upstream(feature: dict, domain: str) DataFrame[source]

Return a list of HydroBASINS features located upstream.

Parameters:
  • feature (dict) – Basin feature attributes, including the fields [“HYBAS_ID”, “NEXT_DOWN”, “MAIN_BAS”].

  • domain ({"na", "ar"}) – Domain of the feature, North America or Arctic.

Returns:

Basins ids including fid and its upstream contributors.

Return type:

pd.Series

ravenpy.utilities.geoserver.select_hybas_domain(bbox: Tuple[int | float, int | float, int | float, int | float] | None = None, point: Tuple[int | float, int | float] | None = None) str[source]

Provided a given coordinate or boundary box, return the domain name of the geographic region the coordinate is located within.

Parameters:
  • bbox (Optional[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]) – Geographic coordinates of the bounding box (left, down, right, up).

  • point (Optional[Tuple[Union[float, int], Union[float, int]]]) – Geographic coordinates of an intersecting point (lon, lat).

Returns:

The domain that the coordinate falls within. Possible results: “na”, “ar”.

Return type:

str

Graphics

Library to perform graphs for the streamflow time series analysis.

The following graphs can be plotted:
  • hydrograph

  • mean_annual_hydrograph

  • spaghetti_annual_hydrograph

ravenpy.utilities.graphs.forecast(file: str | Path, fcst_var: str = 'q_sim') Figure[source]

Create a graphic of the hydrograph for each forecast member.

Parameters:
  • file (str or Path) – Raven output file containing simulated streamflows.

  • fcst_var (str) – Name of the streamflow variable.

Return type:

matplotlib.pyplot.Figure

ravenpy.utilities.graphs.hindcast(file: str | Path, fcst_var: str, qobs: str | Path, qobs_var: str) Figure[source]

Create a graphic of the hydrograph for each hindcast member.

Parameters:
  • file (str or Path) – Raven output file containing simulated streamflows.

  • fcst_var (str) – Name of the streamflow variable.

  • qobs (str or Path) – Streamflow observation file, with times matching the hindcast.

  • qobs_var (str) – Name of the streamflow observation variable.

Return type:

matplotlib.pyplot.Figure

ravenpy.utilities.graphs.hydrograph(file_list: Sequence[str | Path])[source]

Create a graphic of the hydrograph for each model simulation.

Parameters:

file_list (Sequence of str or Path) – Raven output files containing simulated streamflows.

ravenpy.utilities.graphs.mean_annual_hydrograph(file_list: Sequence[str | Path])[source]

Create a graphic of the mean hydrological cycle for each model simulation.

Parameters:

file_list (Sequence of str or Path) – Raven output files containing simulated streamflows.

ravenpy.utilities.graphs.spaghetti_annual_hydrograph(file: str | Path)[source]

Create a spaghetti plot of the mean hydrological cycle for one model simulations.

The mean simulation is also displayed.

Parameters:

file (str or Path) – Raven output files containing simulated streamflows of one model.

ravenpy.utilities.graphs.ts_fit_graph(ts: DataArray, params: DataArray) Figure[source]

Create graphic showing a histogram of the data and the distribution fitted to it.

The graphic contains one panel per watershed.

Parameters:
  • ts (xr.DataArray) – Stream flow time series with dimensions (time, nbasins).

  • params (xr.DataArray) – Fitted distribution parameters returned by xclim.land.fit indicator.

Returns:

Figure showing a histogram and the parameterized pdf.

Return type:

matplotlib.pyplot.Figure

ravenpy.utilities.graphs.ts_graphs(file, trend=True, alpha=0.05)[source]

Create a figure with the statistics so one can see a trend in the data.

Graphs for time series statistics.

Parameters:

file (str or Path) – xarray-compatible file containing streamflow statistics for one run.

Regionalization

Tools for hydrological regionalization.

ravenpy.utilities.regionalization.IDW(qsims: DataArray, dist: Series) DataArray[source]

Inverse distance weighting.

Parameters:
  • qsims (xr.DataArray) – Ensemble of hydrogram stacked along the members dimension.

  • dist (pd.Series) – Distance from catchment which generated each hydrogram to target catchment.

Returns:

Inverse distance weighted average of ensemble.

Return type:

xr.DataArray

ravenpy.utilities.regionalization.distance(gauged: DataFrame, ungauged: Series) Series[source]

Return geographic distance [km] between ungauged and database of gauged catchments.

Parameters:
  • gauged (pd.DataFrame) – Table containing columns for longitude and latitude of catchment’s centroid.

  • ungauged (pd.Series) – Coordinates of the ungauged catchment.

Return type:

pd.Series

ravenpy.utilities.regionalization.multiple_linear_regression(source: DataFrame, params: DataFrame, target: DataFrame) Tuple[List[Any], List[int]][source]

Multiple Linear Regression for model parameters over catchment properties.

Uses known catchment properties and model parameters to estimate model parameter over an ungauged catchment using its properties.

Parameters:
  • source (pd.DataFrame) – Properties of gauged catchments.

  • params (pd.DataFrame) – Model parameters of gauged catchments.

  • target (pd.DataFrame) – Properties of the ungauged catchment.

Returns:

A named tuple of the estimated model parameters and the R2 of the linear regression.

Return type:

list of Any, list of int

ravenpy.utilities.regionalization.read_gauged_params(model)[source]

Return table of NASH-Sutcliffe Efficiency values and model parameters for North American catchments.

Returns:

  • pd.DataFrame – Nash-Sutcliffe Efficiency keyed by catchment ID.

  • pd.DataFrame – Model parameters keyed by catchment ID.

ravenpy.utilities.regionalization.read_gauged_properties(properties) DataFrame[source]

Return table of gauged catchments properties over North America.

Returns:

Catchment properties keyed by catchment ID.

Return type:

pd.DataFrame

ravenpy.utilities.regionalization.regionalization_params(method: str, gauged_params: DataFrame, gauged_properties: DataFrame, ungauged_properties: DataFrame, filtered_params: DataFrame, filtered_prop: DataFrame) List[float][source]

Return the model parameters to use for the regionalization.

Parameters:
  • method ({'MLR', 'SP', 'PS', 'SP_IDW', 'PS_IDW', 'SP_IDW_RA', 'PS_IDW_RA'}) – Name of the regionalization method to use.

  • gauged_params (pd.DataFrame) – A DataFrame of parameters for donor catchments (size = number of donors)

  • gauged_properties (pd.DataFrame) – A DataFrame of properties of the donor catchments (size = number of donors)

  • ungauged_properties (pd.DataFrame) – A DataFrame of properties of the ungauged catchment (size = 1)

  • filtered_params (pd.DataFrame) – A DataFrame of parameters of all filtered catchments (size = all catchments with NSE > min_NSE)

  • filtered_prop (pd.DataFrame) – A DataFrame of properties of all filtered catchments (size = all catchments with NSE > min_NSE)

Returns:

List of model parameters to be used for the regionalization.

Return type:

list

ravenpy.utilities.regionalization.regionalize(config: Config, method: str, nash: Series, params: DataFrame | None = None, props: DataFrame | None = None, target_props: Series | dict | None = None, size: int = 5, min_NSE: float = 0.6, workdir: str | Path | None = None, overwrite: bool = False, **kwds) Tuple[DataArray, Dataset][source]

Perform regionalization for catchment whose outlet is defined by coordinates.

Parameters:
  • config (ravenpy.config.rvs.Config) – Symbolic emulator configuration. Only GR4JCN, HMETS and Mohyse are supported.

  • method ({'MLR', 'SP', 'PS', 'SP_IDW', 'PS_IDW', 'SP_IDW_RA', 'PS_IDW_RA'}) – Name of the regionalization method to use.

  • nash (pd.Series) – NSE values for the parameters of gauged catchments.

  • params (pd.DataFrame) – Model parameters of gauged catchments. Needed for all but MRL method.

  • props (pd.DataFrame) – Properties of gauged catchments to be analyzed for the regionalization. Needed for MLR and RA methods.

  • target_props (pd.Series or dict) – Properties of ungauged catchment. Needed for MLR and RA methods.

  • size (int) – Number of catchments to use in the regionalization.

  • min_NSE (float) – Minimum calibration NSE value required to be considered as a donor.

  • workdir (Union[str, Path]) – Work directory. If None, a temporary directory will be created.

  • overwrite (bool) – If True, existing files will be overwritten.

  • **kwds – Model configuration parameters, including the forcing files (ts).

Returns:

  • (qsim, ensemble)

  • qsim (DataArray (time, )) – Multi-donor averaged predicted streamflow.

  • ensemble (Dataset) –

    q_simDataArray (realization, time)

    Ensemble of members based on number of donors.

    parameterDataArray (realization, param)

    Parameters used to run the model.

ravenpy.utilities.regionalization.similarity(gauged: DataFrame, ungauged: DataFrame, kind: str = 'ptp') Series[source]

Return similarity measure between gauged and ungauged catchments.

Parameters:
  • gauged (pd.DataFrame) – Gauged catchment properties.

  • ungauged (pd.DataFrame) – Ungauged catchment properties

  • kind ({'ptp', 'std', 'iqr'}) – Normalization method: peak to peak (maximum - minimum), standard deviation, inter-quartile range.

Return type:

pd.Series