Project

General

Profile

CDO time step writing - missing grid information

Added by Sarah Roffe over 2 years ago

Good day,

I tried to add in a time step for my netcdf file (attached - this file was created on R by merging daily tiff timestep files for CHIRPS). I used this code:

cdo settaxis,1981-01-01,12:00:00,1day Chirps_1981.nc Chirps_1981_dates.nc

And received this error:

Warning (cdf_read_mapping_atts): Text attribute crs:grid_mapping_name missing!
setBaseTime : Unsupported TIMEUNIT: unknown!

Can anyone assist with how to write the missing grid information using CDO?

Kind regards,
Sarah


Replies (1)

RE: CDO time step writing - missing grid information - Added by Karin Meier-Fleischer over 2 years ago

Hi Sarah,

your data file is not CF-conform, the time dimension is named z and have no units and calendar attribute. Furthermore, the crs variable doesn't have the grid_mapping_name attribute which is needed.

1. Rename time variable and dimension z to time.

ncrename -O -v z,time -d z,time Chirps_1981.nc tmp0.nc

2. Add missing attributes

ncatted -O \
        -a grid_mapping_name,crs,c,c,'latitude_longitude' \
        -a standard_name,time,c,c,'time' \
        -a long_name,time,o,c,'time' \
        -a units,time,o,c,'days since 1981-1-1 12:00:00' \
        -a calendar,time,c,c,'proleptic_gregorian', \
        -a axis,time,c,c,'T' \
        tmp0.nc tmp1.nc

3. Set time axis and missing value

cdo -r -setctomiss,-9999.0 \
       -settaxis,1981-01-01,12:00:00,1day \
       -setreftime,1981-01-01,12:00:00,1day \
        tmp1.nc Chirps_1981_dates.nc

-Karin

    (1-1/1)