meshflow.utility.network.prepare_mesh_ddb
- meshflow.utility.network.prepare_mesh_ddb(riv, cat, landcover, cat_dim, gru_dim, hru_dim, gru_names, include_vars, attr_local, attr_global, min_values=None, fill_na=None, ordered_dims=None, ddb_units=None, ddb_to_units=None)[source]
Prepares the drainage database (ddb) for the MESH model.
This function applies a set of manipulations to river network and catchment geospatial data to construct the drainage database required by MESH.
- Parameters:
riv (str, list of str, or geopandas.GeoDataFrame) – Path(s) to ESRI Shapefile(s) or a GeoDataFrame containing river LineString(s).
cat (str, list of str, or geopandas.GeoDataFrame) – Path(s) to ESRI Shapefile(s) or a GeoDataFrame containing catchment Polygon(s) or MultiPolygon(s).
landcover (pandas.DataFrame) – DataFrame of land use class fractions (values between 0 and 1) for each catchment. Columns are land cover classes; rows are catchment elements.
cat_dim (str) – Name of the catchment dimension present in cat, riv, and landcover.
gru_dim (str) – Name of the landcover class dimension after processing landcover.
hru_dim (str) – Name of the hydrological response unit (HRU) dimension for output.
gru_names (Sequence of str) – List of landcover class names, ordered to match processed landcover.
include_vars (dict) – Dictionary mapping variable names in input data to output names in ddb.
attr_local (dict) – Dictionary mapping output variable names to their attribute dictionaries.
attr_global (dict) – Dictionary mapping global attribute names to their descriptions.
min_values (dict, optional) – Minimum values for variables in ddb. Keys must match output variable names.
fill_na (dict, optional) – Values to fill for NaNs in each variable of ddb. Keys are variable names.
ordered_dims (dict, optional) – Dictionary mapping dimension names to ordered values for sorting ddb.
ddb_units (dict, optional) – Dictionary mapping variable names to their units for quantification.
ddb_to_units (dict, optional) – Dictionary mapping variable names to target units for conversion.
- Returns:
ddb – Drainage database as an xarray.Dataset containing all required variables and attributes for MESH model setup.
- Return type: