简体   繁体   English

使用 cdo(气候数据运算符)在每日时间步长中存储的变量的月度总和

[英]Monthly sum of of a variable stored at daily timesteps using cdo (Climate Data Operators)

I have a nc file of 40 years for a variable recorded at daily temporal resolution.我有一个 40 年的 nc 文件,用于以每日时间分辨率记录的变量。 I would like to sum these over monthly intervals and have tried the following:我想按月对这些进行总结,并尝试了以下方法:

cdo monsum inputfile.nc outputfile.nc

Although this runs with no error, I only get one frame in the output file.虽然这运行没有错误,但我在输出文件中只得到一帧。 I would expect a much larger file.我希望有一个更大的文件。

I am thinking this might be some issue with time in the input file.我认为这可能是输入文件中的时间问题。

Copied info from ncdump-h input file :ncdump-h input file复制信息:

dimensions:
       time = UNLIMITED ; // (14975 currently)
       longitude = 40 ;
       latitude = 66 ;
variables:
       double time(time) ;
               time:standard_name = "time" ;
               time:units = "days since 1979-1-1 00:00:00" ;
               time:calendar = "proleptic_gregorian" ;
               time:axis = "T" ;
       double longitude(longitude) ;
               longitude:standard_name = "projection_x_coordinate" ;
               longitude:long_name = "longitude" ;
               longitude:units = "degrees_east" ;
               longitude:axis = "X" ;
       double latitude(latitude) ;
               latitude:standard_name = "projection_y_coordinate" ;
               latitude:long_name = "latitude" ;
               latitude:units = "degrees_north" ;
               latitude:axis = "Y" ;
       int crs ;
               crs:proj4 = "+proj=longlat +datum=WGS84" ;
       float variable(time, latitude, longitude) ;
               variable :grid_mapping = "crs" ;
               variable :_FillValue = -3.4e+38f ;
               variable :missing_value = -3.4e+38f ;
               variable :proj4 = "+proj=longlat +datum=WGS84" ;
               variable :min = 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ;
               variable :max = 6.5701843261719, 8.62581787109377, 6.24334106445315, 8.29082641601565, 7.59359130859377, 10.0182434082031, 9.76052246093752, 9.95830688476565, 10.3648010253906, 12.8482604980469, 13.1276489257813, 13.1267333984375, 10.9829345703125, 9.82497558593752, 10.1014953613281, 11.8195434570313, 13.9579711914063, 10.0517211914063, 9.37850341796877, 11.3964782714844, 13.0114074707031, 14.4672180175781, 11.4755798339844, 10.6639953613281, 11.3891540527344, 11.9616943359375, 13.7388854980469, 5.56426391601565, 7.07705078125002, 7.64479980468752, 8.25527343750002 ; // global attributes:
               :CDI = "Climate Data Interface version 1.9.10 (https://mpimet.mpg.de/cdi)" ;
               :Conventions = "CF-1.4" ;
               :created_by = "R, packages ncdf4 and raster (version 3.4-10)" ;
               :date = "2021-10-06 11:52:06" ;
               :history = "Mon Oct 18 13:50:40 2021: cdo setreftime,1979-01-01,00:00:00 kdd_AR_1979_2019.nc kdd_AR_1979_2019_adj.nc\n",

Help is much appreciated.非常感谢帮助。 Sorry for not being to provide a straightforward reproducible example.很抱歉没有提供一个简单的可重复示例。 I can share the data via we-transfer or such if needed.如果需要,我可以通过 we-transfer 或类似方式共享数据。 Thanks!谢谢!

CDO uses the attribute proj_params to identify the proj parameters. CDO 使用属性 proj_params 来标识 proj 参数。 The corresponding attribute in your file is proj4.您文件中的相应属性是 proj4。 You need to rename this attribute to apply the proj parameters automatically:您需要重命名此属性以自动应用 proj 参数:

ncrename -a crs@proj4,proj_params file.nc

I found this answer here from Uwe Schulzweida我从 Uwe Schulzweida 找到了这个答案

Once you have done that I hope you can process the file with cdo correctly, let me know if it works.完成后,我希望您可以使用 cdo 正确处理文件,让我知道它是否有效。

Thanks for Adrian Tompkins who lead me straight to the answer.感谢 Adrian Tompkins 直接引导我找到答案。 I had to fix the time axis of the merged file used here as input.我必须修复此处用作输入的合并文件的时间轴。 This is possible using the settaxis operator这可以使用settaxis operator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM