- 积分
- 20093
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-2-16
- 最后登录
- 1970-1-1
|
发表于 2018-7-30 09:35:21
|
显示全部楼层
http://www.ncl.ucar.edu/Document ... les.shtml#StringRef
String references
Sometimes it is impossible to know the names of the attributes and coordinates before writing a script, or these names may vary from variable to variable. To solve this problem, string variables can be used to reference attributes and coordinates by enclosing the variable reference within dollar signs '$'. The following are examples of this:
dimnames = (/"frtime","lat","lon"/)
attnames = (/"_FillValue", "long_name"/)
;
; access to attribute
;
att0 = temperature@$attnames(0)$
;
; Example of referencing a coordinate variable
; without knowing the dimension name
;
if(iscoord(dimnames(0))
coord0 = temperature&$temperature!0$
end if |
|