API reference#

DELWAQ model class#

Initialize#

DelwaqModel(root, mode, config_fn, ...[, logger])

Delwaq model class.

Setup methods#

DelwaqModel.setup_config(**cfdict)

Update config with a dictionary.

DelwaqModel.setup_basemaps(region[, mask, ...])

Prepare delwaq schematization using the hydromodel region and resolution.

DelwaqModel.setup_monitoring([mon_points, ...])

Prepare Delwaq monitoring points and areas options.

DelwaqModel.setup_hydrology_forcing(...[, ...])

Prepare Delwaq hydrological fluxes.

DelwaqModel.setup_sediment_forcing(...[, ...])

Prepare Delwaq sediment fluxes.

DelwaqModel.setup_climate_forcing(...[, ...])

Prepare Delwaq climate fluxes.

DelwaqModel.setup_emission_raster(emission_fn)

Prepare one or several emission map from raster data.

DelwaqModel.setup_emission_vector(emission_fn)

Prepare emission map from vector data.

DelwaqModel.setup_emission_mapping(region_fn)

Derive several emission maps based on administrative boundaries.

Attributes#

DelwaqModel.region

Returns the geometry of the model area of interest.

DelwaqModel.crs

Returns coordinate reference system embedded in the model grid.

DelwaqModel.res

Returns the resolution of the model grid.

DelwaqModel.root

Path to model folder.

DelwaqModel.config

Model configuration.

DelwaqModel.grid

Model static gridded data as xarray.Dataset.

DelwaqModel.geoms

Model geometries.

DelwaqModel.forcing

Model forcing.

DelwaqModel.basins

Derive basins from geoms or hydromaps.

DelwaqModel.hydromaps

xarray.dataset representation of all hydrology maps.

DelwaqModel.pointer

Dictionnary of schematisation attributes of a Delwaq model.

DelwaqModel.nrofseg

Fast accessor to nrofseg property of pointer.

DelwaqModel.nrofexch

Fast accessor to nrofexch property of pointer.

DelwaqModel.surface_water

Fast accessor to surface_water name property of pointer.

DelwaqModel.fluxes

Fast accessor to fluxes property of pointer.

High level methods#

DelwaqModel.read()

Read the complete model schematization and configuration from file.

DelwaqModel.write()

Write the complete model schematization and configuration to file.

DelwaqModel.build([region, write, opt])

Single method to build a model from scratch based on settings in opt.

DelwaqModel.update([model_out, write, opt, ...])

Single method to update a model based the settings in opt.

DelwaqModel.set_root(root[, mode])

Initialize the model root.

General methods#

DelwaqModel.setup_config(**cfdict)

Update config with a dictionary.

DelwaqModel.get_config(*args[, fallback, ...])

Get a config value at key(s).

DelwaqModel.set_config(*args)

Update the config dictionary at key(s) with values.

DelwaqModel.read_config([skip])

Read config files in ASCII format at <root/config>.

DelwaqModel.write_config()

Write config files in ASCII format at <root/config>.

DelwaqModel.set_grid(data[, name])

Add data to grid.

DelwaqModel.read_grid(**kwargs)

Read grid at <root/staticdata> and parse to xarray.

DelwaqModel.write_grid()

Write grid at <root/staticdata> in NetCDF and binary format.

DelwaqModel.set_geoms(geom, name)

Add data to the geoms attribute.

DelwaqModel.read_geoms()

Read and geoms at <root/geoms> and parse to geopandas.

DelwaqModel.write_geoms()

Write grid at <root/geoms> in model ready format.

DelwaqModel.set_forcing(data[, name, ...])

Add data to forcing attribute.

DelwaqModel.read_forcing()

Read and forcing at <root/?/> and parse to dict of xr.DataArray.

DelwaqModel.write_forcing([write_nc])

Write grid at <root/staticdata> in binary format.

DelwaqModel.set_hydromaps(data[, name])

Add data to hydromaps re-using the set_grid method.

DelwaqModel.read_hydromaps([crs])

Read hydromaps at <root/hydromodel> and parse to xarray.

DelwaqModel.write_hydromaps()

Write hydromaps at <root/hydromodel> in PCRaster maps format.

DelwaqModel.set_pointer(attr, name)

Add model attribute property to pointer.

DelwaqModel.read_pointer()

Read Delwaq pointer file.

DelwaqModel.write_waqgeom()

Write Delwaq netCDF geometry file (config/B3_waqgeom.nc).

D-Emission model class#

Initialize#

DemissionModel(root, mode, config_fn, ...[, ...])

Demission model class.

Setup methods#

DemissionModel.setup_config(**cfdict)

Update config with a dictionary.

DemissionModel.setup_basemaps(region[, maps])

Prepare demission schematization using the hydromodel region and resolution.

DemissionModel.setup_monitoring([...])

Prepare Delwaq monitoring points and areas options.

DemissionModel.setup_hydrology_forcing(...)

Prepare Demission hydrological fluxes.

DemissionModel.setup_climate_forcing(...[, ...])

