[ncl-talk] Sub: Figure is disappearing

alesall alesall at iri.columbia.edu
Thu Feb 1 19:18:14 MST 2018


Hi, looks to me like you need to add the line

draw(plots)

before 

end





-- 
Alessandra Giannini
IRI for Climate and Society - The Earth Institute at Columbia University
P.O. Box 1000, Palisades NY 10964-8000
phone/fax: +1 845 680-4473/4864 - email: alesall at iri.columbia.edu <mailto:alesall at iri.columbia.edu>

> On Feb 1, 2018, at 8:43 PM, dale zuri via ncl-talk <ncl-talk at ucar.edu> wrote:
> 
> Hi Ncl user,
> The program is not producing any error. But the figure is not plotted. 
> I would appreciate any help and suggestion.
> Thanks
> AkilaS
> 
> 
> begin
> ;***********************************************************
> Model="t2m";;;;;;;change this line to include may forecast/march forecast
> Model1="sst";;;;;;;change this line to include may forecast/march forecast
> Model2="q2m";;;;;;;change this line to include may forecast/march forecast
> Model3="t2mL";;;;;;;change this line to include may forecast/march forecast
> ;Box="23" ;;;;Both Temp/Prec
> Box="12" ;;;;Both Temp/Prec
> yrstrt="1980"
> yrend="2017"
> unit="Temperature(~F34~0~F~ C)"
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> f = addfile("era1-1980.nc <http://era1-1980.nc/>","r")
> u = f->sst                          ; units  m/s
> printVarSummary(u)
> diri = "/import/c1/NCARCCM/asampath/ERA-Interim/ERA-Alaska-Fire-Summer"
> fils = systemfunc ("csh -c 'cd " + diri + " ; ls era1*'")
> print(fils)   ; relative path to files
> f1 = addfiles(fils,"r")
> ListSetType (f1, "cat")        ; concatenate (=default)`
> dew    = short2flt(f1[:]->d2m(:,{55:45},{200:210}))               ; read T from all filesu   = short2flt(f1[:]->t2m(:,{55:45},{200:210}))   ;air temp Ocean            ; read T from all files
> t2air   = short2flt(f1[:]->t2m(:,{55:45},{200:210}))   ;air temp Ocean            ; read T from all files
> t2lan   = short2flt(f1[:]->t2m(:,{70:60},{200:210}))   ;air temp land            ; read T from all files
> tsst    = short2flt(f1[:]->sst(:,{55:45},{200:210})) ;sea box               ; read T from all files
> DEW2= (dew-273.15);;;;dew point temperature
> T2Air= (t2air-273.15);;;;2mtemperature Ocean
> TSST= (tsst-273.15);;;;SeaSurface temperature
> T2LAN= (t2lan-273.15);;;;air temp land
> AvDEW2 = dim_avg_n_Wrap(DEW2, (/1,2/))  ; ==> zAvg(nlat,nlon)
> AvT2Air = dim_avg_n_Wrap(T2Air, (/1,2/))  ; ==> zAvg(nlat,nlon)
> 
> AvTSST = dim_avg_n_Wrap(TSST, (/1,2/))  ; ==> zAvg(nlat,nlon)
> AvT2LAN = dim_avg_n_Wrap(T2LAN, (/1,2/))  ; ==> zAvg(nlat,nlon)
> print(AvT2Air)
> print(AvT2LAN)
>    rc =  regline_stats(AvT2Air,AvTSST) ; linear regression coef
>    print(rc)
> ;;;;;;;;;;;Relative humidity calculation;;;;surface pressure in mb;;;specific humidity in kg/kg;;dew point temp in degree C;;;;;;;;;
> e =6.112*(exp((17.625*AvDEW2)/(243.04+AvDEW2))) ;;;;;vapor pressure in mb
> q = ((0.622 * e)/(1013.25 - (0.378 * e)))*1000; 
> print(q)
>    rc1 =  regline_stats(q,AvTSST) ; qOCean
> print(rc1)
>    rc2 =  regline_stats(AvT2LAN,AvT2Air) ; land-Air
> ;************************************
> qx = ispan (1,228,1)
> ;printVarSummary(qx)
> ;print(dimsizes(liness1))
> ;print(dimsizes(lines1))
> ;print(dimsizes(t2))
> ;;;;;;;Array adjustment;;;;;;;;;;;;;;;;
> ;gg=dimsizes(qx)-dimsizes(liness1)
> ;xgg = new(gg,float)
> ;print(xgg)
> ;lin1= array_append_record (xgg, liness1, 0)
> ;print(lin1)
> ;t resources;;;;;;;;;;;;;;;;;;O;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> asciiwrite ("temporal_Clim_"+Model+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+".txt", sprintf("%9.3f", AvT2Air))
> asciiwrite ("temporal_Clim_"+Model1+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+".txt", sprintf("%9.3f", AvTSST))
> asciiwrite ("temporal_Clim_"+Model2+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+".txt", sprintf("%9.3f", q))
> asciiwrite ("temporal_Clim_"+Model3+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+".txt", sprintf("%9.3f", AvT2LAN))
> ;wks   = gsn_open_wks ("pdf", ""+Model+"-"+Model1+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+"_timeseries_")
> ;wks   = gsn_open_wks ("pdf", ""+Model2+"-"+Model1+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+"_timeseries_")
> wks   = gsn_open_wks ("x11", ""+Model3+"-"+Model+"_PSA_"+yrstrt+"-"+yrend+"_"+Box+"_timeseries_")
> plots = new(1, graphic)
> 
> res                  = True
> res at gsnDraw          = False
> res at gsnFrame         = False
> res at vpHeightF= 0.25                    ; change aspect ratio of plot
> res at vpWidthF = 0.4
> res at xyLineThicknessF = 4.
> res at xyDashPattern    = 0
> res at xyMarker         = 16
> 
> ;res at tmYLMinorOn         = False   ; Turn off left minor tickmarks
> res at tmYLOn               = True   ; Turn off left tickmarks
> res at tmYLMinorOn         = False   ; Turn off left minor tickmarks
> res at tmYROn               = False
> res at tmXTOn               = False
>  ; now change the size of the tickmark labels
> res at tmXBLabelFont = 22                 ; resize tick labels
> res at tmXBLabelFontHeightF = 0.009                 ; resize tick labels
> res at tmYLLabelFont = 22                 ; resize tick labels
> res at tmYLLabelFontHeightF = 0.013
> res at tiMainFont= 22
> res at tiMainFontHeightF = 0.013
> res at tiXAxisFontHeightF = 0.013
> res at tiYAxisFontHeightF = 0.013
> res at tiXAxisFont = 22
> res at tiYAxisFont = 22
> res at tiXAxisString   = "Time [years]"
> ;res at tiYAxisString   = "mm/d"
> res at tiYAxisString   ="" 
> ;*****************************
> ; panel plot only resources
> resP                     = True         ; modify the panel plot
> resP at gsnMaximize         = True         ; large format
> resP at gsnStringFont   = "helvetica-bold"
> ;resP at gsnPanelFigureStrings = (/"a)","b)","c)","d)","e)","f)","g)","h)"/)
> ;resP at gsnPanelFigureStringsFontHeightF  = 0.015
> ;resP at gsnPanelFigureStringsFont  = "helvetica-bold"
> 
>  txres               =  True
>  txres at txFontHeightF = 0.02
>  txres at txJusti        = "CenterCenter"
>  txres at txFontThicknessF = 2.0      ; default=1.00
> ; txres at txFontHeightF    = 0.025    ; default=0.05
> 
> ;res at xyLineColors     = (/ "Red", "Green","Red","Green"/)
> ;res at xyMarkLineMode = "MarkLines"               ; Markers *and* lines
> ;res at xyMarkers      = (/4,4/)               ; 3 different markers
> ;res at xyMarkerColor   = (/"Red","blue"/)
> res at xyLineColors     = (/"Red","blue"/)
> ;;;;;;;;;;;;;;;;;;Legend Label;;;;;;;;;;;;;;;;;;
> ;res at xyExplicitLegendLabels = (/"T2m(Air)","SST"/)
> res at xyExplicitLegendLabels = (/"q2m(g/kg)","SST"/)
> ;res at xyExplicitLegendLabels = (/"T2m(Air)","T2m(Land)"/)
> res at pmLegendSide           = "Top"
>   res at pmLegendDisplayMode    = "Always"   ; Display a legend.
>   res at pmLegendWidthF         = 0.1        ; Make it smaller
>   res at pmLegendHeightF        = 0.05        ; Make it smaller
>   res at pmLegendOrthogonalPosF = -0.4      ; Move into to plot
>   res at pmLegendParallelPosF   =  0.5      ; Move to right
>   res at lgPerimOn              = False      ; No legend perimeter.
>   res at lgLabelFont     = 22 
>   res at lgLabelFontHeightF     = 0.013
> ;;;;;;;;;;;;Tick mark line label;;;;;;;;;;;;;;;
> ;res at tiMainString     = ""+Box+"-Regcoeff("+sprintf("%1.0g",rc)+") -"+yrstrt+"-"+yrend+""
> res at tiMainString     = ""+Box+"-Regcoeff("+sprintf("%1.0g",rc1)+") -"+yrstrt+"-"+yrend+""
> ;res at tiMainString     = ""+Box+"-Regcoeff("+sprintf("%1.0g",rc2)+") -"+yrstrt+"-"+yrend+""
> res at tmXBMode   = "Explicit"
> ;res at trYMinF = -(max(zAvg))
> ;res at trYMaxF = (max(zAvg1))
> res at trXMinF = 0
> res at trXMaxF =228 
> res at tmXBValues = ispan(0,227,6) 
> res at tmXBLabels = (/"1980","1981","1982","1983","1984","1985","1986", \
>     "1987","1988","1989","1990","1991","1992","1993","1994","1995",  \
>    "1996","1997","1998","1999","2000","2001","2002","2003","2004", \
>    "2005","2006","2007","2008","2009","2010","2011","2012","2013", \
>    "2014","2015","2016","2017"/)
> res at tmXBLabelAngleF = 80 
> plots(0)  = gsn_csm_xy(wks,qx,(/AvT2Air,AvTSST/),res) ; create plot
> ;plots(0)  = gsn_csm_xy(wks,qx,(/q,AvTSST/),res) ; create plot
> ;plots(0)  = gsn_csm_xy(wks,qx,(/AvT2LAN,AvT2Air/),res) ; create plot
> end
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180201/5ba471f5/attachment.html>


More information about the ncl-talk mailing list