; *********************************************** ; xy_1.ncl ; ; Concepts illustrated: ; - Drawing a black-and-white XY plot ; ;************************************************ ; These files are loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; read in data ;************************************************ f=addfile ("/home/netapp-clima/scratch/asalhi/mask/GSA01/dox01_med_0-52.nc", "r"); dox = f->dox ; get Temp data depth = f->dox(0,:,0,0) x =dox&time printVarSummary(depth) printVarSummary(x) ;-- compute the area mean without weigthing wgt = (/depth/) dox_ave1 = dim_avg_wgt_n_Wrap( dox, wgt, 0, 1 ) ; ==> dox_ave1(time,lat,lon) y = dim_avg_n_Wrap(dox_ave1,(/1,2/)) printVarSummary(y) ;************************************************ ; plotting parameters ;************************************************ wks = gsn_open_wks ("eps","xy") ; send graphics to PNG file ; x_values = (/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18/) ; custom_labs = (/"01/1999","01/2000","01/2001","01/2002","01/2003","01/2004","01/2005","01/2006","01/2007","01/2008","01/2009","01/2010","01/2011","01/2012","01/2013","01/2014","01/2015","01/2016"/) x =ispan(1,215,12) res = True ; plot mods desired res@tiMainString = "Basic XY plot" ; add title res@xyLineThicknesses = (/1.0/) res@xyLineColors = (/"blue"/) ; res@tmXBMode = "Explicit" ; res@tmXValues = x_values ; res@tmXLabels = custom_labs res@tmLabelAutoStride = True ;restime = True ; set time tickmark resouces res@ttmFormat = "%c %y" ; time tickmark format ;time_axis_labels(x, res, restime) ; sets the correct time labels plot = gsn_csm_xy (wks,x,y,res) ; create plot end