ufs-community / UFS_UTILS

Utilities for the NCEP models.
Other
22 stars 108 forks source link

Does a description/documentaion of the "super" grid in tile files exist? #601

Closed bena-nasa closed 3 years ago

bena-nasa commented 3 years ago

I'm trying to understand the grid tiles files produced when create_hgrid is run as part of the over grid and orography generation. The grid tiles look like this for example:

netcdf c24_grid.tile1 {
dimensions:
        string = 255 ;
        nx = 48 ;
        ny = 48 ;
        nxp = 49 ;
        nyp = 49 ;
variables:
        char tile(string) ;
                tile:standard_name = "grid_tile_spec" ;
                tile:geometryType = "spherical" ;
                tile:discretizationType = "logically_rectangular" ;
                tile:isConformal = "false" ;
                tile:isRegular = "false" ;
                tile:projection = "cube_gnomonic" ;
                tile:north_pole = "lon:0.0, lat:90.0" ;
        double x(nyp, nxp) ;
                x:standard_name = "geographic_longitude" ;
                x:units = "degree_east" ;
        double y(nyp, nxp) ;
                y:standard_name = "geographic_latitude" ;
                y:units = "degree_north" ;
        double dx(nyp, nx) ;
                dx:standard_name = "grid_edge_x_distance" ;
                dx:units = "meters" ;
        double dy(ny, nxp) ;
                dy:standard_name = "grid_edge_y_distance" ;
                dy:units = "meters" ;
        double area(ny, nx) ;
                area:standard_name = "grid_cell_area" ;
                area:units = "m2" ;
        double angle_dx(nyp, nxp) ;
                angle_dx:standard_name = "grid_vertex_x_angle_WRT_geographic_east" ;
                angle_dx:units = "degrees_east" ;
        double angle_dy(nyp, nxp) ;
                angle_dy:standard_name = "grid_vertex_y_angle_WRT_geographic_north" ;
                angle_dy:units = "degrees_north" ;
        char arcx(string) ;
                arcx:standard_name = "grid_edge_x_arc_type" ;
                arcx:north_pole = "lon:0.0, lat:90.0" ;

All the corners/centers are packed into a 2-D array I assume this is because this file is produced by a c code, and since multi dimensional arrays are a pain in c it was easier to pass out 1-D arrays from a subroutine which was just written into one array...

For a given cube face with IM x IM cells, all IM x IM centers, all (IM +1) x (IM+1) corners, and something else is stuffed into a 2-D array of size (2IM+1) x (2IM+1) > IM x IM + (IM +1) x (IM+1); Is there any documentation explaining how the this 2D array is to be unpacked into cell centers, corners, and whatever the other points represent since this 2D array has more storage than is needed for the centers and corners. I've tried reading the create_hgrid code and is see where the coordinates are generated but reading the packing structure is confusing. Surely there be some documentation on these files so users don't have to read the code to unpack this data?

GeorgeGayno-NOAA commented 3 years ago

Here is a graphic of the super grid: https://noaa-emcufs-utils.readthedocs.io/en/ufs-v2.0.0/ufs_utils.html#make-hgrid

GFDL maintains the make_grid code: https://github.com/NOAA-GFDL/FRE-NCtools They can answer any software questions.

bena-nasa commented 3 years ago

Ah, that's what I was looking for. Thank you.