-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update codes for unstructured grid (CESM-SE) #102
Conversation
@Duseong I am wondering if instead of checking for an
|
Also could you run the pre-commit hooks on your branch? https://pre-commit.com/#quick-start |
To me it would make more sense to set it as True in the |
Re: ds.attrs["unstructured_grid"] = True and then robustly check with ds.attrs.get("unstructured_grid", False) but what you did seems like it should work fine too. Do you have a preference? I guess with my method probably would want to use a more qualified name like |
Thanks a lot for your comments! Since I like what you suggested, I changed the way of checking unstructured grid, adding a xarray attribute instead of adding the monet attribute. |
Yeah it's kind of cool, if you add something to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are safe to merge this, as you have tested it to work for you and it shouldn't affect other parts of monet
Yes, what I tried was just using the dot, like ds.mio_has_unstructured_grid = True |
Yes I tested this code for both FV and SE grids, and it worked, so I think we are ready to merge this. |
Thanks for merging! It looks like I can't merge this. |
Yeah, it is limited to certain NOAA ARL people, but I am watching closely, so there shouldn't ever be a long wait. |
I updated the monet_accessor.py and combinetool.py
I ran the MELODIES-MONET for both CESM-FV and CESM-SE cases with these files, and it worked for both structured and unstructured grids, so I think it would be safe to be included, but let me know if there's any problem.
Most modifications are done in monet_accessor.py. I added several "if statements" to check whether the model output is structured ('lat' & 'lon') or unstructured ('ncol') grid.
I also added "remap_nearest_unstructured" function, to find the closest model grid to the observation point. Currently, it's calculated using the center longitude and latitude values but maybe I will need to update it to consider grid corner values.
A slight modification was made for combinetool.py, I again added an if statement to call different functions for unstructured grid output. So, most of modifications were adding if statements to separate structured and unstructured grid cases.