Problem in determining time dimension in netcdf file

4 views (last 30 days)
Hello:
I am analyzing EURO CORDEX wind data for 1979 - 01-01-1979-12-30 period. The time dimension of the associated netcdf file is attached here. If I do ncdisp of the netcdf file, I get following message:
Format:
netcdf4_classic
Dimensions:
time = 1440 (UNLIMITED)
Variables:
time
Size: 1440x1
Dimensions: time
Datatype: double
Attributes:
standard_name = 'time'
long_name = 'time'
bounds = 'time_bnds'
units = 'days since 1949-12-01 00:00:00'
calendar = '360_day'
axis = 'T'
I need to calculate number of minutes from 1979-01-01 since the first time stamp. I tried foll. ways:
time = ncread(sprintf('%s%s',fullfile(dir_input),'\uas\uas_EUR-11_MOHC-HadGEM2-ES_historical_r1i1p1_SMHI-RCA4_v1_3hr_197901010000-197912302100_6hrly.nc'),'time');
t = datenum(1949,12,01,double(time),0,0);
refdatenum = datenum(1979,1,1);
time2 = (t(1,1)-refdatenum)*24*60
But I am always end up with negative values. I suppose to get 6-hourly wind output from 1979 onwards. Any help will be deeply appreciated. Thanks,

Answers (1)

Walter Roberson
Walter Roberson on 7 Jul 2019
You are putting the input values into the hours slot instead of the days slot.
minutes(datetime(1949,12,1) + time - datetime(1979,1,1))

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!