hydromt_delwaq.DemissionModel#
- class hydromt_delwaq.DemissionModel(root: str | ~pathlib.Path = None, mode: str = 'w', config_fn: str | ~pathlib.Path = None, hydromodel_name: str = 'wflow', hydromodel_root: str | ~pathlib.Path = None, data_libs: ~typing.List[str | ~pathlib.Path] = None, logger=<Logger hydromt_delwaq.demission (WARNING)>)[source]#
Demission model class.
Initialize a model.
- Parameters:
root (str, optional) – Model root, by default None
mode ({'r','r+','w', 'w+'}, optional) – read/append/write mode, by default “w”
config_fn (str or Path, optional) – Model simulation configuration file, by default None. Note that this is not the HydroMT model setup configuration file!
hydromodel_name (str, optional) – Name of the hydromodel used to build the emission model. Only useful in update mode as this is taken from the
region
argument in setup_basemaps method. By default “wflow”.hydromodel_root (str or Path, optional) – Root of the hydromodel used to build the emission model. Only useful in update mode as this is taken from the
region
argument in setup_basemaps method. By default None.data_libs (List[str, Path], optional) – List of data catalog configuration files, by default None
logger – The logger to be used.
- __init__(root: str | ~pathlib.Path = None, mode: str = 'w', config_fn: str | ~pathlib.Path = None, hydromodel_name: str = 'wflow', hydromodel_root: str | ~pathlib.Path = None, data_libs: ~typing.List[str | ~pathlib.Path] = None, logger=<Logger hydromt_delwaq.demission (WARNING)>)[source]#
Initialize a model.
- Parameters:
root (str, optional) – Model root, by default None
mode ({'r','r+','w', 'w+'}, optional) – read/append/write mode, by default “w”
config_fn (str or Path, optional) – Model simulation configuration file, by default None. Note that this is not the HydroMT model setup configuration file!
hydromodel_name (str, optional) – Name of the hydromodel used to build the emission model. Only useful in update mode as this is taken from the
region
argument in setup_basemaps method. By default “wflow”.hydromodel_root (str or Path, optional) – Root of the hydromodel used to build the emission model. Only useful in update mode as this is taken from the
region
argument in setup_basemaps method. By default None.data_libs (List[str, Path], optional) – List of data catalog configuration files, by default None
logger – The logger to be used.
Methods
__init__
([root, mode, config_fn, ...])Initialize a model.
build
([region, write, opt])Single method to build a model from scratch based on settings in opt.
get_config
(*args[, fallback, abs_path])Get a config value at key(s).
get_tables_merged
()Return all tables of a model merged into one dataframe.
read
()Read the complete model schematization and configuration from file.
read_config
([skip])Read config files in ASCII format at <root/config>.
Read and forcing at <root/?/> and parse to dict of xr.DataArray.
read_geometry
()Read Delwaq EM geometry file.
Read and geoms at <root/geoms> and parse to geopandas.
read_grid
(**kwargs)Read grid at <root/staticdata> and parse to xarray.
read_hydromaps
([crs])Read hydromaps at <root/hydromodel> and parse to xarray.
read_maps
([fn])Read model map at <root>/<fn> and add to maps component.
read_nc
(fn[, mask_and_scale, ...])Read netcdf files at <root>/<fn> and return as dict of xarray.Dataset.
read_pointer
()Read Delwaq pointer file.
read_results
()Read results at <root/?/> and parse to dict of xr.DataArray.
read_states
()Read states at <root/?/> and parse to dict of xr.DataArray.
read_staticgeoms
()Read gemoetries from disk.
read_staticmaps
([fn])Read static model maps at <root>/<fn> and add to staticmaps property.
read_tables
([fn])Read table files at <root>/tables and parse to dict of dataframes.
set_config
(*args)Update the config dictionary at key(s) with values.
set_crs
(crs)Set coordinate reference system of the model grid.
set_forcing
(data[, name, split_dataset])Add data to forcing attribute.
set_geoms
(geom, name)Add data to the geoms attribute.
set_grid
(data[, name])Add data to grid.
set_hydromaps
(data[, name])Add data to hydromaps re-using the set_grid method.
set_maps
(data[, name, split_dataset])Add raster data to the maps component.
set_pointer
(attr, name)Add model attribute property to pointer.
set_results
(data[, name, split_dataset])Add data to results attribute.
set_root
(root[, mode])Initialize the model root.
set_states
(data[, name, split_dataset])Add data to states attribute.
set_staticgeoms
(geom, name)Set the geometries.
set_staticmaps
(data[, name])Add data to staticmaps.
set_tables
(tables[, name])Add (a) table(s) <pandas.DataFrame> to model.
setup_basemaps
(region[, maps])Prepare demission schematization using the hydromodel region and resolution.
setup_climate_forcing
(climate_fn, starttime, ...)Prepare Delwaq climate fluxes.
setup_config
(**cfdict)Update config with a dictionary.
setup_emission_mapping
(region_fn[, mapping_fn])Derive several emission maps based on administrative boundaries.
setup_emission_raster
(emission_fn[, ...])Prepare one or several emission map from raster data.
setup_emission_vector
(emission_fn[, ...])Prepare emission map from vector data.
setup_grid
(region[, res, crs, rotated, ...])HYDROMT CORE METHOD: Create a 2D regular grid or reads an existing grid.
setup_grid_from_constant
(constant, name[, ...])HYDROMT CORE METHOD: Adds a grid based on a constant value.
setup_grid_from_geodataframe
(vector_fn[, ...])HYDROMT CORE METHOD: Add data variable(s) to grid object by rasterizing the data from
vector_fn
.setup_grid_from_raster_reclass
(raster_fn, ...)HYDROMT CORE METHOD: Add data variable(s) to grid object by reclassifying the data in
raster_fn
based onreclass_table_fn
.setup_grid_from_rasterdataset
(raster_fn[, ...])HYDROMT CORE METHOD: Add data variable(s) from
raster_fn
to grid object.setup_hydrology_forcing
(hydro_forcing_fn, ...)Prepare Demission hydrological fluxes.
setup_maps_from_raster_reclass
(raster_fn, ...)HYDROMT CORE METHOD: Add data variable(s) to maps object by reclassifying the data in
raster_fn
based onreclass_table_fn
.setup_maps_from_rasterdataset
(raster_fn[, ...])HYDROMT CORE METHOD: Add data variable(s) from
raster_fn
to maps object.setup_monitoring
([mon_points, mon_areas])Prepare Delwaq monitoring points and areas options.
setup_region
(region[, hydrography_fn, ...])Set the region of interest of the model.
setup_roads
(roads_fn, highway_list, country_list)Prepare roads statistics needed for emission modelling.
setup_sediment_forcing
(sediment_fn, ...[, ...])Prepare Delwaq sediment fluxes.
test_model_api
()Test compliance with HydroMT Model API.
update
([model_out, write, opt, ...])Single method to update a model based the settings in opt.
write
()Write the complete model schematization and configuration to file.
Write config files in ASCII format at <root/config>.
write_data_catalog
([root, data_lib_fn, ...])Write the data catalog to data_lib_fn.
write_forcing
([write_nc])Write forcing at <root/dynamicdata> in binary format.
Write geometry at <root/staticdata> in ASCII and binary format.
Write grid at <root/geoms> in model ready format.
Write grid at <root/staticdata> in NetCDF and binary format.
Write hydromaps at <root/hydromodel> in PCRaster maps format.
write_maps
([fn])Write maps to netcdf file at <root>/<fn>.
write_monitoring
(monpoints, monareas)Write monitoring files and config in ASCII format.
write_nc
(nc_dict, fn[, gdal_compliant, ...])Write dictionnary of xarray.Dataset and/or xarray.DataArray to netcdf files.
write_pointer
()Write pointer at <root/dynamicdata> in ASCII and binary format.
write_results
()Write results at <root/?/> in model ready format.
write_states
()Write states at <root/?/> in model ready format.
write_staticgeoms
()Write the geometries to disk.
write_staticmaps
([fn])Write static model maps to netcdf file at <root>/<fn>.
write_tables
([fn])Write tables at <root>/tables.
Write Delwaq netCDF geometry file (config/B3_waqgeom.nc).
Attributes
api
Derive basins from geoms or hydromaps.
bounds
Returns the bounding box of the model grid.
Model configuration.
coords
Returns the coordinates of model staticmaps.
Returns coordinate reference system embedded in the model grid.
dims
Returns spatial dimension names of staticmaps.
Fast accessor to fluxes property of pointer.
Model forcing.
Pandas DataFrame containing the geometry of the EM compartment.
Model geometries.
Model static gridded data as xarray.Dataset.
height
Returns the height of the model staticmaps.
xarray.dataset representation of all hydrology maps.
maps
Model maps.
Fast accessor to nrofexch property of pointer.
Fast accessor to nrofseg property of pointer.
pointer
Dictionnary of schematisation attributes of a Delwaq model.
Returns the geometry of the model area of interest.
Returns the resolution of the model grid.
results
Model results.
Path to model folder.
shape
Returns the shape of the model staticmaps.
states
Model states.
staticgeoms
Access the geometryes.
staticmaps
Model static maps.
surface_water
Fast accessor to surface_water name property of pointer.
tables
Model tables.
transform
Returns spatial transform of the model grid.
width
Returns the width of the model staticmaps.