Project

General

Profile

Create Xtime variable?

Added by Gabe Bromley almost 2 years ago

I have some WRF auxiliary files that are missing the XTIME variable, so CDO time based operations aren't working. I tried:

cdo settaxis,2011-04-01,00:01:00,1hour sfc_vars_d01_2011-04-01_01\:00\:00.nc test.nc

But this took eons(over 30 minutes for 1 file) and I have several thousand files. The "TIMES" variable has the correct date and time for each time step, is there a way to just create XTIME for CDO to use from this "TIMES" variable? I have attached the ncdump output that shows the Times string.

Thanks,

Gabe


Replies (2)

RE: Create Xtime variable? - Added by Ralf Mueller almost 2 years ago

hi Gabe!

First the XTIMES variable is clearly missing (it is used in the coordinates attribute but not present in the file), so I would go back to the source of the data and try to get.

If you really have to create it yourself, you can create it in a separate file and attach the variable later with some NCO command.

to create a time-axis variable, you can use the seq operator (called for in releases prios to 1.9.7:

cdo -f nc -chname,seq,XTIMES -settaxis,2011-04-01,00:01:00,1hour -seq,1,34 xtimes.nc
ncrename -v time,XTIME xtimes.nc          # rename the coordinate variable
ncks -C -x -v XTIMES xtimes.nc xtime.nc   # remove the data variable

The you combine xtime.nc with your original file use NCO's ncecat I think.

RE: Create Xtime variable? - Added by Gabe Bromley almost 2 years ago

Thanks Ralf!

Gabe

    (1-2/2)