Multi-model ensemble

From: Melissa Lazenby <M.Lazenby_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 21 2014 - 08:32:49 MDT

Hi NCL Users

I am wanting to create a multi-model ensemble for 36 models of their differ=
ence in precipitation maps.
I have tried a few thing but not sure how to include the ensemble.
Below is the code for the 36 difference maps, but I am wanting just one plo=
t of the ensemble.

Many thanks for your help in advance.

Kindest Regards
Melissa

;*************************************************
; regline_panel_ensemble.ncl
;

;*************************************************
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"

begin
;************************************************
; Read in Precip Data.
;************************************************

;Models

model = (/"ACCESS1-0","ACCESS1-3","bcc-csm1-1","bcc-csm1-1-m","BNU-ESM","=
CanESM2","CCSM4","CESM1-BGC","CESM1-CAM5","CMCC-CMS","CNRM-CM5","CSIRO-Mk3-=
6-0","EC-EARTH","FGOALS-g2","FGOALS-s2","FIO-ESM","GFDL-CM3","GFDL-ESM2G","=
GFDL-ESM2M","GISS-E2-R_p1","GISS-E2-H-CC","GISS-E2-R-CC","HadGEM2-AO","HadG=
EM2-CC","HadGEM2-ES","inmcm4","IPSL-CM5A-LR","IPSL-CM5A-MR","MIROC5","MIROC=
-ESM","MIROC-ESM-CHEM","MPI-ESM-LR","MPI-ESM-MR","MRI-CGCM3","NorESM1-M","N=
orESM1-ME"/)

;"CESM1-FASTCHEM","CESM1-WACCM","CMCC-CESM","CMCC-CM","GISS-E2-H_p1","IPSL-=
CM5B-LR","MIROC4h","MPI-ESM-P",

wks = gsn_open_wks("X11","MME") ; specifies a plot
gsn_define_colormap(wks,"MPL_YlGnBu") ; choose color map
plot = new (dimsizes(model),"graphic")

do gg = 0,dimsizes(model)-1
f=addfile("/mnt/geog/ml382/melphd/regressionline/futureregline2070_2100_l=
arge/pr_Amon_"+model(gg)+"_rcp85_safrica_climDJF1.nc","r")

s=addfile("/mnt/geog/ml382/melphd/regressionline/siczoutputprregline2/pr_=
Amon_"+model(gg)+"_historical_safrica_climDJF1.nc","r")

  lat1 = f->lat ; get lat
  lon1 = f->lon ; get lon
  time1 = f->time

  lat2 = s->lat ; get lat
  lon2 = s->lon ; get lon
  time2 = s ->time

if ((gg.eq.3) .or.(gg.eq.13) .or. (gg.eq.17) .or. (gg.eq.18) .or. (gg.eq.20=
) .or. (gg.eq.21)) then
  pr6 = f->pr(:,:,:)
 else
  pr6 = f->pr(:,0,:,:)
  end if

  pr4 = pr6(time|0,{lat|-40:10}, {lon|-10:70})

if ((gg.eq.13) .or.(gg.eq.17) .or. (gg.eq.18)) then
  pr7 = s->pr(:,:,:)
 else
  pr7 = s->pr(:,0,:,:)
  end if



  pr5 = pr7(time|0,{lat|-40:10}, {lon|-10:70})

difmap= pr4- pr5
copy_VarCoords (pr4, difmap)
difmap@long_name = ""+model(gg)+""
difmap@units = "mm/month"


ens = difmap
ens = (/ dim_sum(gg)/36.0 /) ; average across the models
                                                           ; to get an ense=
mble average



 res = True ; plot mods desired
 res@gsnAddCyclic = False
 res@cnFillOn = True ; color on
 res@lbLabelStride = 2 ; every other label
 res@gsnSpreadColors = True ; use full range of color m=
ap
 res@cnLineLabelsOn = False ; no contour line labels
 res@lbLabelBarOn = False
 res@gsnDraw = False ; do not draw the plot
 res@gsnFrame = False


dimpr4 = dimsizes(pr4)
latn = dimpr4(0)
lonm = dimpr4(1)


res@mpLimitMode = "Corners" ;
res@mpLeftCornerLonF = lon1(0)
res@mpRightCornerLonF = lon1(lonm-1)
res@mpLeftCornerLatF = lat1(0)
res@mpRightCornerLatF = lat1(latn-1)


 res@tmXBMode = "Explicit" ; Define own tick mark labels.
 res@tmXBValues = (/ -9.,0.,10.,20.,30.,40.,50.,60.,69 /)
 res@tmXBLabels = (/ "10W","0","10E","20E","30E","40E","50E","60E","70=
E" /)

 res@tmYLMode = "Explicit" ; Define own tick mark labels.
 res@tmYLValues = (/ -39.,-30.,-20.,-10.,-0.,9 /)
 res@tmYLLabels = (/"40S","30S","20S","10S","0","10N" /)

 res@vpXF = 0.12 ; default is 0.2 change aspect
 res@vpYF = 0.8 ; default is 0.8 ration
 res@vpHeightF = 0.4 ; default is 0.6
 res@vpWidthF = 0.8 ; default is 0.6

 res@cnLevelSelectionMode = "ManualLevels" ; manual levels
 res@cnMinLevelValF = -100 ; min level
 res@cnMaxLevelValF = 100 ; max level
 res@cnLevelSpacingF = 30 ; contour spacing

  res@tmXBLabelFontHeightF = 0.021 ; resize tick labels
  res@tmYLLabelFontHeightF = 0.021
  res@pmLabelBarOrthogonalPosF = .20 ; move whole thing down



 ; reverse the first two colors
  setvalues wks
    "wkColorMap" : "MPL_YlGnBu"
    "wkForegroundColor" : (/0.,0.,0./)
    "wkBackgroundColor" : (/1.,1.,1./)
  end setvalues


  res@tmXBLabelsOn = False ; do not draw bottom labe=
ls
  res@tmXBOn = False ; no bottom tickmarks
  res@tmYLLabelsOn = False ; no right labels
  res@tmYLOn = False ; no right tickmarks


 plot = gsn_csm_contour_map_ce(wks,difmap({-40:10},{-10:70}),res) =
 ; create plot


  delete(pr4)
end do
end


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


Received on Mon Jul 21 02:33:04 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:47 MDT