- 积分
- 3442
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-7-27
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
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
贴上代码,中间那一大段是我转换的时间~有大神可以帮我瞅一下吗
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
- begin
- ;Units: u*(dT/dlon) + v(dT/dlat)->(m/s)*(K/m) => K/s. If T were degC, the units would be C/s.
- ft = addfile ("airmultiple.nc", "r")
- fu = addfile ("uwnd.2018.nc", "r")
- fv = addfile ("vwnd.2018.nc", "r")
- level = ft->level
- time = ft->time
- u = fu->uwnd ; (time,lev,lat,lon); m/s
- v = fv->vwnd
- T = ft->air ; degK
- print(level)
- wks = gsn_open_wks("png","temperature_advection")
- ; Array to hold month abbreviations. Don't store anything in index
- ; '0' (i.e. let index 1=Jan, 2=Feb, ..., index 12=Dec).
- month_abbr = (/"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", \
- "Oct","Nov","Dec"/)
- ; Time values and units.
- time = ispan(1910952,1912986,6)
- time@units = "hours since 1800-01-01 00:00:0.0"
- ; Convert to UTC time.
- utc_date = cd_calendar(time, 0)
- ; Store return information into more meaningful variables.
- year = tointeger(utc_date(:,0)) ; Convert to integer for
- month = tointeger(utc_date(:,1)) ; use sprinti
- day = tointeger(utc_date(:,2))
- hour = tointeger(utc_date(:,3))
- minute = tointeger(utc_date(:,4))
- second = utc_date(:,5)
- ; Write out strings in the format "hhZ dd mmm yyyy".
- date_str = sprinti("%0.2iZ ", hour) + sprinti("%0.2i ", day) + \
- month_abbr(month) + " " + sprinti("%0.4i", year)
-
- print(date_str)
-
- ; Return the advected variable only (opt=0)
- advT_0 = advect_variable(u,v,T,0,"advection of temperature","K/s",0)
- printVarSummary(advT_0)
- ; Return the advected variable and the longitudinal (dT/dx) and latitudinal (dT/dy) gradients
- ; of the scalar variable (opt=1). The returned variable is of type list containing three variable
- advT_1 = advect_variable(u,v,T,0,"advection of temperature","K/s",1)
- printVarSummary(advT_1) ; variable of type list: 3 items
- ; For clarity: explicitly extract the returned elements of the list variable. All meta data is present.
- Tadv = advT_1[0] ; advected quantity
- Tgrx = advT_1[1] ; longitudinal gradient
- Tgry = advT_1[2] ; latitudinal gradient
- printVarSummary(Tadv) ; advection of temperature
- printVarSummary(Tgrx) ; longitudinal gradient
- printVarSummary(Tgry) ; latitudinal gradient
- end
复制代码
|
|