- 积分
- 5322
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-4-26
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
和官网给的图对比完全一致,借鉴了前人做的0.5*0.5的数据,改一改就成0.1*0.1的了
- ;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"
- begin
-
- ;fName = "2019082000.grd"
- myfile = systemfunc("ls *.grd")
- nfile = dimsizes(myfile)
-
- nlat = 450 ; YDEF
- mlon = 700
- ntime = nfile
- ; XDEF
- ; create an array to contain data
- rain = new ( (/nlat,mlon/), double)
- hour_rain = new ( (/ntime,nlat,mlon/), double)
- ;rain@units = "0.1mm"
- do i=0, nfile-1
- setfileoption("bin","ReadByteOrder","LittleEndian")
-
- rain(:,:) = fbindirread(myfile(i),0, (/nlat,mlon/), "float")
- hour_rain(i,:,:) = rain(:,:)
- rain = 0
- ;print(myfile(i))
- end do
-
- printVarSummary(hour_rain)
- printMinMax(hour_rain, 1)
- lat=15+ispan(0,nlat-1,1)*0.1
- lon=70+ispan(0,mlon-1,1)*0.1
- time = ispan(0, nfile-1, 1)
- lat!0= "lat"
- lat@long_name = "latitude"
- lat@units = "degrees_north"
- lon!0= "lon"
- lon@units = "degrees_east"
- lon@long_name = "longitude"
- rain!0 = "lat"
- rain!1 = "lon"
- rain&lat = lat
- rain&lon = lon
- rain@_FillValue =-999
- time!0= "time"
- time@long_name = "time"
- time@units = "hour"
- hour_rain!0 = "time"
- hour_rain!1 = "lat"
- hour_rain!2 = "lon"
- hour_rain&time = time
- hour_rain&lat = lat
- hour_rain&lon = lon
- hour_rain@_FillValue =-999
- sumrain = dim_sum_n(hour_rain, 0)
- copy_VarMeta(rain, sumrain)
- printMinMax(sumrain, 1)
- delete(hour_rain)
- ;print(lat)
- ;smthrain = smth9(sumrain, 0.5, 0.25, False)
- ;copy_VarMeta(rain, smthrain)
- delete(rain)
- wks = gsn_open_wks("pdf","00") ; Open a workstation
- gsn_define_colormap(wks,"precip3_16lev") ; define a different colormap.
- res = True
- res@gsnAddCyclic = False
- res@gsnDraw = False
- res@gsnFrame = False
- res@gsnRightString = "mm/day"
-
- ; Don't draw yet
- res@mpDataSetName = "Earth..4" ; This new database contains
- ; divisions for other countries.
- res@mpDataBaseVersion = "MediumRes" ; High resolution database
- res@mpOutlineOn = True ; Turn on map outlines
- res@mpOutlineSpecifiers = (/"China:states","Taiwan"/) ;China:states
- res@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
- res@mpNationalLineThicknessF= 2. ; double the thickness of national boundaries
- ;res@mpProjection = "LambertConformal"
- res@mpLambertMeridianF = 105.0
- res@mpLimitMode = "LatLon"
- res@cnFillOn = True
- res@cnSmoothingOn = True
- res@cnSmoothingDistanceF = 0.01
- res@cnSmoothingTensionF = 2.5
- res@cnLevelSelectionMode = "ExplicitLevels"
- res@cnLevels = (/0.1,10,20,30,40,50,60,70,80,90,100,110/)
- ;res@cnFillColors = (/0,128,96,64,48,32,144,160,176,192,208,244,255/)
- res@mpMinLatF = 20 ; Asia limits
- res@mpMaxLatF = 30
- res@mpMinLonF = 100
- res@mpMaxLonF = 112
- res@mpAreaMaskingOn = True
- res@mpMaskAreaSpecifiers = (/"China:states","Taiwan"/) ;China:states
- res@mpOceanFillColor = 0
- res@mpInlandWaterFillColor = 0
- res@cnFillOn = True
- res@cnFillMode="AreaFill"
- ;res@cnRasterSmoothingOn = True
- res@cnConstFEnableFill=False
- res@cnLinesOn =False
- res@cnLineLabelsOn = False
- ;res@cnFillDrawOrder = "PreDraw" ; draw contours first
- res@lbLabelBarOn = True ;
- res@tiMainFont = "helvetica"
- res@tiMainOffsetYF = 0.02 ;set place for main title along Y,offset
- res@tiMainFontHeightF = 0.02 ;set main title font size
- res@tiMainString = "rain"
- plot= gsn_csm_contour_map(wks,sumrain,res)
- lat1 = (/25.7,27.3,27.3,25.7,25.7/)
- lon1 = (/103,103,105.5,105.5,103/)
- plres = True
- plres@gsLineThicknessF = 2.0
- plres@gsLineColor = "grey20"
- plot_1 = gsn_add_polyline(wks, plot, lon1, lat1, plres)
- draw(plot)
- ;frame(wks)
- end
复制代码 |
|