gridmarthe.create_ugrid
- gridmarthe.create_ugrid(ds, varname=None)[source]
Create mesh topology following UGRID netCDF convention
See https://ugrid-conventions.github.io/ugrid-conventions
- Parameters:
- dsxarray.Dataset
A Marthe Dataset as read by gridmarthe
- varnamestr, optional
variable to use in Dataset, by default None (the first non coordinate variable is picked)
- Returns:
- xr.Dataset
A Dataset with UGRID convention variable, e.g. node_x, node_y, face_node_connectivity, mesh_topology, and assiociated attributes
Notes
This transform allows for vizualization in QGIS as a meshed layer (powered by MDAL library). As of now, a bug is present with netcdf file writen by h5netcdf engine. See lutraconsulting/MDAL#520
When exporting your dataset, make sure to use the netcdf4 engine.
Examples
>>> import gridmarthe as gm >>> ds = gm.load_marthe_grid('./tests/data/hallue.permh') >>> uds = create_ugrid(ds) >>> uds.to_netcdf('hallue_ugrid.nc', engine='netcdf4')