Project

General

Profile

selregion dropping lat/lon bounds

Added by Brendan DeTracey about 1 year ago

(cdo 2.1.0)
Hi everyone,
I was trying the following:

$ cdo -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos tos_Omon_GISS-E2-1-G_historical_r1i1p1f2_gn_193101.nc test.nc
cdo(1) selregion: Process started
cdo(2) selname: Process started
cdo    fldmean (Warning): Computation of grid cell area weights failed, grid cell corner coordinates missing!
cdo    fldmean (Warning): Grid cell bounds not available, using constant grid cell area weights!
cdo(2) selname: Processed 51840 values from 1 variable over 1 timestep
cdo(1) selregion: Processed 51840 values from 1 variable over 1 timestep
cdo    fldmean: Processed 15 values from 1 variable over 1 timestep [0.04s 54MB]
and trying to understand why the weights were failing.
The original file does have variables for lat and lon bounds:
$ cdo sinfo tos_Omon_GISS-E2-1-G_historical_r1i1p1f2_gn_193101.nc
   File format : NetCDF4
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : unknown  GISS-E2.1G v instant       1   1     51840   1  F32  : -1
   Grid coordinates :
     1 : lonlat                   : points=51840 (288x180)
                              lon : 0.625 to 359.375 by 1.25 degrees_east  circular
                              lat : -89.5 to 89.5 by 1 degrees_north
                        available : cellbounds
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :
                             time : 1 step
     RefTime =  1850-01-01 00:00:00  Units = days  Calendar = 365_day  Bounds = true
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  1931-01-16 12:00:00
cdo    sinfo: Processed 1 variable over 1 timestep [0.02s 36MB]
However, it appears for this data that the selregion command strips out the lat and lon bounds:
$ cdo -selregion,polygon_gomss_subarea_gom.txt -selname,tos tos_Omon_GISS-E2-1-G_historical_r1i1p1f2_gn_193101.nc test.nc
cdo(1) selname: Process started
cdo(1) selname: Processed 51840 values from 1 variable over 1 timestep
cdo    selregion: Processed 51840 values from 1 variable over 1 timestep [0.04s 54MB]
$ cdo sinfo test.nc
   File format : NetCDF4
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : unknown  GISS-E2.1G v instant       1   1        15   1  F32  : -1
   Grid coordinates :
     1 : unstructured             : points=15
                              lon : 289.375 to 293.125 degrees_east
                              lat : 40.5 to 44.5 degrees_north
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :
                             time : 1 step
     RefTime =  1850-01-01 00:00:00  Units = days  Calendar = 365_day  Bounds = true
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  1931-01-16 12:00:00
cdo    sinfo: Processed 1 variable over 1 timestep [0.01s 37MB]
This does not happen with data from other CMIP models, just the GISS model:
$ cdo -selregion,polygon_gomss_subarea_gom.txt -selname,tos tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_195001.nc test.nc
cdo(1) selname: Process started
cdo(1) selname: Processed 108000 values from 1 variable over 1 timestep
cdo    selregion: Processed 108000 values from 1 variable over 1 timestep [0.05s 63MB]
$ cdo sinfo test.nc
   File format : NetCDF4
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : unknown  ACCESS-CM2 v instant       1   1        21   1  F32  : -1
   Grid coordinates :
     1 : unstructured             : points=21  nvertex=4
                        longitude : 289.5 to 293.5 degrees_east
                         latitude : 40.28319 to 43.93883 degrees_north
                        available : cellbounds
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :
                             time : 1 step
     RefTime =  1850-01-01 00:00:00  Units = days  Calendar = proleptic_gregorian  Bounds = true
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  1950-01-16 12:00:00
cdo    sinfo: Processed 1 variable over 1 timestep [0.01s 36MB]


Replies (3)

RE: selregion dropping lat/lon bounds - Added by Ralf Mueller about 1 year ago

Hi Brendan!

I don't know, why this happens, but I have a workaround:

  1. create a mask, with 1 everywhere on the source grid:
    cdo -gtc,-10000000000000 tos_Omon_GISS-E2-1-G_historical_r1i1p1f2_gn_193101.nc maskAll.nc
  2. transform the input data into an unstructured grid (without changing any valuee):
    cdo -L reducegrid,maskAll.nc -selname,tos tos_Omon_GISS-E2-1-G_historical_r1i1p1f2_gn_193101.nc tos-unstruc.nc 
  3. Do you original call on the unstructured version of the input:
    % cdo -L -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos tos-unstruc.nc regUn.nc                                      [Thu 2023-03-16|11:23:42]
    cdo(1) selregion: Process started
    cdo(2) selname: Process started
    cdo(2) selname: Processed 51840 values from 1 variable over 1 timestep
    cdo(1) selregion: Processed 51840 values from 1 variable over 1 timestep
    cdo    fldmean: Processed 15 values from 1 variable over 1 timestep [0.02s 70MB]
    

hth and have a nice day
Ralf

RE: selregion dropping lat/lon bounds - Added by Brendan DeTracey about 1 year ago

Thanks so much, ralf! Hope all is good.

RE: selregion dropping lat/lon bounds - Added by Uwe Schulzweida about 1 year ago

Hi Brendan,

Thanks for the report! selregion will copy the cell bounds also for regular lonlat grids in the next CDO release 2.2.0.

Cheers,
Uwe

    (1-3/3)