Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mesh_2d_edge_x and mesh_2d_edge_y to writer #645

Merged
merged 3 commits into from
Jul 9, 2024

Conversation

DanielTollenaar
Copy link
Contributor

Improving UgridWriter and other to be able to read net-files as UGRID using MDAL (e.g. within QGIS).

Added:

  • Enhanced UgridWriter by adding mesh2d_edge_x and mesh2d_edge_y reading it from network._mesh2d (meshkernel.Mesh2d)

Copy link

sonarcloud bot commented Jun 3, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 8, 2024

@DanielTollenaar Is this still relevant? If so, why is the PR marked as a draft?

@veenstrajelmer veenstrajelmer linked an issue Jul 8, 2024 that may be closed by this pull request
@DanielTollenaar
Copy link
Contributor Author

@veenstrajelmer, For DHYDRO users I do think it is relevant for the reason mentioned in this draft (2D meshes cannot be read by MDAL due to incompleteness).

It's draft as I saw other imperfections (e.g. projection-info) I could add.

It's left as I assumed this repo isn't actively maintained by it's owners. As a user it doesn't make much sense to contribute if PR's aren't reviewed nor merged.

@veenstrajelmer
Copy link
Collaborator

Ok, good to know. The network part of the code is being refactored in several steps. Metadata like crs is also valuable indeed, but this also requires an awareness of crs in hydrolib-core. In the future, we will be looking into external packages like xugrid or ugridpy to outsource the netcdf writing toward. However, I think for the short term this PR is already a good addition and we will consider merging it today.

@veenstrajelmer veenstrajelmer marked this pull request as ready for review July 8, 2024 10:29
Copy link
Collaborator

@veenstrajelmer veenstrajelmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanielTollenaar the checks are failing, but we cannot rerun them on your fork-PR somehow. Also, we cannot commit to it, this would also kick off the checks again. A simple solution is to copy your edits to a new PR, but we would like to leave the credits with you. Also I have one request to minimize the diff. Would you have time to do this? Preferably today, but I can imagine that is a bit short notice. This is because we would like to release all recent improvements asap and this one is easy to include.

.gitignore Outdated Show resolved Hide resolved
@DanielTollenaar
Copy link
Contributor Author

Ok, good to know. The network part of the code is being refactored in several steps. Metadata like crs is also valuable indeed, but this also requires an awareness of crs in hydrolib-core. In the future, we will be looking into external packages like xugrid or ugridpy to outsource the netcdf writing toward. However, I think for the short term this PR is already a good addition and we will consider merging it today.

Agreed; refactoring seems absolutely necessary and I prefer the setup of XUGRID https://deltares.github.io/xugrid/ as it's more intuitive (build on xarray).

It may be good to have a look at this issue: Deltares/MeshKernel#326 and work-around it in the UGridWriter as long as it isn't fixed in MeshKernel. Now writing will cause a crash if you manipulate the mesh before.

@veenstrajelmer
Copy link
Collaborator

Thanks for pointing to Deltares/MeshKernel#326, I was unaware of it since I only monitor the meshkernelpy issues every now and then, the python API of meshkernel that you are using there. I can understand the difference is a bit arbitrary for externals. Either way, I commented the current status there and linked some related issues. This is indeed important to fix, but that will take a bit more time.

Copy link
Collaborator

@veenstrajelmer veenstrajelmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test is still failing. Could you update your branch with main? I expect that your changes should not cause the fm_container run to fail, but I also do not see the ci run being kicked off, so something seems broken. If updating your branch to main does not work, we will merge the changes in a parallel branch.

@DanielTollenaar
Copy link
Contributor Author

Test is still failing. Could you update your branch with main? I expect that your changes should not cause the fm_container run to fail, but I also do not see the ci run being kicked off, so something seems broken. If updating your branch to main does not work, we will merge the changes in a parallel branch.

Done, but the reason for failing suggests something with a missing username and password, doubt merging from upstream will fix that. Feel free to just copy-paste the code in a new branch in your repo. Don't care about credits ;-):

image

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 9, 2024

Yes, I noticed that also, but wanted to make sure it was not because of the branch being outdated. I think we have to look into PR's from forks in the future, since this seems to be the issue. All tests (both ci and fm_container) are green on other recent branches: https://github.com/Deltares/HYDROLIB-core/actions. We will discuss how to approach this. Thanks for the contribution either way!

@tim-vd-aardweg tim-vd-aardweg merged commit e8b5262 into Deltares:main Jul 9, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider enhancing UgridWriter
3 participants