cf-xarray icon indicating copy to clipboard operation
cf-xarray copied to clipboard

sgrid helper utilities

Open dcherian opened this issue 3 years ago • 15 comments

Copied from #201 re: https://sgrid.github.io/sgrid/

I think there's an opportunity for better metadata handling around gridded, xgcm, sgrid, xesmf with cf_xarray providing a little helper function layer to consolidate the code.

It seems a common issue is figuring out cell metrics; and cell centers and corner points. This is needed by xgcm, maybe cmip6_preprocessing, and probably xesmf (definitely needed to specify xesmf inputs).

I think cf_xarray can provide a tiny sgrid module that helps autoguess some sgrid parameters and maybe parses the sgrid attributes and lets them be used in a convenient way. We can take inspiration from (and maybe copy over) https://noaa-orr-erd.github.io/gridded/gridded.pysgrid.html

I think a call some time in the next two weeks would be good to sort this out, and make a plan.

cc @aulemahal @mgrover1 @malmans2

dcherian avatar Apr 13 '21 23:04 dcherian

This is a great idea - can we try to set something up for next week?

mgrover1 avatar Apr 14 '21 01:04 mgrover1

I think a call some time in the next two weeks would be good to sort this out, and make a plan.

Good idea!

malmans2 avatar Apr 14 '21 09:04 malmans2

Interesting! I am available for a call in the next two weeks.

aulemahal avatar Apr 14 '21 13:04 aulemahal

What day works well for people this week?

mgrover1 avatar Apr 19 '21 16:04 mgrover1

Thursday/Friday with Friday preferred.

dcherian avatar Apr 19 '21 17:04 dcherian

Would 10 AM MST on Friday April 23 work well for everyone?

mgrover1 avatar Apr 19 '21 17:04 mgrover1

cc @jbusecke @raphaeldussin

dcherian avatar Apr 20 '21 01:04 dcherian

Yes I can make that! Thanks for organizing.

jbusecke avatar Apr 20 '21 15:04 jbusecke

See https://github.com/xgcm/xgcm/issues/109 for things that xgcm needs.

dcherian avatar Apr 20 '21 19:04 dcherian

I created a Google Calendar event for Friday.

Here is a link to the event

Within the event, you will find a document which will serve as the agenda - feel free to make edits to that!

mgrover1 avatar Apr 20 '21 19:04 mgrover1

That link does not seem to work for me @mgrover1. Could you resend it?

jbusecke avatar Apr 23 '21 15:04 jbusecke

Meet

Notes

mgrover1 avatar Apr 23 '21 15:04 mgrover1

Meet meet.google.com/uab-gvff-mdk

mgrover1 avatar Apr 23 '21 15:04 mgrover1

https://ioos.github.io/ioos_code_lab/content/code_gallery/data_analysis_and_visualization_notebooks/2016-11-16-CF-UGRID-SGRID-conventions.html

Some useful stuff here.

dcherian avatar Mar 03 '22 19:03 dcherian

From https://sgrid.github.io/sgrid/#roms

int grid ;
        grid:cf_role = grid_topology
        grid:topology_dimension = 2 ;
        grid:node_dimensions = "xi_psi eta_psi" ;
        grid:face_dimensions = "xi_rho: xi_psi (padding: both) eta_rho: eta_psi (padding: both)" ;
        grid:edge1_dimensions = "xi_u: xi_psi eta_u: eta_psi (padding: both)" ;
        grid:edge2_dimensions = "xi_v: xi_psi (padding: both) eta_v: eta_psi" ;
        grid:node_coordinates = "lon_psi lat_psi" ;
        grid:face_coordinates = "lon_rho lat_rho" ;
        grid:edge1_coordinates = "lon_u lat_u" ;
        grid:edge2_coordinates = "lon_v lat_v" ;
        grid:vertical_dimensions = "s_rho: s_w (padding: none)" ;

One thing we could do is parse this to understand that xi_*, eta_*, s_* are axes X, Y, Z even though they don't have the axes attribute set. In particular this helps with xi_*, eta_* which are "virtual variables" i.e. there is no data associated with them, or they are "unlabeled dimensions" with no associated coordinate variable or attrs.

dcherian avatar Feb 07 '23 15:02 dcherian