- 积分
- 363
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-11-6
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2017-7-28 10:49:01
|
显示全部楼层
嗯嗯,十分感谢,昨天还一直想着有没有这样的函数,结果我是用较笨的方法对它进行转换;
脚本如下:
;数据的转换,传统方式(复杂:将元数据保留)
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
f = addfile("/home/zkf/paper/Gt/data/sst_new.nc","r")
sst = f->sst
time = f->time
lat = f->latitude
lon = f->longitude
sst!0 = "time"
sst!1 = "lat"
sst!2 = "lon"
sst&time = time
sst&lat = lat
sst&lon = lon
;************************************************
; interpolate to new grid
;***********************************************
mtime = dimsizes(time)
mlat = dimsizes(lat)
mlon = dimsizes(lon)
array = new((/mtime,mlat,mlon/),float)
xlon = fspan(0.5,359.5,360)
copy_VarMeta(lon,xlon)
array(:,:,0:(mlon/2-1)) = sst(:,:,(mlon/2):(mlon-1))
array(:,:,(mlon/2):(mlon-1)) = sst(:,:,0:(mlon/2-1))
array!0 = "TIME"
array!1 = "LAT"
array!2 = "LON"
array&TIME = time
array&LAT = lat
array&LON = xlon
fout = addfile("/home/zkf/paper/Gt/data/sst.nc","c")
fout->SST = array
end
不过这个脚本也让我对数组更加熟悉一点。
|
|