Problem in determining time dimension in netcdf file

5 views (last 30 days)
Poulomi Ganguli
Poulomi Ganguli on 6 Jul 2019
Answered: Walter Roberson on 7 Jul 2019
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:
time = 1440 (UNLIMITED)
Size: 1440x1
Dimensions: time
Datatype: double
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\'),'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!

Translated by