Correcting timestamp from netCDF
Show older comments
Hello to matlab the community,
If possible I would be grateful for some help in regards to conversion of timestamps in matlab from netcdf.
I am familiar with netcdf and their structure as well as their conversion, but I think I am missing something.
I have a netcdf with time in the format of
time =[23627;
23627.0069444444;
23627.0138888889;
23627.0208333333];
And I am trying to correct the timestamp both to a human readable form but also to use in plots.
Of course I checked the time offset in the netcdf and it is in
"days since 1950-01-01T00:00:00Z";
Therefore, I have included this offset in my estimates but I cannot see to be getting the correct form. I am using this
time_offset=datenum(1950,01,01);
new_time=(time/24)+time_offset;
timestamp=datestr(new_time);
timestamp=datestr(new_time,'yyyymmddHHMM');
nt=str2num(timestamp);
timestamp=uint64(nt);
timestamp=double(nt);
However the outcome does not give me what I would expect.
The measurements should be in 10 minute increments like so:
01-01-2015 00:00:00
01-01-2015 00:10:00
The variable is new_time is estimated as
7.132084583333334e+05
that corresponds to the variable timestamp:
195209111100
It seems that it does not recognize the offset. Have I done anything wrong?
Thank you all in advance,
Accepted Answer
More Answers (0)
Categories
Find more on NetCDF in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!