0

我在 nco 工作,遇到了这个难题。我必须将 360 天日历重新排列为 365 天的普通公历日历。在 360 天日历中每个月有 30 天。我的想法是在公历日历中应包含 31 天的月份中增加一天,并从二月(闰年或非闰年)中删除一两天。我知道如何删除天数(只需使用 ncks 将您需要的内容复制到另一个文件中)。

有没有一种简单的方法可以复制特定月份的最后一天并将其添加到最后的同一个月?

我的文件以 3 小时的分辨率保存一年,我想使用名为tas(温度)的变量。下面我已经 ncdump'ed 最重要的部分:

dimensions:
rlon = 424 ;
rlat = 412 ;
time = UNLIMITED ; // (2880 currently)

variables:
double rlon(rlon) ;
    rlon:standard_name = "grid_longitude" ;
    rlon:long_name = "longitude in rotated pole grid" ;
    rlon:units = "degrees" ;
    rlon:axis = "X" ;
double rlat(rlat) ;
    rlat:standard_name = "grid_latitude" ;
    rlat:long_name = "latitude in rotated pole grid" ;
    rlat:units = "degrees" ;
double time(time) ;
    time:standard_name = "time" ;
    time:units = "days since 1949-12-01 00:00:00" ;
    time:calendar = "360_day" ;
    time:long_name = "time" ;
    time:axis = "T" ;
float tas(time, rlat, rlon) ;
    tas:grid_mapping = "rotated_pole" ;
    tas:_FillValue = 1.e+20f ;
    tas:missing_value = 1.e+20f ;
    tas:standard_name = "air_temperature" ;
    tas:long_name = "Near-Surface Air Temperature" ;
    tas:units = "K" ;
    tas:coordinates = "lon lat height" ;
    tas:cell_methods = "time: point" ;

我期待听到想法。

4

2 回答 2

1

如果 360 天的数据存储在 12 个月度文件中,那么您可以使用 ncrcat 记录附加功能以及负 hyperslab 索引从末尾倒数并将最后一条记录附加到自身

ncrcat --rec_apn -d time,-1 in.nc in.nc

请务必先备份您的数据,因为这会覆盖输入。

于 2017-09-21T22:19:38.690 回答
1

我用更长的方法解决了这个问题。首先,我将年度文件分成几个月。对于每个月,我都添加和删除了必要的日子,然后将结果月份连接起来。

如果有人有更快的方法请分享

于 2017-06-09T14:17:12.287 回答