Project

General

Profile

Time dates to time frames

Added by Anne Moree over 6 years ago

Hello,

I have a reference file, where the dimension time is present in the form of 12 frames.
My other file needs to be in the same format, and has the same amount of frames (12) but also a time dimension (representing 12 months) as vsisible with ncview and using ncdump -h. I think I need to somehow transfer my time dimension to 12 time frames, but deleting the time dimension (using ncwa -a time) does not give the result I want.
Would you have a suggestion how to do this?

Thank you in advance!

Anne


Replies (3)

RE: Time dates to time frames - Added by Ralf Mueller over 6 years ago

hi Anne!

are your realy sure that sss_clim_core.nc is the reference file with the right dimensions??

netcdf sss_clim_core {
dimensions:
        x = 180 ;
        y = 193 ;
        time = 12 ;
variables:
        double sss(time, y, x) ;
                sss:missing_value = -99. ;
                sss:units = "psu" ;
                sss:long_name = "Sea surface salinity" ;
data:

 sss =
  -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 
    -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, .....

is has nothing like data variables for the dimensions or units or so. To me the other file seems to be in a good shape, though..

cheers
ralf

RE: Time dates to time frames - Added by Ralf Mueller over 6 years ago

anyway: to set the time axis of a file (no matter if a time dimension already exist or not), you can use the operator settaxis like this

cdo -f nc -settaxis,2003-12-12,12:00:00,1days sss_clim_core_LGM_smoothed.nc sss_clim_core_withTime.nc

sss_clim_core.nc is not CF-conform, so you get a warning with the above call, but still a proper time axis is created.

hth
ralf

RE: Time dates to time frames - Added by Anne Moree over 6 years ago

Hey Ralf,

Thank you. Yes, the sss_clim_core.nc is the reference file, and I agree it is a bit of a strange file... The other one is the one I made, with a new sss variable field which should replace the one in the reference file. The thing is, changing the time axis of the sss_clim_core_LGM_smoothed.nc file does not remove the time dimension (while keeping 12 data frames) like present in the reference file. But I managed in the meantime to successfully extract the field (they are both 180x193x12, and that is the most important) without changing the sss_clim_core_LGM_smoothed file. Making a non-CF-conform file using CDO is probably also not what is meant to be done with it:)

Thanks again and have a nice day,
Anne

    (1-3/3)