请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 8451|回复: 5

[其他] NCL6.3.0使用advect_variable出错

[复制链接]

新浪微博达人勋

发表于 2018-3-29 15:26:43 | 显示全部楼层 |阅读模式

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

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

x
我想画温度平流,然后看到官网有计算平流的函数 http://www.ncl.ucar.edu/Document ... vect_variable.shtml结果我借鉴了第一个例子之后就出错了
fatal:Undefined identifier: (advect_variable) is undefined, can't continue
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 51 in file temadv.ncl

贴上代码,中间那一大段是我转换的时间~有大神可以帮我瞅一下吗
  1. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  2. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
  3. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

  4. begin
  5.    ;Units: u*(dT/dlon) + v(dT/dlat)->(m/s)*(K/m) => K/s. If T were degC, the units would be C/s.

  6.    ft = addfile ("airmultiple.nc", "r")
  7.    fu = addfile ("uwnd.2018.nc", "r")
  8.    fv = addfile ("vwnd.2018.nc", "r")
  9.    level = ft->level
  10.    time = ft->time
  11.    u = fu->uwnd    ; (time,lev,lat,lon); m/s
  12.    v = fv->vwnd
  13.    T = ft->air    ; degK
  14.    print(level)

  15. wks = gsn_open_wks("png","temperature_advection")

  16.              ; Array to hold month abbreviations. Don't store anything in index
  17.              ; '0' (i.e. let index 1=Jan, 2=Feb, ..., index 12=Dec).

  18.    month_abbr = (/"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", \
  19.                     "Oct","Nov","Dec"/)

  20.             ; Time values and units.

  21.     time = ispan(1910952,1912986,6)
  22.     time@units = "hours since 1800-01-01 00:00:0.0"

  23.             ; Convert to UTC time.

  24.    utc_date = cd_calendar(time, 0)
  25.                   ; Store return information into more meaningful variables.
  26.    year   = tointeger(utc_date(:,0))    ; Convert to integer for
  27.    month  = tointeger(utc_date(:,1))    ; use sprinti
  28.    day    = tointeger(utc_date(:,2))
  29.    hour   = tointeger(utc_date(:,3))
  30.    minute = tointeger(utc_date(:,4))
  31.    second = utc_date(:,5)

  32.            ; Write out strings in the format "hhZ dd mmm yyyy".

  33.    date_str = sprinti("%0.2iZ ", hour) + sprinti("%0.2i ", day) + \
  34.               month_abbr(month) + " "  + sprinti("%0.4i", year)

  35.    print(date_str)
  36.               
  37. ; Return the advected variable only (opt=0)

  38.    advT_0 = advect_variable(u,v,T,0,"advection of temperature","K/s",0)

  39.    printVarSummary(advT_0)


  40. ; Return the advected variable and the longitudinal (dT/dx) and latitudinal (dT/dy) gradients
  41. ; of the scalar variable (opt=1). The returned variable is of type list containing three variable

  42.    advT_1 = advect_variable(u,v,T,0,"advection of temperature","K/s",1)
  43.    printVarSummary(advT_1)  ; variable of type list: 3 items

  44. ; For clarity: explicitly extract the returned elements of the list variable. All meta data is present.

  45.    Tadv = advT_1[0]           ; advected quantity
  46.    Tgrx = advT_1[1]           ; longitudinal gradient
  47.    Tgry = advT_1[2]           ; latitudinal  gradient
  48.    printVarSummary(Tadv)    ; advection of temperature
  49.    printVarSummary(Tgrx)    ; longitudinal gradient
  50.    printVarSummary(Tgry)    ; latitudinal gradient
  51. end
复制代码




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

新浪微博达人勋

 楼主| 发表于 2018-3-29 15:27:00 | 显示全部楼层
{:eb302:}{:eb302:}先谢谢大家
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-3-29 15:51:36 | 显示全部楼层
emmmmm
解决了……我去/lib/ncarg/nclscripts/csm/contributed.ncl看了看
里面没有advect_variable,只有advect_var
换成advect_var就可以了……………………
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-8-26 17:25:22 | 显示全部楼层
所以请问这个计算温度平流的前面不需要加负号了嘛 还有你这个是什么数据呀
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-9-28 16:11:52 | 显示全部楼层
同问楼主,用这个算了还需要加负号吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-10-5 20:57:23 | 显示全部楼层
不会游泳的fish 发表于 2019-9-28 16:11
同问楼主,用这个算了还需要加负号吗?

请问你温度平流算出来了吗
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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