For example, I have a netcdf file from WRF model, and its time zone is in UTM 00. I want to change the time zone to UTM 08, how to achieve that?


1 Answer 1


UTM-8N is about British Columbia, Canada and is mostly in timezone UTC-9.

The time zone in netcdf files is contained in the time variable's "units" attribute which identifies the origin and interval of the numerics stored in the time variable. For the CF conventions, the time units attribute must be parseable by the Unidata udunits2 program. See http://www.cgd.ucar.edu/cms/eaton/netcdf/CF-20010629.htm#time for an example like this:

The specification:

    seconds since 1992-10-8 15:15:42.5 -6:00

indicates seconds since October 8th, 1992  at  3  hours,  15
minutes  and  42.5 seconds in the afternoon in the time zone
which is six hours to the west of Coordinated Universal Time
(i.e.  Mountain Daylight Time).  The time zone specification
can also be written without a colon using one or  two-digits
(indicating hours) or three or four digits (indicating hours
and minutes).

If I were doing this, assuming your original attribute is "minutes since 2000-01-24 12:00:00" I would use the NetCDF operators to create a new variable with the hour offset from the time variable:

ncap2 -s 'timeUTM08=time-540'  infile.nc  outfile.nc
ncatted -O -a units,time,m,c,'minutes since 2000-01-24 12:00:00 -9:00' outfile.nc  

This creates a new time variable with the time shift, "timeUTM08" , and updates its unita attribute with a non-UTC timezone.

Since this attribute only identifies only the origin of the time data, neither the origin or the data itself would really shift around with Daylight savings time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.