Re: Anomalous white space on plots

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sat, 23 May 2009 07:35:58 -0600

Helen,

I'm not sure how this script works, because your pressure values fall
outside the allowed range of gsn_csm_pres_hgt.
I tried a variation on your script using dummy data, and got the error
message:

(0) gsn_geop_hgt: Fatal: The pressure values do not fall between
(0) 2.54e-06 mb and 1050 mb.

I then divided your lev_p values by 100, and this works.

I would like to try it with your data, however. Can you do the
following for me:

Add the resource:

   res_at_gsnDebugWriteFileName = "marytest"

Rerun your script, and send me the files "marytest.nc", "marytest.ncl"
and "marytest.res".

--Mary

On May 22, 2009, at 7:01 PM, Helen Parish wrote:

> Mary,
>
> Here is the script I used to create plot (b) in my previous post,
> which has a limited range of vertical levels, and white space at the
> top (the script for the other plot is essentially the same, but
> plots all the vertical levels).
>
> Thanks,
> Helen.
>
> ;***********************
> ; temploop.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
>
> ; Keep all files open when have a lot of files :
> setfileoption("nc","SuppressClose",False)
>
> diri = "./"
> fili = systemfunc("cd "+diri+" ; ls zeusrand09125*.cam2.h0*nc")
> print(fili)
> nfili = dimsizes(fili)
>
> lev_p = (/ 91500., 90000., 87500., 80000., 67500., 50000., 30000.,
> 20000., 10000., 5000., 3000., 1500., 750., 390., 200., 100.,
> 50.,25., 14., 7., 3.5, 1.9, 0.95, 0.4, 0.1, 0.03 /)
>
> do nf = 0, nfili-1
>
> fi = addfile (diri+fili(nf), "r")
>
> diro = "./"
> filo = "helen"+nf+".nc"
> print(filo)
> system ("/bin/rm -f "+diro+filo) ; remove any pre-exist file
> fo = addfile (diro+filo, "c")
>
> hyam = fi->hyam ; read hybrid info
> hybm = fi->hybm
> hyai = fi->hyai ; read hybrid info
> hybi = fi->hybi
> PS = fi->PS
> P0mb = 0.01*fi->P0
> T = fi->T
> lat = fi->lat
>
> lev_p!0 = "lev_p" ; variable and dimension name
> the same
> lev_p&lev_p = lev_p ; create coordinate variable
> lev_p_at_long_name = "pressure" ; attach some attributes
> lev_p_at_units = "hPa"
> lev_p_at_positive = "down"
>
> Tp = vinth2p (T, hyam, hybm, lev_p ,PS, 1, P0mb, 2, True)
> copy_VarAtts(T, Tp)
> fo->T = Tp ; write to netCDF file
>
> end do
>
> diri = "./"
> fili2 = systemfunc("cd "+diri+" ; ls helen*nc")
> print(fili2)
> nfili = dimsizes(fili2)
>
> f2 = addfiles (fili2,"r")
> T2= addfiles_GetVar(f2,fili2,"T")
>
> printVarSummary( T2 )
>
> dimt2 = dimsizes( T2 )
> ntim2 = dimt2(0)
> klvl2 = dimt2(1)
> nlat2 = dimt2(2)
> mlon2 = dimt2(3)
>
> tavg = dim_avg_Wrap(T2)
>
> tavg_reorder = tavg(lev_p | :, lat | :, time | :) ;
> (lev,lat,time)
>
> ttimeav = dim_avg_Wrap(tavg_reorder) ; (lev,lat)
>
> ;***********************
> ; Create Plot
> ;***********************
> wks = gsn_open_wks ("pdf", "temploop.test.165to175" ) ;
> open workstation
> gsn_define_colormap(wks,"rainbow") ; choose colormap
>
> res = True
> res_at_cnFillOn = True
> res_at_lbLabelAutoStride = True
> res_at_gsnMaximize = True ; if [ps, eps, pdf] make large
> res_at_gsnSpreadColors = True ; span color map
>
> nt = 3 ; choose a time
>
> TTIMEAV = conform(tavg_reorder,ttimeav,(/0,1/)) ;
> (lev,lat,time)
>
> work = ttimeav(:,:) ; time average at all levels and
> latitudes
>
> res_at_gsnLeftString = ""
> res_at_gsnCenterString = "Time average of zonally averaged
> temperature"
> res_at_gsnRightString = ""
>
> res_at_tiXAxisString = "Latitude (degrees)"
> res_at_tiYAxisString = "Pressure (mbar)"
>
> plot = gsn_csm_pres_hgt(wks, ttimeav(lev_p | 0:20, lat | :),
> res ) ; (lev,lat)
>
> res_at_trYReverse = True
>
> end
>
>
> On May 22, 2009, at 6:52 AM, Mary Haley wrote:
>
>> Helen,
>>
>> I don't think there's enough information from the plots alone
>> to determine the problem.
>>
>> Can you provide the script as well? I think there's something
>> odd going on with the pressure/height coordinate arrays.
>>
>> --Mary
>>
>>
>>
>> On Thu, 21 May 2009, Helen Parish wrote:
>>
>>> Can anyone tell me why I get white space at the top of my plots,
>>> and how I can get rid of it to produce publication quality
>>> plots ?. I have plotted the same dataset twice in (a) and (b)
>>> below. In (a) I plotted the whole of the vertical range. In (b), I
>>> plotted the first 20 vertical levels of the same dataset. Since
>>> (a) is continuous, without any missing data at the top, why should
>>> there be white space when I plot a part of the dataset ?.
>>>
>>> Even if the routine just does this, for some reason, is there a
>>> fix I can use to get rid of the white space ?.
>>>
>>> Thanks,
>>> Helen.
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>
>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat May 23 2009 - 07:35:58 MDT

This archive was generated by hypermail 2.2.0 : Tue May 26 2009 - 10:17:16 MDT