I have hourly data, I want to be able to create daily, monthly and annual averages while taking into account the bisexile years.
These are hourly data from a netcdf file. So I have a temperature variable and a time variable
Data are available from January 1, 2003 to June 30, 2017
For temperature and time variables
Format: classicDimensions: time = 127080Variables: tas_sirta Size: 127080x1 Dimensions: time Datatype: single Attributes: units = '°C' long_name = 'air_temperature' standard_name = 'air_temperature' name = 'tas' dim = 'time' Format: classicDimensions: time = 127080Variables: time Size: 127080x1 Dimensions: time Datatype: single Attributes: long_name = 'date_time' units = 'hours since 1970-01-01' actual_range = '289272.0, 416351.0' standard_name = 'time' name = 'time' calendar = 'standard' dim = 'time' missing_value = NaN
I transform dates with datenum
timee = double(time)/24 + datenum('1970-01-01 00:00:00');datestr(timee(1:7,1),'dd-mm-yyyy HH:MM:SS')
J'obtiens bien
ans =01-01-2003 00:00:0001-01-2003 01:00:0001-01-2003 02:00:0001-01-2003 03:00:0001-01-2003 04:00:0001-01-2003 05:00:0001-01-2003 06:00:00
but I do not know then to make the daily, monthly and annual averages taking into account all the specificities of a year (February with 28-29 days, month with 30, 31 days …)
thank you
Best Answer