Converting netCDF time (hours since 1-1-1 00:00:00.0) to actual date

5 ビュー (過去 30 日間)
Clifford
Clifford 2012 年 6 月 19 日
コメント済み: Walter Roberson 2020 年 5 月 4 日
Does anyone out there know how to do the conversion I have noted above? datestr() and datenum() are not helping much. For example:
a = time(1,1);
a = 17298624;
b = datestr(a);
b = 08 - Jan - 7362
When the data is a monthly mean from Jun 1974 with a time step of per month. The files are from www.esrl.noaa.gov.
Thanks!
  1 件のコメント
yaxin sun
yaxin sun 2020 年 5 月 4 日
This friend,I have some similar problems with yours ,I also want to know that how to deal with this problem about you .

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 19 日
Divide "a" by 24 as it is hours but datestr() needs days. And then add 367 to the result in order to compensate for the time base of 1-1-1 instead of datestr()'s time base of 0-0-0 . (datestr thinks year 0 was a leap year.)
  4 件のコメント
Mian
Mian 2020 年 4 月 6 日
Thank you, it also helped me
Walter Roberson
Walter Roberson 2020 年 5 月 4 日
In modern times I would say,
datetime(1,1,1) + hours(NumberFromNetCDFFile)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by