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

ConvertExodusToSCRIP ignores rank=2 in RLL grids #77

Open
czender opened this issue May 20, 2021 · 2 comments
Open

ConvertExodusToSCRIP ignores rank=2 in RLL grids #77

czender opened this issue May 20, 2021 · 2 comments

Comments

@czender
Copy link

czender commented May 20, 2021

This has the effect of "flattening" all 2-D Exodus files into 1-D (aka unstructured) SCRIP files. I'm unsure whether ConvertSCRIPToExodus flattens 2-D SCRIP files into 1-D Exodus files. Preserving the rank of grids would facilitate using TR and MBTR (which requires Exodus or connectivity in some form) in computing weights for a large number of existing SCRIP grids. Short demonstration of what I mean. The value of grid_rank is 1 (not 2) in the output SCRIP file after the last command. A grid_dims array would also be required in the SCRIP output to fix this issue.

zender@firn:~$ GenerateRLLMesh --lat 180 --lon 360 --file cmip6_180x360.g
Parameters:
  --lon <integer> [360] 
  --lat <integer> [180] 
  --lon_begin <double> [0.000000] 
  --lon_end <double> [360.000000] 
  --lat_begin <double> [-90.000000] 
  --lat_end <double> [90.000000] 
  --global_cap <bool> [false] 
  --flip <bool> [false] 
  --in_file <string> [""] 
  --in_file_lon <string> ["lon"] 
  --in_file_lat <string> ["lat"] 
  --in_global <bool> [false] 
  --verbose <bool> [false] 
  --file <string> ["cmip6_180x360.g"] 
  --out_format <string> ["Netcdf4"] 
=========================================================
..Generating mesh with resolution [360, 180]
..Longitudes in range [0, 360]
..Latitudes in range [-90, 90]
..Writing mesh to file [cmip6_180x360.g] 
Nodes per element
..Block 1 (4 nodes): 64800
..Mesh generator exited successfully
=========================================================
zender@firn:~$ ConvertExodusToSCRIP --in cmip6_180x360.g --out cmip6_180x360.nc
Parameters:
  --in <string> ["cmip6_180x360.g"] 
  --out <string> ["cmip6_180x360.nc"] 
  --out_format <string> ["netcdf4"] 
------------------------------------------------------------

..Loading input mesh
Mesh size: Nodes [64442] Elements [64800]
..Writing mesh
Nodes per element
..Block 1 (3 nodes): 720
..Block 2 (4 nodes): 64080
..Done writing
..Mesh converter exited successfully
=========================================================
zender@firn:~$ ncks -m cmip6_180x360.nc
netcdf cmip6_180x360 {
  dimensions:
    grid_corners = 4 ;
    **grid_rank = 1 ;**
    grid_size = 64800 ;

  variables:
    double grid_area(grid_size) ;
      grid_area:units = "radians^2" ;

    double grid_center_lat(grid_size) ;
      grid_center_lat:_FillValue = 9.96920996838687e+36 ;
      grid_center_lat:units = "degrees" ;

    double grid_center_lon(grid_size) ;
      grid_center_lon:_FillValue = 9.96920996838687e+36 ;
      grid_center_lon:units = "degrees" ;

    double grid_corner_lat(grid_size,grid_corners) ;
      grid_corner_lat:_FillValue = 9.96920996838687e+36 ;
      grid_corner_lat:units = "degrees" ;

    double grid_corner_lon(grid_size,grid_corners) ;
      grid_corner_lon:_FillValue = 9.96920996838687e+36 ;
      grid_corner_lon:units = "degrees" ;

    int grid_dims(grid_rank) ;

    int grid_imask(grid_size) ;
} // group /
zender@firn:~$ 

@czender
Copy link
Author

czender commented May 28, 2021

@whannah1 sorry I missed your comment last week. I use RLL to mean Rectangular/Regular Longitude Latitude. The horizonal dimensions are separate coordinate axes so the grid should be Rank 2 (logically rectangular axes) not Rank 1 (unstructured).

@paullric
Copy link
Contributor

paullric commented Oct 9, 2021

This should be fixed on branch updated-api. Need to wait on merge until mbtempest is updated to new API.

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

No branches or pull requests

2 participants