Skip to content

ConvertExodusToSCRIP ignores rank=2 in RLL grids #77

@czender

Description

@czender

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:~$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions