Deltares / hydromt

HydroMT: Automated and reproducible model building and analysis
https://deltares.github.io/hydromt/
MIT License
68 stars 28 forks source link

Support mesh in the data catalogs #417

Open alimeshgi opened 1 year ago

alimeshgi commented 1 year ago

Kind of request

Adding new functionality

Enhancement Description

Adding new MeshDataset adapter to read mesh data. Functionality would be rather similar to RasterDataset but using xugrid functionality rather than hydromt.raster to read, sel, set crs etc.

Use case

For now to create a mesh in setup_meh2d, one of the option is to read an existing mesh file. There I implemented a simple direct read. But I think for delft3d fm, it might be useful to be able to process its output data for other models, eg flood map to damage or water quality/ecology etc. (eg forcing data for habitat). Also for core we could then add for example a setup_grid_data_from_meshdataset using xugrid rasterize function or setup_vector_data_from_mesh.

Also some of the CMIP6 model or climate models are not defined on a regular grid. Maybe with meshdataset and xugrid we could finally support them?

DirkEilander commented 10 months ago

@hboisgon it would be good to discuss if we want this in Q4. If so can you provide more context to this issue / refine it, potentially together with someone who good actually do the work?

hboisgon commented 10 months ago

I refined and added use cases to the issue. In terms of Q4 or Q1 I am not sure. @veenstrajelmer or @xldeltares, any feedback?

veenstrajelmer commented 10 months ago

@hboisgon Good idea to include ugrid support via xugrid. However, it would be nice to align it with moving dfm_tools modelbuilder features to hydromt_delft3dfm. If that is done, I think this is quite ambitious for Q4.

I was also triggered by the CMIP6 models that are not on a regulargrid. I have encountered CMCC on a curvilinear global/period grid, which is quite inconvenient but it can be sort of read as a ugrid. I have created this function in dfm_tools which might be a good start: https://github.com/Deltares/dfm_tools/blob/29f9488fe9aba5993ea588fe3979bbc8eb6557b2/dfm_tools/xugrid_helpers.py#L236 Example script: https://github.com/Deltares/dfm_tools/blob/main/tests/examples_workinprogress/workinprogress_CMCC_plotting.py However, I think there are more applications that benefit from this, so we might want to include it in xugrid or another curvi package instead of hydromt.

hboisgon commented 9 months ago

@veenstrajelmer thanks for your input. Let's move this to Q1 next year then. I'd be interested to have a chat to see how we can best combine hydromt, xugrid and what you did in dfm_tools