- 积分
- 1901
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-1-6
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-5-3 14:30:08
|
显示全部楼层
本帖最后由 xuebiz 于 2016-5-3 14:38 编辑
运算之后,坐标变量丢失了,根据这个帖子,在官网查到下面2个功能,都可以从已有变量那里复制所需坐标变量回来~~
http://bbs.06climate.com/forum.php?mod=viewthread&tid=18354
好好学习,天天向上!
------------------------------------------------------------------------------------
copy_VarCoords
Copies all named dimensions and coordinate variables from one variable to another.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
procedure copy_VarCoords (
var_from ,
var_to
)
Examples
Example 1
;---read in netCDF file and read in data
cdf_file = addfile("slp.1963.nc","r")
slp = cdf_file->slp(:,::-1,:) ; slp has coordinate arrays
newslp = ((slp*slp@scale_factor)+slp@add_offset)*.01 ; newslp won't have any coordinate arrays
copy_VarCoords(slp,newslp) ; copy coordinate arrays from slp to newslp
-------------------------------------------------------------------------------------------------------------------------------------------
copy_VarMeta
Copies all attributes, named dimensions and coordinate variables from one variable to another.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
procedure copy_VarMeta (
var_from ,
var_to
)
Examples
Example 1
;---read in zonal winds
a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")
u = a->U(1,:,:)
v = a->V(1,:,:)
spd = sqrt(u^2+v^2) ; spd won't have any metadata
copy_VarMeta(u,spd) ; Copy metadata from u to spd |
|