Project

General

Profile

"cdo div" returns only one timestep from the input file

Added by Thiago dos Santos over 2 years ago

Hi all,

I am trying to "clip" a netcdf file, which has 12784 timesteps, using another netcdf file as a mask.

The command I am using is the following:

cdo div input.nc maskfile.nc outputfile.nc

which works as expected. However, only the first timestep of the input file has been clipped.

Am I missing something with the div command? Is there a "native" CDO solution to mask out all the timesteps of a netcdf file?

These are the files I am working with. The input file is:

netcdf AgERA5_2m_temperature_24_hour_maximum_1987-2021_chunked {
dimensions:
    time = UNLIMITED ; // (12784 currently)
    lat = 420 ;
    lon = 440 ;
variables:
    float Temperature_Air_2m_Max_24h(time, lat, lon) ;
        Temperature_Air_2m_Max_24h:long_name = "Maximum air temperature at 2 meter (00-00LT)" ;
        Temperature_Air_2m_Max_24h:units = "K" ;
        Temperature_Air_2m_Max_24h:_FillValue = -9999.f ;
        Temperature_Air_2m_Max_24h:missing_value = -9999.f ;
        Temperature_Air_2m_Max_24h:temporal_aggregation = "Max 00-00LT" ;
    double lat(lat) ;
        lat:standard_name = "latitude" ;
        lat:long_name = "latitude" ;
        lat:units = "degrees_north" ;
        lat:axis = "Y" ;
    double lon(lon) ;
        lon:standard_name = "longitude" ;
        lon:long_name = "longitude" ;
        lon:units = "degrees_east" ;
        lon:axis = "X" ;
    double time(time) ;
        time:standard_name = "time" ;
        time:long_name = "time" ;
        time:units = "days since 1900-01-01" ;
        time:calendar = "proleptic_gregorian" ;
        time:axis = "T" ;

// global attributes:
        :CDI = "Climate Data Interface version 2.0.1 (https://mpimet.mpg.de/cdi)" ;
        :Conventions = "CF-1.7" ;
        :CDO = "Climate Data Operators version 2.0.0 (https://mpimet.mpg.de/cdo)" ;
        :history = "Mon Apr 25 11:36:39 2022: ncks -O -4 -D 4 --cnk_plc g2d --cnk_dmn lat,10 --cnk_dmn lon,10 --cnk_dmn time,1000 tmax.nc ../historical/AgERA5_2m_temperature_24_hour_maximum_1987-2021_chunked.nc" ;
        :NCO = "netCDF Operators version 5.0.3 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ;

and the mask file is:

netcdf br_mask {
dimensions:
    y = 420 ;
    x = 440 ;
    latitude = 420 ;
    longitude = 440 ;
variables:
    int mask_array(y, x) ;
        mask_array:coordinates = "latitude longitude" ;
        mask_array:_FillValue = -2147483647 ;
    double latitude(latitude) ;
        latitude:units = "degrees_north" ;
        latitude:long_name = "latitude" ;
    double longitude(longitude) ;
        longitude:units = "degrees_east" ;
        longitude:long_name = "longitude" ;
}

Just in case it's useful, my CDO version is:

cdo -V
Climate Data Operators version 2.0.0 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -std=gnu++14 -march=native -g -O2 -fopenmp   -pthread
CXX version : g++ (SUSE Linux) 7.5.0
C Compiler: gcc -march=native -g -O2 -fopenmp   -pthread -pthread
C version : gcc (SUSE Linux) 7.5.0
F77 Compiler: gfortran -march=native -g -O2
F77 version : GNU Fortran (SUSE Linux) 7.5.0
Features: 125GB 48threads C++14 OpenMP45 Fortran PTHREADS HDF5 NC4/HDF5/threadsafe OPeNDAP SZ UDUNITS2 PROJ XML2 CURL AVX2
Libraries: HDF5/1.10.5 proj/8.0.0 xml2/2.9.7 curl/7.66.0
CDI data types: SizeType=size_t  DateType=int64_t
CDI file types: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
     CDI library version : 2.0.1
 ecCodes library version : 2.19.1
  NetCDF library version : 4.7.3 of Oct 25 2021 12:00:00 $
    hdf5 library version : 1.10.5 threadsafe
    exse library version : 1.4.2
    FILE library version : 1.9.1

Thanks in advance for any hint,
T.


Replies (1)

RE: "cdo div" returns only one timestep from the input file - Added by Thiago dos Santos over 2 years ago

After creating this thread I realized that my CDO was about five versions behind the current release.

Upon compiling v2.0.5 on my system, I re-ran the aforementioned 'cdo div' command and everything worked as intended this time.

I guess this was a little reminder that keeping up with the latest CDO releases is always a good idea...

Cheers,
T.

    (1-1/1)