Repository navigation
MPAS Reader Updates & Additional Coordinate Attributes - #455
Conversation
|
@philipc2, it's possible that I'm just misusing #!/usr/bin/env python3
import uxarray as ux
mpas_dataset_filepath = "test/meshfiles/mpas/QU/oQU480.231010.nc"
uxds = ux.open_dataset(mpas_dataset_filepath, mpas_dataset_filepath,
use_dual=True)
gdf_grid = uxds.uxgrid.to_geodataframe()
gdf_lat = uxds['latVertex'].to_geodataframe()I see: I didn't follow the details of the code well enough to debug this but my assumption is that the first value is without the MPAS vertices that were removed by masking but the second value is after masking. |
|
There is another, far thornier issue that we should discuss. For both visualization and analysis purposes, removing the incomplete triangles is not really what we want when we work with quantities on the MPAS dual mesh. Instead, we want to break each triangle into 3 "kites" (diamond shapes) that are the intersections between the triangle and each neighboring cell. If a neighboring cell doesn't exist (because it is land), we want to drop that kite but keep the remaining ones. For analysis purposes, the areas of the 1 to 3 kites are the correct area for a dual cell. For visualization purposes, the we want to plot the 1 or 2 kites even when the triangle is incomplete. I don't know what the right way to handle this in |
|
Continuing with my last comment, an approach to generating dual-mesh cells for MPAS meshes that would combine the 1 to 3 kites I mentioned above is:
Here is a block of code I use to do this: This approach relies on allowing degenerate polygon vertices. If that is not allowed, the degenerate vertices would have to be masked or removed. If this discussion is way beyond the scope of this PR, I'm happy to move it to a discussion page. But since my approach would be an alternative that doesn't require masking, I thought I would bring it up here first. |
This is indeed due to the masking going on. I think I will move the fix for #359 and your points above into a separate PR. The masking solution that I implemented here seems does not seem to be the best approach, even if it is meant to just be a quick "patch" |
|
@philipc2 and all, by the way, I appreciated being asked to review this. It gave me an excuse to use |
Of course! I appreciate the review, especially from someone that has a much better understand of MPAS than me :) Speaking of visualization, we've been making a big push this iteration for visualuzation. If you're interested, we have a WIP notebook that showcases a few methods we are currently implemented on a few high-resolution MPAS datasets. https://github.com/NCAR/geocat-scratch/blob/ecmwf_conf/uxarray/ecmwf_conf/uxarray_ecmwf-conf.ipynb |
awesome! |
|
@philipc2 what are the other methods to fix the mesh apart from masking? Also, would the validate mesh PR+x be useful for handling such things? |
I'll make an issue for the other methods, especially the one method mentioned by @xylar I can see validate being used, but not 100% sure exactly how right now. |
|
@philipc2, could you let me know when this branch is in a state that you'd like me to re-review? |
Sure thing! I'll give you a ping this morning after I give it a quick look through. |
|
It should be good for a re-review now! |
|
@philipc2, great! I don't think I'll have time to re-review today but I'll put on my list for tomorrow. |
Thank you!! |
|
I didn't manage to get to this today. Hopefully tomorrow. |
No worries! |
xylar
left a comment
There was a problem hiding this comment.
This looks great! I was able to plot temperature on the primal grid as before. I was also able to plot both the primal and dual grids. But I was not able to plot a quantity on the dual grid using to_geodataframe(), as we have already noted (because of indices masked with invalid values).
I have a few mostly cosmetic suggestions but I think this is ready to go after that and I don't need to review it again.
Thank you so much for the review! I'm really glad to hear you were able to get those plots working :) We'll work on getting better support for the dual mesh with those "invalid" values. |
Closes #457, #456, #454
Overview
Grid Improvments
Mesh2_face_cart_x/y/zMesh2_edge_cart_x/y/zMesh2_edge_x/y/zMesh2_edge_node_distancesandMesh2_edge_face_distancesPR Checklist
General
Testing
Documentation
_) and have been added todocs/internal_api/index.rstdocs/user_api/index.rstExamples
docs/examples/folderdocs/examples.rsttoctreedocs/gallery.ymlwith appropriate thumbnail photo indocs/_static/thumbnails/