爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4797|回复: 5

如何识别缺失值nan

[复制链接]

新浪微博达人勋

发表于 2022-12-3 21:03:42 | 显示全部楼层 |阅读模式

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

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

x
处理ERA5-land的2米气温数据过程中发现ismissing()无法识别出海上区域的缺失值,请问有什么方法能让程序判断出来是缺失?变量属性和简单测试如下。


ncl 37> printVarSummary(t)

Variable: t
Type: float
Total Size: 602640 bytes
            150660 values
Number of Dimensions: 3
Dimensions and sizes:        [time | 30] x [lat | 54] x [lon | 93]
Coordinates:
            time: [0..29]
            lat: [  15..54.75]
            lon: [70.5..139.5]
Number Of Attributes: 8
  _FillValue :        nan
  long_name :        2 metre temperature
  units :        K
  standard_name :        air_temperature
  comment :        near-surface (usually, 2 meter) air temperature
  cds_magics_style_name :        near-surface-air-temperature
  type :        real
  coordinates :        realization


ncl 2> print(t(0,53,92))

Variable: t (subsection)
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 11
  lon : 139.5
  lat : 54.75
  time :        0
  coordinates : realization
  type :        real
  cds_magics_style_name :       near-surface-air-temperature
  comment :     near-surface (usually, 2 meter) air temperature
  standard_name :       air_temperature
  units :       K
  long_name :   2 metre temperature
  _FillValue :  nan
(0)     nan


ncl 26> print(ismissing(t(0,53,92)))
(0)     False


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

新浪微博达人勋

发表于 2022-12-4 10:09:23 | 显示全部楼层
用数字的缺省值(如-99999.9等)替换“nan”,ncl不识别字符型的缺省值
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-12-4 11:37:54 | 显示全部楼层
AXD 发表于 2022-12-4 10:09
用数字的缺省值(如-99999.9等)替换“nan”,ncl不识别字符型的缺省值

原来如此,感谢!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-12-4 11:41:13 | 显示全部楼层
从官网上找到isnan_ieee()函数可以判断一个格点的值是否为nan
https://www.ncl.ucar.edu/Documen ... in/isnan_ieee.shtml
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-12-5 15:10:48 | 显示全部楼层
x=where(isnan_ieee(x),-9999,x)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-12-6 14:54:15 | 显示全部楼层
顺利毕业! 发表于 2022-12-5 15:10
x=where(isnan_ieee(x),-9999,x)

学习了,谢谢!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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