Prepare Delwaq climate fluxes.

DemissionModel.setup_emission_raster(emission_fn)

Prepare one or several emission map from raster data.

DemissionModel.setup_emission_vector(emission_fn)

Prepare emission map from vector data.

DemissionModel.setup_emission_mapping(region_fn)

Derive several emission maps based on administrative boundaries.

DemissionModel.setup_roads(roads_fn, ...[, ...])

Prepare roads statistics needed for emission modelling.

Attributes#

DemissionModel.region

Returns the geometry of the model area of interest.

DemissionModel.crs

Returns coordinate reference system embedded in the model grid.

DemissionModel.res

Returns the resolution of the model grid.

DemissionModel.root

Path to model folder.

DemissionModel.config

Model configuration.

DemissionModel.grid

Model static gridded data as xarray.Dataset.

DemissionModel.geoms

Model geometries.

DemissionModel.forcing

Model forcing.

DemissionModel.basins

Derive basins from geoms or hydromaps.

DemissionModel.hydromaps

xarray.dataset representation of all hydrology maps.

DemissionModel.geometry

Pandas DataFrame containing the geometry of the EM compartment.

DemissionModel.nrofseg

Fast accessor to nrofseg property of pointer.

DemissionModel.nrofexch

Fast accessor to nrofexch property of pointer.

DemissionModel.fluxes

Fast accessor to fluxes property of pointer.

High level methods#

DemissionModel.read()

Read the complete model schematization and configuration from file.

DemissionModel.write()

Write the complete model schematization and configuration to file.

DemissionModel.build([region, write, opt])

Single method to build a model from scratch based on settings in opt.

DemissionModel.update([model_out, write, ...])

Single method to update a model based the settings in opt.

DemissionModel.set_root(root[, mode])

Initialize the model root.

General methods#

DemissionModel.setup_config(**cfdict)

Update config with a dictionary.

DemissionModel.get_config(*args[, fallback, ...])

Get a config value at key(s).

DemissionModel.set_config(*args)

Update the config dictionary at key(s) with values.

DemissionModel.read_config([skip])

Read config files in ASCII format at <root/config>.

DemissionModel.write_config()

Write config files in ASCII format at <root/config>.

DemissionModel.set_grid(data[, name])

Add data to grid.

DemissionModel.read_grid(**kwargs)

Read grid at <root/staticdata> and parse to xarray.

DemissionModel.write_grid()

Write grid at <root/staticdata> in NetCDF and binary format.

DemissionModel.set_geoms(geom, name)

Add data to the geoms attribute.

DemissionModel.read_geoms()

Read and geoms at <root/geoms> and parse to geopandas.

DemissionModel.write_geoms()

Write grid at <root/geoms> in model ready format.

DemissionModel.set_forcing(data[, name, ...])

Add data to forcing attribute.

DemissionModel.read_forcing()

Read and forcing at <root/?/> and parse to dict of xr.DataArray.

DemissionModel.write_forcing([write_nc])

Write forcing at <root/dynamicdata> in binary format.

DemissionModel.set_hydromaps(data[, name])

Add data to hydromaps re-using the set_grid method.

DemissionModel.read_hydromaps([crs])

Read hydromaps at <root/hydromodel> and parse to xarray.

DemissionModel.write_hydromaps()

Write hydromaps at <root/hydromodel> in PCRaster maps format.

DemissionModel.write_geometry()

Write geometry at <root/staticdata> in ASCII and binary format.

DemissionModel.write_waqgeom()

Write Delwaq netCDF geometry file (config/B3_waqgeom.nc).

DELWAQ workflows#

config#

workflows.config.base_config(nrofseg[, ...])

Prepare base config dictionnary.

workflows.config.time_config(starttime, ...)

Prepare time config dictionnary.

emissions#

workflows.emissions.emission_raster(da, ds_like)

Return emission map.

workflows.emissions.emission_vector(gdf, ds_like)

Return gridded emission data from vector.

workflows.emissions.admin(da, ds_like, ...)

Return administrative boundaries map and related parameter maps.

forcing#

workflows.forcing.hydrology_forcing(ds, ...)

Calculate hydrology forcing data.

workflows.forcing.hydrology_forcing_em(ds, ...)

Calculate hydrology forcing data for emission model.

workflows.forcing.sediment_forcing(ds, ...)

Calculate sediment forcing data.

workflows.forcing.climate_forcing(ds, ...[, ...])

Prepare Delwaq climate fluxes.

geometry#

workflows.geometry.compute_geometry(ds, mask)

Compute geometry data for demission.

roads#

workflows.roads.roads_emissions_country(...)

Compute roads statistics per country of interest.

workflows.roads.roads_emissions_segments(...)

Compute roads statistics per segment/grid cell.

segments#

workflows.segments.hydromaps(hydromodel[, mask])

Return base information maps from hydromodel.

workflows.segments.geometrymaps(hydromodel)

Return geometry information maps from hydromodel.

workflows.segments.pointer(ds_hydro[, ...])

Return map with Delwaq segment ID and pointer.