- 积分
- 4422
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-5-18
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 阿羊出没请注意 于 2022-4-1 10:12 编辑
在绘制24累计降水量时,画出来的图经纬度是斜着的
我想画成经纬度是直线的,类似于这样
在家园搜索了很久,试了rcm2rgrid方法,也试了用gsn_csm_contour_map代替wrf函数画map的方法,都失败了。
求大神看看问题出在哪里,下面附上我的脚本。
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "./WRFUserARW.ncl"
begin
;
; 读取数据
DATADir = "F:/work3_dblw_LLP/NSLL/"
FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d02_2021-06-02*")
numFILES = dimsizes(FILES)
a = addfiles(FILES+".nc","r")
times = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
lat2d= wrf_user_getvar(a, "XLAT", 0) ;lat is 3d,should change to 2d,第三维选择时间为0.如果-1就是三维
lon2d= wrf_user_getvar(a, "XLONG", 0)
rain_exp = wrf_user_getvar(a,"RAINNC",-1)
rain_con = wrf_user_getvar(a,"RAINC",-1)
;插值
lat = fspan(25,55,120)
lon = fspan(110,140,120) ; create longitudes or read from file ; 6values
rain_exp_grd = rcm2rgrid(lat2d, lon2d, rain_exp, lat, lon, 0)
rain_con_grd = rcm2rgrid(lat2d, lon2d, rain_con, lat, lon, 0)
rain_tot_grd = rain_exp_grd+rain_con_grd
rain_tot_hour=rain_tot_grd
rain_tot_hour@description = "Total Precipitation"
;画图
wks = gsn_open_wks("png","Precip_NSLL_24hourly_grid_62")
res = True
res@MainTitle = "REAL-TIME WRF" ;在左上角的标题
res@mpProjection = "Mercator"
pltres = True
mpres = True
mpres@mpGeophysicalLineColor = "Black"
mpres@mpNationalLineColor = "Black"
mpres@mpUSStateLineColor = "Black"
mpres@mpGridLineColor = "Black"
mpres@mpLimbLineColor = "Black"
mpres@mpPerimLineColor = "Black"
mpres@mpGridSpacingF = 10
mpres@pmTickMarkDisplayMode = "Always"
mpres@tmYROn = False
mpres@tmYLOn = True
mpres@tmXBOn = True
mpres@tmXTOn = False
;==============================================
mpres@mpOutlineBoundarySets = "National" ; turn on country boundaries
mpres@mpOutlineSpecifiers = (/"China:states","Taiwan"/)
mpres@mpDataSetName = "Earth..4"
mpres@mpDataBaseVersion = "MediumRes"
mpres@mpGeophysicalLineColor = "Black"
mpres@mpNationalLineColor = "Black"
mpres@mpFillAreaSpecifiers = (/"China"/)
mpres@mpSpecifiedFillColors = (/"White"/)
mpres@mpGeophysicalLineThicknessF = 2.0 ; for Offshore Line thickness
mpres@mpNationalLineThicknessF = 2.0 ; for National Line thickness
; mpres@gsnAddCyclic =False
mpres@mpGridLatSpacingF = 10 ; grid line spacing on plot
mpres@mpGridLonSpacingF = 10
mpres@pmTickMarkDisplayMode = "Always" ; display tick marks
mpres@tmXTLabelsOn = False ; turn off tick-marks labels at top of plot
mpres@tmYRLabelsOn = False ; trun off tick-marks labels at right of plot
mpres@tmXTOn = False ; turn off top tick marks
mpres@tmYROn = False; turn off right tick marks
mpres@mpGridAndLimbOn = True ; set to true if you want grid lines to show
mpres@mpGridLineDashPattern = 2 ; make grid lines dash
mpres@mpLimbLineColor = "Black"
mpres@mpPerimLineColor = "Black"
mpres@mpCountyLineThicknessF = 2.
mpres@mpProvincialLineThicknessF = 1.
;计算24h累计降水,因为逐10min输出一次,所以一共144个文件
do it =143,ntimes-1,143 ; Let's skip the first time as rain is 0 here
rain_tot_hour(143,:,:)=rain_tot_grd(it,:,:)-rain_tot_grd(it-143,:,:)
print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots
; Plotting options for Precipitation
opts_r = res
opts_r@UnitLabel = "mm"
opts_r@cnLevelSelectionMode = "ExplicitLevels"
opts_r@cnLevels = (/ .1, .5, 1, 2, 3, 4, 5, \
6, 8, 10, 20, 40, 60/)
; cmap = read_colormap_file("BlGrYeOrReVi200")
opts_r@cnFillColors = (/"White","royal blue","DeepSkyBlue", \
"Chartreuse3","Green","ForestGreen", \
"Yellow","gold","Orange","OrangeRed","Red","firebrick","Violet"/)
opts_r@cnConstFLabelOn = False
opts_r@cnFillOn = True
contour_tot = wrf_contour(a[it],wks, rain_tot_hour(it,:,:), opts_r)
opts_r@SubFieldTitle = "from " + times(it-1) + " to " + times(it)
opts_r@cnFillOn = False
opts_r@cnLineColor = "Red4"
delete(opts_r)
; MAKE PLOTS
; Total Precipitation
plot = wrf_map_overlays(a[it],wks,contour_tot,pltres,mpres)
end do
end
|
|