hydromt_wflow.components.WflowOutputGridComponent#
Summary of Methods and Attributes#
Component class |
Methods |
Attributes |
|---|---|---|
|
|
- class WflowOutputGridComponent(model: Model, *, filename: str = 'output_grid.nc', region_component: str | None = None)[source]#
Bases:
GridComponentModelComponent class for Wflow netcdf_grid output.
This class is used for reading the Wflow netcdf_grid output.
The overall output netcdf_grid component data stored in the
dataproperty of this class is of the hydromt.gis.raster.RasterDataset type which is an extension of xarray.Dataset for regular grid.- read()[source]#
Read netcdf_grid model output at root/dir_output/filename.
Checks the path of the file in the config toml using both
output.netcdf_grid.pathanddir_output. If not found uses the default pathoutput_grid.ncin the root folder.- Parameters:
**kwargs (dict) – Additional keyword arguments to be passed to the read_nc method.
- write()[source]#
Skip writing output files.
Output files are model results and are therefore not written by HydroMT.
- set(data: DataArray | Dataset, name: str | None = None)[source]#
Add data to netcdf_grid output.
All layers in data must have identical spatial coordinates to existing staticmaps.
- Parameters:
data (xarray.DataArray or xarray.Dataset) – new map layer to add to netcdf_grid output
name (str, optional) – Name of new map layer, this is used to overwrite the name of a DataArray and ignored if data is a Dataset
- property bounds: Tuple[float, float, float, float] | None#
Returns the bounding box of the model grid.
- property data_catalog: DataCatalog#
Return the data catalog of the model this component is associated with.
- finish_write()#
Finish the write functionality after cleanup was called for all components in the model.
All DeferredFileClose objects can overwrite any lazy loaded files now.
- static get_mask_layer(mask: str | DataArray | None, *args) DataArray | None#
Get the proper mask layer based on itself or a layer in a Dataset.
- property model: Model#
Return the model object this component is associated with.
- property region: GeoDataFrame | None#
Provide access to the underlying GeoDataFrame data of the model region.
- property root: ModelRoot#
Return the root of the model this component is associated with.
- write_region(filename: str | None = None, *, to_wgs84: bool = False, to_file_kwargs: dict[str, Any] | None = None) None#
Write the model region to file.
The region is an auxiliary file that is often not required by the model, but can be useful for getting data from the data catalog. Plugin implementors may choose to write this file on write for a specific component.
- Parameters:
filename (str, optional) – The filename to write the region to. If None, the filename provided at initialization is used.
to_wgs84 (bool) – If True, the region is reprojected to WGS84 before writing.
to_file_kwargs (dict, optional) – Additional keyword arguments passed to the geopandas.GeoDataFrame.to_file function.