爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5654|回复: 0

[经验总结] ncl频次计算出现负值

[复制链接]
发表于 2022-3-7 20:29:20 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 一大碗年糕 于 2022-3-7 20:30 编辑

晚上在做事件频次计算的时候发现对原数据在时间维sum总数竟然会出现负值(照理说肯定是大于等于0),仔细检查之后发现变量的类型竟然是byte,其取值范围是-128到127,显然错误原因是由于频次总和超出范围被强制转换了,对byte这个类型数据好像说有些函数也不适用,以后建议多加小心
附上ncl关于byte的一些解释:
  • (*) Note that as of version 6.0.0 the byte type has changed from unsigned to signed. This is to help NCL track more closely with NetCDF usage. If you have byte data that you need to treat as 8 bit unsigned data it is coercible to the ubyte type directly by assignment or through use of the tounsigned function.
  • CAUTION: Currently, arithmetic overflow and underflow are not always reported as errors to the user. Assignment of out-of-range values may cause errors.


2022-03-07 21-21-29 的屏幕截图.png
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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