爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6687|回复: 6

mask海洋后出现缺测

[复制链接]

新浪微博达人勋

发表于 2018-5-21 20:56:30 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

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之前

mask后

mask后

corr.ncl

3.58 KB, 下载次数: 3, 下载积分: 金钱 -5

脚本

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-10-13 21:10:33 | 显示全部楼层
您好,请问您解决这个问题了吗?我也遇到类似的问题,请问怎么解决的呀?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-10-15 09:04:00 | 显示全部楼层
雨辰lalalala 发表于 2019-10-13 21:10
您好,请问您解决这个问题了吗?我也遇到类似的问题,请问怎么解决的呀?

换个NCL版本
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-10-18 22:42:47 | 显示全部楼层

按照您说的,换了个ncl版本,还是不行
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-10-19 21:08:08 | 显示全部楼层
雨辰lalalala 发表于 2019-10-18 22:42
按照您说的,换了个ncl版本,还是不行

在尝试了几个版本之后,终于成功了,感谢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-10-19 21:37:01 | 显示全部楼层

回复错地方了 在尝试了几个版本之后 终于成功了 感谢感谢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表