I have 365 (one per day) netCDF files containing hourly data that are time stamped in GMT. I was wondering if there is a way to create daily netCDF files in local time? I am not great at writing scripts, but have some basic knowledge. Does anyone have a "simple" way of performing this particular task?
Thanks a lot for the time, I appreciate it.
Mark Lilly
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you give a "ncdump -h" of the file. One thing you might be able to do is to change (or add) the "units" attribute for the time variable. I use:
time:units = "days since 01-JAN-2002 00:00:00" ;
for GMT data. For Eastern Time you could change this to:
time:units = "days since 31-DEC-2001 19:00:00" ;
Do this with ncatted. Of course you'll need to be careful about Daylight Savings Time. Depending on how the time data is stored in each file this may or may not be much of a problem.
Steve
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is no "convert to local time" switch in NCO.
It seems like there are at least two approaches you could take,
and which one is best depends on how the timestamping is done.
If it's done with attributes, then change the attribute as Steve suggests.
If it's done with a coordinate variable, then a loop over ncap2 might work, e.g.,
for fl in `in*.nc` ; do
ncap2 -s 'time=time+9.0/24.0' in.nc out.nc
done
Charlie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have 365 (one per day) netCDF files containing hourly data that are time stamped in GMT. I was wondering if there is a way to create daily netCDF files in local time? I am not great at writing scripts, but have some basic knowledge. Does anyone have a "simple" way of performing this particular task?
Thanks a lot for the time, I appreciate it.
Mark Lilly
Can you give a "ncdump -h" of the file. One thing you might be able to do is to change (or add) the "units" attribute for the time variable. I use:
time:units = "days since 01-JAN-2002 00:00:00" ;
for GMT data. For Eastern Time you could change this to:
time:units = "days since 31-DEC-2001 19:00:00" ;
Do this with ncatted. Of course you'll need to be careful about Daylight Savings Time. Depending on how the time data is stored in each file this may or may not be much of a problem.
Steve
Hi Mark,
There is no "convert to local time" switch in NCO.
It seems like there are at least two approaches you could take,
and which one is best depends on how the timestamping is done.
If it's done with attributes, then change the attribute as Steve suggests.
If it's done with a coordinate variable, then a loop over ncap2 might work, e.g.,
for fl in `in*.nc` ; do
ncap2 -s 'time=time+9.0/24.0' in.nc out.nc
done
Charlie