NOAA-GFDL / FRE-NCtools

Tools for manipulating and creating netCDF inputs for FMS managed models
GNU Lesser General Public License v3.0
20 stars 28 forks source link

make_quick_mosaic saves incorrect atmosXland grid file when creating a 1-dimension grid #281

Open ceblanton opened 8 months ago

ceblanton commented 8 months ago

Describe the bug Creating a 1-dimensional grid-spec (with make_hgrid appears to work, but the resulting output has no cells and cannot be read by a FMS-based model (Zetac).

To Reproduce

  1. make_hgrid --grid_type regular_lonlat_grid --nxbnds 2 --nybnds 2 --xbnd -3,3 --ybnd -3,3 --nlon 1200 --nlat 2
  2. make_solo_mosaic --num_tiles 1 --dir ./
  3. make_topog --mosaic solo_mosaic.nc --topog_type bowl --bottom_depth 0
  4. make_quick_mosaic --input_mosaic solo_mosaic.nc --mosaic_name grid_spec --ocean_topog /archive/fms/mom4/input_data/OCCAM_p2degree.nc

The atmos-land mosaic file has no cells,

ncdump -h atmos_mosaic_tile1Xland_mosaic_tile1.nc

netcdf atmos_mosaic_tile1Xland_mosaic_tile1 {
dimensions:
    string = 255 ;
    ncells = UNLIMITED ; // (0 currently)
    two = 2 

Expected behavior The atmos x land mosaic file should have cells, and the grid-spec file should be able to be read by FMS shared code.

System Environment any

Additional context A previous workaround solution (from a former nctools developer) works,

https://github.com/ceblanton/FRE-NCtools/tree/sgarner

but the user has requested that the workaround be merged to the trunk.

underwoo commented 8 months ago

The solution provided to the user CANNOT be merged to the trunk as is. The previous solution ensures a block of code (in an if block) always runs (using if (1 > 0)). We need to understand why the block is not getting executed in this user's instance, and ensure the user is running all tools in the workflow properly for what is desired.