- 积分
- 2979
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-3-17
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
大家好,我的问题是我用同样的脚本画过其他月份填色图,都没有问题,但是冬季的这张 会有一块儿没有填上色,数据检查无误,按理说 其他月份都画出来了应该脚本也没有问题,请教大家这是什么问题?谢谢大家。
脚本如下:
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/shapefile_mask_data.ncl"
begin
fwuhuan="D:/WR/awsnew/datainfo/wuhuan.txt"
data_wh=asciiread(fwuhuan, -1,"string")
lon_wh=todouble(str_get_field(data_wh,1," "))
lat_wh=todouble(str_get_field(data_wh,2," "))
hgt=asciiread("D:/WR/awsnew/position/geog_38.0N-43.0N_113.0E-120.0E.txt", (/501,701/), "float")
lon=fspan(113.0,120.0,701)
lat=fspan(38.0,43.0,501)
lat@long_name="Latitude"
lat@units="degrees_north"
lon@long_name="Longitude"
lon@units="degrees_east"
hgt!0="lat"
hgt!1="lon"
hgt&lat=lat
hgt&lon=lon
fname="D:/WR/MODEL/data/MonAve/208/ff2monthly/monthlyff2_winter.txt"
data=asciiread(fname, -1, "string")
;data=asciiread(fname, (/208,4/), "float")
sta_id =str_get_field(data,1," ")
lon_ff2 =tofloat(str_get_field(data,2," "))
lat_ff2 =tofloat(str_get_field(data,3," "))
spd =tofloat(str_get_field(data,4," "))
olon=fspan(115.2,117.6,241) ;1km 0.01
olat=fspan(39.2,41.2,201)
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees-east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
;-----------------------------------------插值---------------------
final=new((/201,241/),float) ;lat 201 lon 241
final!0="lat"
final!1="lon"
final&lat=olat
final&lon=olon
final=dsgrid2(lat_ff2,lon_ff2,spd,olat,olon)
final@_FillValue = 9999.0
;======================================
bjfile="bjqx.shp"
shpres=True
shpres@gsLineThicknessF=5
shpres@gsLineColor="grey"
data_mask= shapefile_mask_data(final,"D:/WR/awsnew/terrainfile/"+bjfile,shpres)
hgt_mask=shapefile_mask_data(hgt,"D:/WR/awsnew/terrainfile/"+bjfile,shpres)
;---------------------------------------------
wks_type="png"
wks_type@wkWidth=4500
wks_type@wkHeight=4500
wks = gsn_open_wks(wks_type,"D:/WR/MODEL/Ave/ff2ave/208/withhgt/png/ff2ave_winter")
res = True
res@gsnMaximize = True
res@gsnAddCyclic =False ;--是否要添加周期点使维圈完整, 不是全球数据设为 False
res@gsnMaximize =True ;--在工作台中尽可能大绘图(最大化绘图)
res@gsnDraw =False ;--如果设置为 False 则调用 gsn 函数时暂时不会画到工作台上
res@gsnFrame =False ;--如果设置为 False 则调用 gsn 函数时暂时不翻页, ; 常与 gsnDraw 配合用于多图层或一页多图绘图
;---------------------------------------MAP 设置----------------------------------
res@mpMinLatF =39.2 ;改经纬
res@mpMaxLatF =41.2
res@mpMinLonF =115.2
res@mpMaxLonF =117.6
res@mpFillOn = True
res@mpOutlineOn = False ;--打开地图轮廓,Use outlines from shapefile
res@mpDataBaseVersion ="MediumRes" ;--地图分辨率
res@mpDataSetName ="Earth..4" ;--选择地图集
res@mpLandFillColor = "white" ;--陆地填充颜色
res@mpOceanFillColor = "white" ;--海洋填充颜色
res@mpInlandWaterFillColor = "white" ;--内陆水面填充颜色
res@mpAreaMaskingOn = True ;设置为可以填充覆盖
res@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
res@mpNationalLineThicknessF= 2. ; double the thickness of national boundaries
;-------------------------------------------等值线的设置------------------------------
res@cnFillOn = True ;--设置填色
res@cnLinesOn = True ;--不画等值线
res@cnLineLabelsOn = False ;--不显示等值线数值
res@cnSmoothingOn = True ;--平滑线条
res@cnLevelSelectionMode ="ExplicitLevels"
res@cnLevels =(/0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5/)
res@cnExplicitLabelBarLabelsOn = True
;-------------------------------------------其他的设置
res@vpXF = 0 ;左边距
res@vpYF = 0
res@vpHeightF = 1.0
res@vpWidthF = 0.8
;-------------------------------------------标题
; res@tiMainString = "annual mean wind speed of "+monthname(ii)+" in Beijing" ; 改标题
; res@tiMainFontColor = "black"
; res@tiMainFontHeightF = 0.025
res@lbOrientation = "Vertical" ;--设置色标方向,水平或垂直
res@lbBoxLinesOn = True ;--关闭lbar box 线条 ,数字越大色标越靠下
res@tmXBLabelsOn = True ;打开tickMark的开关,否则后面设置的一系列都没有用!
res@tmYLLabelsOn = True
res@trYMinF = 39.2
res@trYMaxF = 41.2
res@trXMinF = 115.2
res@trXMaxF = 117.6
res@tmXBMode ="Explicit"
res@tmXBValues =(/115.2,115.8,116.4,117.0,117.6/)
res@tmXBLabels =(/"115.2","115.8","116.4","117.0","117.6~S~o~N~E"/)
res@tmYLMode ="Explicit"
res@tmYLValues =(/39.2,39.6,40.0,40.4,40.8,41.2/)
res@tmYLLabels =(/"39.2","39.6","40.0","40.4","40.8","41.2~S~o~N~N"/)
res@lbLabelBarOn = True ;LabelBar显示
res@lbLabelStrings = (/"0.5","1.0","1.5","2.0","2.5","3.0","3.5","4.0","4.5"/)
res@tmXBLabelDeltaF = -0.5 ;使其更靠近X轴
res@tmYLLabelDeltaF = -0.5
res@tmXBMajorLengthF = 0.01 ;刻度线长短
res@tmYLMajorLengthF = 0.01
res@tmXBMajorThicknessF = 5.0 ;刻度线粗细
res@tmYLMajorThicknessF = 5.0
res@tmXBMinorOn =False
res@tmYLMinorOn =False
res@tmXBLabelFontHeightF = 0.02 ;字体大小
res@tmYLLabelFontHeightF = 0.02
res@tmXBLabelFontThicknessF = 3
res@tmYLLabelFontThicknessF = 3
res@tmBorderThicknessF = 5.0 ;xy轴的线得粗细
reshgt =True
reshgt@gsnDraw =False ;--如果设置为 False 则调用 gsn 函数时暂时不会画到工作台上
reshgt@gsnFrame =False
reshgt@cnLevelSelectionMode ="ExplicitLevels"
reshgt@cnLevels =(/300,500,800,1000,1200,1500,2000/)
reshgt@cnFillOn = False ;--设置填色
reshgt@cnLinesOn = True ;--不画等值线
reshgt@cnLineLabelsOn = True ;--不显示等值线数值
reshgt@cnInfoLabelOn = False ;关闭右下角的标签是这个。。
reshgt@cnSmoothingOn = True ;--平滑线条
reshgt@cnLineLabelPerimOn =False
reshgt@cnLineThicknessF =5
reshgt@cnLineColor ="black"
reshgt@cnLineLabelPerimOn =False
reshgt@cnLineLabelDensityF =1.5
reshgt@cnLineLabelFontHeightF =0.01
reshgt@cnLineLabelBackgroundColor =-1
;---------------------------create plots for masked data
map_BJ_mask=gsn_csm_contour_map(wks,data_mask,res)
wrf_smooth_2d(hgt_mask,8)
second_plot=gsn_csm_contour(wks,hgt_mask,reshgt)
;add 五环
lnres =True
lnres@gsLineColor ="red"
lnres@gsLineThicknessF=10.0
lnres@gsLineDashPattern =5
Polygon=gsn_add_polyline(wks,map_BJ_mask,lon_wh,lat_wh,lnres)
;------------------------------add shapeline outlines
shpline12=gsn_add_shapefile_polylines(wks,map_BJ_mask,"D:/WR/awsnew/terrainfile/"+bjfile,shpres)
overlay(map_BJ_mask,second_plot)
draw(map_BJ_mask)
frame(wks)
end
图如下
|
|