爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 11313|回复: 8

NCL使用 calculate_monthly_values出现错误,不知道错在哪里

[复制链接]
发表于 2018-10-24 22:43:31 | 显示全部楼层 |阅读模式
1金钱
本帖最后由 王大琳 于 2018-10-25 09:48 编辑

我有一个三维的minimum_air_temperature变量,为(365,360,720),第一个维度为1年的天数,第二个是纬度,第三个是经度,然后想通过calculate_monthly_values函数的得到12个月份的值,tmp0 = calculate_monthly_values(minimum_air_temperature, "sum", 0, False),我想tmp0应该是出现(12,360,720)的数组,但是出现了下面的错误,导致生成了缺失值。各位大神能告诉我怎么改吗?是我数据minimum_air_temperature的数据类型要改变吗?

TIM截图20181024224724.png

其中minimum_air_temperature变量的详细情况是
TIM截图20181024225406.png
是不是函数minimum_air_temperature不能识别出time的数值200020101.5,所以计算不了?
时间的属性为下图:
TIM截图20181025095118.png

密码修改失败请联系微信:mofangbao
发表于 2018-10-25 09:42:01 | 显示全部楼层
我的猜想哈,“必须具有以cd_calendar函数识别的单位的关联时间坐标变量”它的意思是365的单位是不是要设置成day?
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2018-10-25 09:42:07 | 显示全部楼层
我的猜想哈,“必须具有以cd_calendar函数识别的单位的关联时间坐标变量”它的意思是365的单位是不是要设置成day?
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2018-10-25 09:48:09 | 显示全部楼层
用这个试一下YYYYMM  = cd_calendar(time, -2)
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2018-10-25 09:53:33 | 显示全部楼层
我的time的属性是
Dimensions and sizes:        [time | 365]
Coordinates:
Number Of Attributes: 5
  standard_name :        time
  bounds :        time_bnds
  units :        day as %Y%m%d.%f
  calendar :        proleptic_gregorian
  axis :        T
(0)        19010101.5
(1)        19010102.5
(2)        19010103.5
(3)        19010104.5
(4)        19010105.5
(5)        19010106.5
(6)        19010107.5
感觉calendar :        proleptic_gregorian这个可以被识别出来,我在想是不是time的值有小数点需要转成整数才能calculate_monthly_values算出来。我先试一下你那种方法。

密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2018-10-25 10:15:31 | 显示全部楼层
帅蛋fly 发表于 2018-10-25 09:48
用这个试一下YYYYMM  = cd_calendar(time, -2)

我试过了b= cd_calendar(minimum_air_temperature&time,  2)
b的属性是
Variable: b
Type: double
Total Size: 2920 bytes
            365 values
Number of Dimensions: 1
Dimensions and sizes:        [365]
Coordinates:
Number Of Attributes: 1
  _FillValue :        9.969209968386869e+36
(0)        9.969209968386869e+36
(1)        9.969209968386869e+36
(2)        9.969209968386869e+36
(3)        9.969209968386869e+36
(4)        9.969209968386869e+36
(5)        9.969209968386869e+36

说明这里minimum_air_temperature&time的值如19010101.5一开始读入就识别不了
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2018-10-26 14:25:13 | 显示全部楼层
The function uses cd_calendar to extract the year, month, day and hour. All values for a particular month are used. NOTE: Use of cd_calendar means the units of time are something like: "days/hours/minutes/seconds since ...". If these units are not present as an attribute of 'time', the function will not work.
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2020-7-6 20:44:31 | 显示全部楼层
乱世一杯茶 发表于 2018-10-26 14:25
The function uses cd_calendar to extract the year, month, day and hour. All values for a particular  ...

请问最后怎么解决的
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2021-1-2 10:15:16 | 显示全部楼层
请问是怎么解决的,我的time 的calendar是   proleptic_gregorian,但是无法用cd_calendar识别出来
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表