Re: Anomalous white space on plots

From: Helen Parish <hparish_at_nyahnyahspammersnyahnyah>
Date: Fri, 22 May 2009 18:01:56 -0700

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.
>
>
Received on Fri May 22 2009 - 19:01:56 MDT

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