;---------------------------------------------------------------------- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ;---Read data a1 = addfile("/home/ew/Work/Africa/fgoals-g2/afr_hist_yrs_fm_ym_mmyr.nc","r") a2 = addfile("/home/ew/Work/Africa/fgoals-g2/afr_midHol_yrs_fm_ym_mmyr.nc","r") a3 = addfile("/home/ew/Work/Africa/fgoals-g2/afr_lgm_fm_ym_mmyr.nc","r") x1 = a1->pr x2 = a2->pr x3 = a3->pr hist = dim_avg_n_Wrap(x1,(/1,2/)) midHol = dim_avg_n_Wrap(x2,(/1,2/)) lgm = dim_avg_n_Wrap(x3,(/1,2/)) hist@units = "mm/year" midHol@units = "mm/year" lgm@units = "mm/year" ;-- open workstation wks = gsn_open_wks("png","zapp_xy-yrs") ; "x11", "ps", "pdf", "png" ;---Create plot array plot = new(3, graphic) res = True date1 = a1->time(::-1) ;-- retrieve the time values and reverse it utc_date = cd_calendar(date1, 0) ;-- convert date to UT-referenced date year = sprinti("%0.4i",tointeger(utc_date(:,0))) ;-- get year as integer value mon = sprinti("%0.2i",tointeger(utc_date(:,1))) ;-- get month as integer value day = sprinti("%0.2i",tointeger(utc_date(:,2))) ;-- get day as integer value hours = sprinti("%0.2i",tointeger(utc_date(:,3))) ;-- get day as integer value mins = sprinti("%0.2i",tointeger(utc_date(:,4))) ;-- get day as integer value date_str = ""+year ;-- yyyy/mm tstart = 1850 ;-- start date tend = 1949 ;-- end date ind_time = ind(where(year.ge.tstart.and.year.le.tend,True,False)) ;-- retrieve valid indices time1 = date1(ind_time) ;-- get dates within date interval data1 = hist(ind_time) ;-- get data within date interval labels = date_str(ind_time) ;-- get labels within date interval res@tmXBMode = "Explicit" ;-- use explicit x-axis labels res@tmXBValues = time1(::10) ;-- original date values res@tmXBLabels = labels(::10) ;-- date labels res@trXMinF = min(time1) ;-- min y-axis value res@trXMaxF = max(time1) ;-- max y-axis value res@trYMinF = 800 ;-- min y-axis value res@trYMaxF = 930 ;-- max y-axis value res@gsnDraw = False ; don't draw the plots, gsn_panel will draw them res@gsnFrame = False ; don't advance the frame, gsn_panel will res@gsnMaximize = False res@tiXAxisString = "yearly mean data" res@tiYAxisString = "precipitation (mm/year)" res@tiXAxisFontHeightF = 0.015 res@tiYAxisFontHeightF = 0.015 res@tmXBLabelFontHeightF = 0.01 ;-- decrease font size res@tmXBLabelJust = "CenterRight" res@tmXBLabelDeltaF = 1.0 ;-- move x-axis labels res@tmXBLabelAngleF = 50. ;-- rotate x-axis labels res@tmLabelAutoStride = True res@xyLineColors = "blue" ;-- line colors res@xyLineThicknessF = 2.0 ;-- set line thickness res@tmXMajorGrid = True ;-- turn on x-grid res@tmXMajorGridThicknessF = 1.0 ;-- thinner the lines res@tmXMajorGridLineDashPattern = 2 ;-- use dashed lines res@tmYMajorGrid = True ;-- turn on y-grid res@tmYMajorGridThicknessF = 1.0 ;-- thinner the lines res@tmYMajorGridLineDashPattern = 2 ;-- use dashed lines res@gsnCenterString = "historical" res@gsnCenterStringFontHeightF = 0.02 plot(0) = gsn_csm_xy(wks,time1,data1,res) date2 = a2->time(::-1) utc_date = cd_calendar(date2, 0) ;-- convert date to UT-referenced date year = sprinti("%0.4i",tointeger(utc_date(:,0))) ;-- get year as integer value mon = sprinti("%0.2i",tointeger(utc_date(:,1))) ;-- get month as integer value day = sprinti("%0.2i",tointeger(utc_date(:,2))) ;-- get day as integer value hours = sprinti("%0.2i",tointeger(utc_date(:,3))) ;-- get day as integer value mins = sprinti("%0.2i",tointeger(utc_date(:,4))) ;-- get day as integer value date_str = ""+year ;-- yyyy/mm tstart = 340 ;-- start date tend = 439 ;-- end date ind_time = ind(where(year.ge.tstart.and.year.le.tend,True,False)) ;-- retrieve valid indices time2 = date2(ind_time) ;-- get dates within date interval data2 = midHol(ind_time) ;-- get data within date interval labels = date_str(ind_time) ;-- get labels within date interval res@tmXBMode = "Explicit" ;-- use explicit x-axis labels res@tmXBValues = time2(::10) res@tmXBLabels = labels(::10) ;-- date labels res@trXMinF = min(time2) res@trXMaxF = max(time2) res@trYMinF = 845 ;-- min y-axis value res@trYMaxF = 920 ;-- max y-axis value res@gsnDraw = False ; don't draw the plots, gsn_panel will draw them res@gsnFrame = False ; don't advance the frame, gsn_panel will res@gsnMaximize = False res@tiXAxisString = "yearly mean data" res@tiYAxisString = "precipitation (mm/year)" res@tiXAxisFontHeightF = 0.015 res@tiYAxisFontHeightF = 0.015 res@tmXBLabelFontHeightF = 0.01 ;-- decrease font size res@tmXBLabelJust = "CenterRight" res@tmXBLabelDeltaF = 1.0 ;-- move x-axis labels res@tmXBLabelAngleF = 50. ;-- rotate x-axis labels res@tmLabelAutoStride = True res@xyLineColors = "blue" ;-- line colors res@xyLineThicknessF = 2.0 ;-- set line thickness res@tmXMajorGrid = True ;-- turn on x-grid res@tmXMajorGridThicknessF = 1.0 ;-- thinner the lines res@tmXMajorGridLineDashPattern = 2 ;-- use dashed lines res@tmYMajorGrid = True ;-- turn on y-grid res@tmYMajorGridThicknessF = 1.0 ;-- thinner the lines res@tmYMajorGridLineDashPattern = 2 ;-- use dashed lines res@gsnCenterString = "midHolocene" res@gsnCenterStringFontHeightF = 0.02 plot(1) = gsn_csm_xy(wks,time2,data2,res) date3 = a3->time(::-1) utc_date = cd_calendar(date3, 0) ;-- convert date to UT-referenced date year = sprinti("%0.4i",tointeger(utc_date(:,0))) ;-- get year as integer value mon = sprinti("%0.2i",tointeger(utc_date(:,1))) ;-- get month as integer value day = sprinti("%0.2i",tointeger(utc_date(:,2))) ;-- get day as integer value hours = sprinti("%0.2i",tointeger(utc_date(:,3))) ;-- get day as integer value mins = sprinti("%0.2i",tointeger(utc_date(:,4))) ;-- get day as integer value date_str = ""+year ;-- yyyy/mm tstart = 550 ;-- start date tend = 649 ;-- end date ind_time = ind(where(year.ge.tstart.and.year.le.tend,True,False)) ;-- retrieve valid indices time3 = date3(ind_time) ;-- get dates within date interval data3 = lgm(ind_time) ;-- get data within date interval labels = date_str(ind_time) ;-- get labels within date interval res@tmXBMode = "Explicit" ;-- use explicit x-axis labels res@tmXBValues = time3(::10) res@tmXBLabels = labels(::10) ;-- date labels res@trXMinF = min(time3) res@trXMaxF = max(time3) res@trYMinF = 765 ;-- min y-axis value res@trYMaxF = 840 ;-- max y-axis value res@gsnDraw = False ; don't draw the plots, gsn_panel will draw them res@gsnFrame = False ; don't advance the frame, gsn_panel will res@gsnMaximize = False res@tiXAxisString = "yearly mean data" res@tiYAxisString = "precipitation (mm/year)" res@tiXAxisFontHeightF = 0.015 res@tiYAxisFontHeightF = 0.015 res@tmXBLabelFontHeightF = 0.01 ;-- decrease font size res@tmXBLabelJust = "CenterRight" res@tmXBLabelDeltaF = 1.0 ;-- move x-axis labels res@tmXBLabelAngleF = 50. ;-- rotate x-axis labels res@tmLabelAutoStride = True res@xyLineColors = "blue" ;-- line colors res@xyLineThicknessF = 2.0 ;-- set line thickness res@tmXMajorGrid = True ;-- turn on x-grid res@tmXMajorGridThicknessF = 1.0 ;-- thinner the lines res@tmXMajorGridLineDashPattern = 2 ;-- use dashed lines res@tmYMajorGrid = True ;-- turn on y-grid res@tmYMajorGridThicknessF = 1.0 ;-- thinner the lines res@tmYMajorGridLineDashPattern = 2 ;-- use dashed lines res@gsnCenterString = "lgm" res@gsnCenterStringFontHeightF = 0.02 plot(2) = gsn_csm_xy(wks,time3,data3,res) resP = True resP@txString = "Africa Time Series: FGOALS-G2 Simulations" resP@txFontHeightF = 0.02 resP@gsnMaximize = True resP@gsnPanelXWhiteSpacePercent = 0 ;-- reduce white space between panel plots gsn_panel(wks,plot,(/3,1/),resP) end