- 积分
- 755
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2024-1-17
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我的pre.ncl
;**********************************************************sum pre
;**********************************************************
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
begTime = get_cpu_time()
;diri_constant= "/home/xzk/data/"
;a = addfile("E:\521618\cloudwrf\data\wrfout_d03_2016-07-31_06_00_00","r")
;b = addfile("E:\521618\cloudwrf\data\wrfout_d03_2016-08-01_02_00_00.nc","r")
a = addfile("/THL8/home/wanglz/syau_fzr/WRFV4.5.1/run/wrfout_d03_2016-07-31_06:00:00","r")
b = addfile("/THL8/home/wanglz/syau_fzr/WRFV4.5.1/run/wrfout_d03_2016-08-01_10:00:00","r")
lon2d = a->XLONG(0,:,:)
lat2d = a->XLAT(0,:,:)
lat = lat2d(:,0) ;; Xarray of latitudes
lon = lon2d(0,:) ;; Xarray of Longitudes
times = wrf_user_list_times(a)
timest = wrf_user_list_times(b)
minLat = 41;min(lat)
maxLat = 46;max(lat)
minLon = 78;min(lon)
maxLon = 86;max(lon)
;calculate the total precipitation
rain1 = wrf_user_getvar(a,"RAINNC",-1)
;rain2 = wrf_user_getvar(a,"RAINC",-1)
; rain3 = wrf_user_getvar(a,"RAINSH",-1)
rain1b = wrf_user_getvar(b,"RAINNC",-1)
; rain2b = wrf_user_getvar(b,"RAINC",-1)
; rain3b = wrf_user_getvar(b,"RAINSH",-1)
dim_sizes=dimsizes(rain1)
NT = dim_sizes(0)
NY = dim_sizes(1)
NX = dim_sizes(2)
deltaRain1 = rain1b(NT-1,:,:) - rain1(NT-1,:,:)
; deltaRain2 = rain2b(NT-1,:,:) - rain2(NT-1,:,:)
; deltaRain3 = rain3b(NT-1,:,:) - rain3(NT-1,:,:)
rain_tot = deltaRain1; + deltaRain2 + deltaRain3
delete(rain1)
; delete(rain2)
rain_tot!0 = "lat"
rain_tot!1 = "lon"
rain_tot&lat = lat
rain_tot&lon = lon
rain_tot@description = "Precipitation"
rain_tot@units = "mm"
; create a window
fig_name = "precipitaion_"+times(0)+"-"+timest(NT-1)+"UTC.png"
wks = gsn_open_wks("png",fig_name)
;define colormap
cmap = (/ (/255, 255, 255/), \
(/0, 0,0/), \
(/242, 255, 255/), \
(/242, 242, 242/), \
(/154, 192, 205/), \
(/178, 223, 238/), \
(/191, 239, 255/), \
(/ 0, 235, 235/), \
(/ 0, 163, 247/), \
(/ 0, 255, 0/), \
(/ 0, 199, 0/), \
(/ 0, 143, 0/), \
(/ 0, 63, 0/), \
(/255, 255, 0/), \
(/255, 143, 0/), \
(/255, 0, 0/), \
(/215, 0, 0/), \
(/191, 0, 0/), \
(/255, 0, 255/), \
(/155, 87, 203/), \
(/ 92, 52, 176/) /) /255.0
gsn_define_colormap(wks,cmap)
;gsn_define_colormap(wks,"Rainbow")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnAddCyclic = False
res@mpFillOn = False
res@mpMaxLatF = maxLat ; specify the plot domain
res@mpMinLatF = minLat ;
res@mpMaxLonF = maxLon ;
res@mpMinLonF = minLon
res@tiMainString = "Precipitation: "+times(0)+" to "+timest(0)+"UTC"
res@tiMainFontHeightF = 0.013
res@gsnLeftStringFontHeightF = 0.012
res@gsnRightStringFontHeightF = 0.012
res@cnLevelSelectionMode = "ManualLevels"
res@cnLevelSpacingF = 10
res@cnMinLevelValF = 0
res@cnMaxLevelValF = 100
res@cnFillOn = True
res@cnLinesOn = False
res@lbLabelAutoStride = True
res@cnFillDrawOrder = "PreDraw"
res@cnInfoLabelOn = False
res@lbLabelBarOn = True ; 色标
res@pmLabelBarHeightF = 0.15
res@pmLabelBarWidthF = 0.6
res@pmLabelBarOrthogonalPosF = 0.07
res@lbLabelFontHeightF = 0.010
res@cnInfoLabelOn = False ; 去掉图底端的标签信息
lon_value = fspan(minLon, maxLon, 5)
lon_label = lon_value + "~S~o~N~E"
res@tmXBMode = "Explicit"
res@tmXBValues = lon_value
res@tmXBLabels = lon_label
res@tmXBLabelFontHeightF = 0.01
lat_value = fspan(minLat, maxLat , 5)
lat_label = lat_value + "~S~o~N~N"
res@tmYLValues = lat_value
res@tmYLLabels = lat_label
;; plot
map_res = res
map_res@mpDataSetName = "Earth..4"
map_res@mpDataBaseVersion = "MediumRes"
map_res@mpOutlineOn = True
map_res@mpOutlineSpecifiers = (/"China","China:Provinces"/)
map_res@mpGeophysicalLineThicknessF = 1
map_res@mpNationalLineThicknessF = 1
outlcol = "black"
map_res@mpNationalLineColor = outlcol
map_res@mpProvincialLineColor = outlcol
map_res@mpGeophysicalLineColor = outlcol
map_res@mpFillDrawOrder = "PreDraw"
map_res@mpFillOn = False
map_res@gsnMaximize = True
plot = gsn_csm_contour_map(wks,rain_tot,res)
draw(plot)
frame(wks)
print("Time Required " + (get_cpu_time() - begTime) + " seconds")
end
问题是在服务器中运行显示报错为
fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 108 in file /THL8/software/ncl/ncl_ncarg-6.6.2/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 2172 in file /THL8/software/ncl/ncl_ncarg-6.6.2/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 22 in file pre.ncl
22行内容是timest = wrf_user_list_times(b)。
我用Piggy_NCL运行pre.ncl画出的没有国家线,这是怎么回事啊
|
|