- 积分
- 1910
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-6-7
- 最后登录
- 1970-1-1
|
1金钱
我先提取了RegCM模拟结果的温度数据,并处理成月平均数据,求了月最大最小温度,并将其放在一个nc文件中,在利用ncl官网上的脚本改动后进行画图。
但是图出来就只是一条直线,图例也没有出来,也没有报错信息。
贴出了脚本,求助大家!
;*************************************************************
;This script is XYplot picture of Regcm,
;which about 10years templature of Model-out with time.
;*************************************************************
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"
;*************************************************************
;*************************************************************
;读取处理好的月平均后的区域平均温度数据。
;*************************************************************
fils1 = systemfunc("ls EIN15ATM??.nc")
fils2 = systemfunc("ls EIN75ATM??.nc")
fils3 = systemfunc("ls ERA40ATM??.nc")
fils4 = systemfunc("ls ICBCATM??.nc")
f1 = addfiles(fils1,"r")
f2 = addfiles(fils2,"r")
f3 = addfiles(fils3,"r")
f4 = addfiles(fils4,"r")
ListSetType(f1,"cat")
ListSetType(f2,"cat")
ListSetType(f3,"cat")
ListSetType(f4,"cat")
T1 = f1[:]->temp
T2 = f2[:]->temp
T3 = f3[:]->temp
T4 = f4[:]->temp
T1_MIN = f1[:]->t_min
T1_MAX = f1[:]->t_max
T2_MIN = f2[:]->t_min
T2_MAX = f2[:]->t_max
T3_MIN = f3[:]->t_min
T3_MAX = f3[:]->t_max
T4_MIN = f4[:]->t_min
T4_MAX = f4[:]->t_max
nmonths = 96
times = ispan(0,95,1)
gavan = new((/10,nmonths/),float)
gavan(0,:) = T1-avg(T1)
gavan(1,:) = T2-avg(T2)
gavan(2,:) = T3-avg(T3)
gavan(3,:) = T4-avg(T4)
gavan(4,:) = T1_MIN-avg(T1)
gavan(5,:) = T1_MAX-avg(T1)
gavan(6,:) = T2_MIN-avg(T2)
gavan(7,:) = T2_MAX-avg(T2)
gavan(8,:) = T3_MIN-avg(T3)
gavan(9,:) = T3_MAX-avg(T3)
gavan!0 = "ensembles"
gavan!1 = "time"
gavan&time = (/times/)
gavan&ensembles = (/0,1,2,3,4,5,6,7,8,9/)
;*********************************************************
;开始画图
;**********************************************************
wks = gsn_open_wks("x11","templature-late8yr")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@vpHeightF = 0.4
res@vpWidthF = 0.7
res@trYMaxF = 10
res@trYMinF = -10
res@trXMinF = 1992
res@trXMaxF = 1999
res@xyMonoLineColor = False
res@xyLineColors = (/"Black","Red","Blue","Yellow"/)
res@xyLineThicknesses = (/3.,3.,3.,4./)
res@xyDashPatterns = (/0.,0.,0.,0./)
res@tiYAxisString = "~F35~J~F~C"
res@txFontHeightF = 0.0195
top_plot = gsn_csm_xy (wks,times,gavan(0:3,:),res)
;*******************************************************************************
;将模拟结果中最大值、最小值曲线之间的部分填色。
;*******************************************************************************
res@gsnXYFillColors = "LightPink"
res@xyLineColor = -1
bot_plot = gsn_csm_xy (wks,times,gavan(4:5,:),res)
res@gsnXYFillColors = "LightBlue"
res@xyLineColor = -1
mid1_plot = gsn_csm_xy (wks,times,gavan(6:7,:),res)
res@gsnXYFillColors = "LightYellow"
res@xyLineColor = -1
mid2_plot = gsn_csm_xy (wks,times,gavan(8:9,:),res)
overlay(bot_plot,mid1_plot)
overlay(bot_plot,mid2_plot)
overlay(bot_plot,top_plot)
;***********************************************************************************
; 创建图例
;***********************************************************************************
res_text = True
res_text@txFontHeightF = 0.015
res_text@txJust = "TopLeft"
res_lines = True
res_lines@gsLineDashPattern = 0.
res_lines@gsLineThicknessF = 5.
res_lines@gsLineColor = "black"
xx = (/1992,1999/)
yy = (/0.705,0.705/)
dum1 = gsn_add_polyline(wks,bot_plot,xx,yy,res_lines)
dum2 = gsn_add_text(wks,bot_plot,"Obs",1910,0.705,res_text)
yy = (/0.79,0.79/)
res_lines@gsLineColor = "red"
dum3 = gsn_add_polyline(wks,bot_plot,xx,yy,res_lines)
dum4 = gsn_add_text(wks,bot_plot,"IN15",1910,0.79,res_text)
yy = (/0.875,0.875/)
res_lines@gsLineColor = "blue"
dum5 = gsn_add_polyline(wks,bot_plot,xx,yy,res_lines)
dum6 = gsn_add_text(wks,bot_plot,"IN75",1910,0.875,res_text)
yy = (/0.935,0.935/)
res_lines@gsLineColor = "yellow"
dum7 = gsn_add_polyline(wks,bot_plot,xx,yy,res_lines)
dum8 = gsn_add_text(wks,bot_plot,"RA25",1910,0.936,res_text)
;*************************************************************
;编辑标题
;*************************************************************
res_text = True
res_text@txFontHeightF = 0.03
txid_top = gsn_create_text(wks, "Regional Climate Model", res_text)
amres = True
amres@amJust = "BottomCenter"
amres@amParallelPosF = 0.0
amres@amOrthogonalPosF = -0.72
annoid_top = gsn_add_annotation(bot_plot, txid_top, amres)
res_text@txFontHeightF = 0.02
txid_mid = gsn_create_text(wks, "Regional Temperature Anomalies",res_text)
amres@amOrthogonalPosF = -0.62
annoid_mid = gsn_add_annotation(bot_plot, txid_mid, amres)
res_text@txFontHeightF = 0.015
txid_bot = gsn_create_text(wks,"from 1992-1999 average",res_text)
amres@amOrthogonalPosF = -0.55 ;
annoid_bot = gsn_add_annotation(bot_plot, txid_bot, amres)
pres = True
maximize_output(wks,pres)
end
|
|