- 积分
- 6320
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-4-18
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在使用landsea_mask函数后陆地部分出现缺测,请问如何解决?
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/cnmap/cnmap.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
;***********Get list of files from years 1979 to 2016*************
yyyy = ispan(1979,2016,1)
all_files = "d:/data/era/skt/"+yyyy+"skt.nc"
fall = addfiles (all_files, "r")
ListSetType (fall, "cat") ;Read "pottmp" in "cat" mode and print a summary of the variable
skt = fall[:]->skt ;note syntax [:]
sktt = short2flt(skt)
tmp1 = month_to_season(sktt, "DJF")
;printVarSummary(tmp1)
tmp2 = asciiread("d:/data/pdsi/1979DJFaoi.txt",-1,"float")
tmp2!0 = "time"
;****** calculate correlation coefficent *****
r = escorc(tmp2,tmp1(latitude|:,longitude|:,time|:))
copy_VarCoords(tmp1(0,:,:),r)
;******* calculate t-value **************
t = new((/241,480/),float)
t = sqrt(38-2)*r/(sqrt(1-r^2)) ;years=38,freedgree=38-2
copy_VarCoords(tmp1(0,:,:),t)
;printVarSummary(r)
;****** make the land ********************
a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r")
lsdata = a->LSMASK
lsm = landsea_mask(lsdata,r&latitude,r&longitude)
r_land = mask(r,lsm.eq.0,False)
t_land = mask(t,lsm.eq.0,False)
copy_VarMeta(r,r_land)
copy_VarMeta(t,t_land)
;************************************************
; plot the correlations
;************************************************
wks = gsn_open_wks("x11","globe")
gsn_define_colormap(wks,"ncl_default")
res = True ; make plot mods
res@gsnMaximize = False
res@gsnDraw = False
res@gsnFrame = False
res@gsnAddCyclic = True
res@cnFillOn = True ; turn on color
res@cnLinesOn = False ; turn off contour lines
;res@cnFillDrawOrder = "PreDraw"
res@cnSmoothingOn = True
res@vpHeightF = 0.4
res@vpWidthF = 0.7
res@mpFillOn = True ; turn on color fill
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = ispan(-6,6,1)/10.
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes" ; "MediumRes" ; or "Ncarg4_1"
res@mpAreaMaskingOn = True
res@tiMainString = "corre of skt(DJF) & AOi(DJF) "
res@tiMainFont = 25
ores=True
ores@gsnMaximize = False
ores@gsnDraw = False
ores@gsnFrame = False
ores@gsnSpreadColors = True
ores@cnFillOn = False
ores@cnLinesOn = False
ores@cnLineLabelsOn = False
ores@cnSmoothingOn = True
ores@gsnAddCyclic = True
;ores@cnFillDrawOrder = "PreDraw"
ores@vpHeightF = 0.4
ores@vpWidthF = 0.7
ores@cnInfoLabelOn = False
ores@lbLabelBarOn = False
plot = gsn_csm_contour_map(wks,r_land,res)
plot1 = gsn_csm_contour(wks,t_land,ores)
ropt1 = True
ropt1@gsnShadeFillType = "pattern" ; pattern fill
ropt1@gsnShadeLow = 17
ropt1@gsnShadeHigh = 17
;ropt1@gsnShadeFillDotSizeF = 10
plot1 = gsn_contour_shade(plot1,-2.42,2.42,ropt1)
overlay(plot,plot1)
draw(plot)
frame(wks)
end
|
-
mask之前
-
mask后
-
-
corr.ncl
3.58 KB, 下载次数: 3, 下载积分: 金钱 -5
脚本
|