Ribasim icon indicating copy to clipboard operation
Ribasim copied to clipboard

Always write UGRID (results) file

Open evetion opened this issue 8 months ago • 4 comments

Non ugrid follow up of #969.

Does it have to be non-UGRID? And why? Color and width rendering for flow works out of the box.

QGIS in combination with MDAL is the only data model that seemed to work align well; temporal vector data was very slow because it didn't index into a time axis; it was filtering over the entire table continuously (possibly on each pan/zoom action).

If it's a case of matching the geometry, this can still be done easily with UGRID, just repeat the flow values for all the "sub-edges" of the true link. It'll need some modification of the to_xugrid method (possibly a bool argument) -- it should probably default to using the detailed geometry if available.

Originally posted by @Huite in #2171

We can always write a UGRID netcdf from Python, and Julia could write the results to it? This would also make visualization easier.

EDIT: we now have #2497, which is NetCDF-CF, not UGRID.

evetion avatar Apr 01 '25 08:04 evetion

I'd prefer to just write the whole UGRID from Julia. Also for to_fews we are working towards Delft-FEWS being able to read our UGRID files. If the UGRID look good and load fast in QGIS out of the box that is also a good argument to do this.

There is the currently private https://github.com/Deltares-research/UGrid.jl that we made at the start of Ribasim. It would be a bit more work, but we could also consider writing it on top of e.g. https://github.com/gbaraldi/StaticHDF5.jl.

visr avatar Apr 01 '25 09:04 visr

Ok, so temporarily solution is QGIS (this week) and then work on UGrid in one of the next sprints?

evetion avatar Apr 01 '25 09:04 evetion

There is the currently private https://github.com/Deltares-research/UGrid.jl that we made at the start of Ribasim. It would be a bit more work, but we could also consider writing it on top of e.g. https://github.com/gbaraldi/StaticHDF5.jl.

Wouldn't you need the Julia equivalent of h5netcdf as well? It's probably mostly a one-to-one translation, but it's still about 2000 or 3000 lines.

(It's a nice and useful project: Python h5netcdf is sometimes faster, sometimes slower. In particular, h5netcdf is slower when there is a large amount of variables since it's running a slow Python loop -- a Julia h5netcdf is probably faster all the time!)

Huite avatar Apr 02 '25 09:04 Huite

Yeah something like h5netcdf would be great, though probably it would be less work to just call HDF5 APIs directly to make valid NetCDF for our use case only, as a start.

Note there is also the pure Julia https://github.com/JuliaIO/JLD2.jl which could potentially be used as well, and actually is already an indirect dependency.

visr avatar Apr 02 '25 10:04 visr