elyssac
elyssac

Reputation: 51

Netcdf averages time varable when averaging multiple .nc files

I have averaged a bunch of hourly netCDF files (for one year) to create one large netCDF file that contains an average daily value. The time variable represents hours since 2005-1-1 00:00:00 and looks like this:

time = 11.5, 35.5, 59.5, 83.5, 107.5, 131.5, 155.5, 179.5, 203.5, 227.5...;

However, I would like the time variable to represent the beginning of the day so that it looks like this:

time = 0, 24, 48...;

Is there a way to manipulate the time variable so that it represents the beginning of the day instead of the middle of the day?

Thanks!

Upvotes: 3

Views: 308

Answers (2)

ClimateUnboxed
ClimateUnboxed

Reputation: 8077

you could also use cdo to shift the time axis

cdo shifttime,-11.5hours infile.nc outfile.nc

Upvotes: 1

elyssac
elyssac

Reputation: 51

It seems as if this command may have solved my issue:

ncap2 -s "time=time-11.5" infile.nc -o outfile.nc

Upvotes: 2

Related Questions