爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 11687|回复: 8

NCL if语句出错:The result of the conditional expression yields

[复制链接]
发表于 2016-12-15 15:37:28 | 显示全部楼层 |阅读模式

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

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

x

NCL脚本如下:

do i=0,240
            do l=0,26
                if (ismissing(va_c(l,i))) then  
                    mva(l,i)=mva@_FillValue
                end if
                if((.not.ismissing(va_c(l,i))).and.(mva(l,i).eq.0)) then
                    mva(l,i)=mva@_FillValue
                end if
            end do
        end do
提示错误:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function。

对照官网相关如下:
Sample code that causes the error:
    x = new(1,float)   ; x is assigned a missing value    if(x.gt.5) then      print("x > 5")    end if

Cause: Using a missing value in an "if" statement or some other conditional statement.

Fix: If there's a chance your variable could be missing, then use ismissing to test for missing values.


    x = new(1,float)    if(.not.ismissing(x).and.x.gt.5) then      print("x > 5")    end if
感觉我的脚本跟官网一样= =不知为啥错误,求大神解答。

密码修改失败请联系微信:mofangbao
发表于 2020-4-10 14:57:30 | 显示全部楼层
因为数据中有缺测。

在该if语句中,逻辑表达式的值将是missing,所以引发异常。 正确的判断是否为缺测的方式是使用 ismissing 函数。

参考:https://ncl.readthedocs.io/zh_CN/latest/language/loop.html
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

发表于 2017-6-29 09:41:44 | 显示全部楼层
同问啊,我也是这样报错,有没有大神知道是怎么回事啊?
密码修改失败请联系微信:mofangbao
发表于 2017-6-29 09:41:49 | 显示全部楼层
同问啊,我也是这样报错,有没有大神知道是怎么回事啊?
密码修改失败请联系微信:mofangbao
发表于 2017-10-24 11:30:18 | 显示全部楼层
WOYESHI
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2017-10-24 13:26:39 | 显示全部楼层
请问大神解决了吗?
密码修改失败请联系微信:mofangbao
发表于 2018-3-25 15:10:08 | 显示全部楼层
tongwen ya
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2018-5-22 16:55:20 | 显示全部楼层
数据格式问题
密码修改失败请联系微信:mofangbao
发表于 2025-1-15 10:03:23 | 显示全部楼层
这个错误出现的原因是使用判断语句时出现了缺省值,所以不用转为_FillValue,直接在计算的时候运用就好了        
    slp8 := num(tas_time_su8(:,i,j).lt.1)
      if (.not. ismissing(var(8,i,j)) .and. var(8,i,j) .lt. 1) then
        var1(8,i,j) = 1.0*slp8/n*100
      else
        var1(8,i,j) = 1.0*(n-slp8)/n*100
      end if
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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