meshflow.utility.templating.render_hydrology_template
- meshflow.utility.templating.render_hydrology_template(routing_params={}, hydrology_params={}, default_params_path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/mesh-workflow/checkouts/latest/src/meshflow/templates/default_hydrology_parameters.json'), template_hydrology_path='MESH_parameters_hydrology.ini.jinja', parameters_ds=None, hru_dim='subbasin', gru_dim='NGRU', return_ds=False, *args, **kwargs)
Render a hydrology parameters INI template using Jinja2.
- Parameters:
routing_params (dict, optional) – Dictionary containing routing parameters for the template.
hydrology_params (dict, optional) – Dictionary containing hydrology parameters for the template.
default_params_path (PathLike, optional) – Path to the default hydrology parameters JSON file.
template_hydrology_path (PathLike, optional) – Path to the Jinja2 template for hydrology parameters.
parameters_ds (xarray.Dataset, optional) – An optional xarray.Dataset containing hydrology-specific parameters that may be needed for rendering the template. If not provided, it will be generated based on the routing parameters if necessary.
hru_dim (str, optional) – Name of the dimension representing HRUs (or subbasins) in the parameters dataset.
gru_dim (str, optional) – Name of the dimension representing GRUs in the parameters dataset.
return_ds (bool, optional) – Whether to return the xarray.Dataset containing hydrology-specific parameters along with the rendered template. If True, the function will return a tuple of (rendered_template, parameters_ds). If False, it will return only the rendered template.
- Returns:
str – Rendered hydrology template as a string.
xr.Dataset, optional – If return_ds is True, also return the xarray.Dataset containing hydrology-specific parameters.
- Raises:
FileNotFoundError – If any of the template or default files do not exist.
Exception – If a Jinja2 template error occurs.
- Return type: