Color legend in horizontal / vertical position (cbarn)

Antoy Chang antoyc at YAHOO.COM
Thu Feb 5 20:51:27 EST 2009


Douglas/all,
Thank you for your support, i manage to solve the problem. This is portion of my cbarn.gs used to plot my clour bar :
*********************************************************************************************************
*  Script to plot a colorbar
*
*  The script will assume a colorbar is wanted even if there is
*  not room -- it will plot on the side or the bottom if there is
*  room in either place, otherwise it will plot along the bottom and
*  overlay labels there if any.  This can be dealt with via
*  the 'set parea' command.  In version 2 the default parea will
*  be changed, but we want to guarantee upward compatibility in
*  sub-releases.
*
*
*       modifications by mike fiorino 940614
*       rvp added by diane stokes 20040729
*       cinc added by diane stokes 20050130
*
*       - the extreme colors are plotted as triangles
*       - the colors are boxed in white
*       - input arguments in during a run execution:
*
*       run cbarn cinc sf vert xmid ymid rvp
*
*       cinc - increment for labels
*       sf   - scale the whole bar 1.0 = original 0.5 half the size, etc.
*       vert - 0 FORCES a horizontal bar = 1 a vertical bar
*       xmid - the x position on the virtual page the center the bar
*       ymid - the x position on the virtual page the center the bar
*       rvp  - 1 resets virtual page (one colorbar for several plots)
*
*       if cinc is not specified, every color interval is labeled
*       if vert,xmid,ymid are not specified, they are selected
*       as in the original algorithm
*
*       if rvp is not specified, it is 0 (don't reset virtual page)
*******************************************************************************************************
if you can see, the cbarn arguments are cinc sf vert xmid ymid rvp, there is additional argument before the sf. in my script below i omit the cinc argument, i solve the problem by assign 1 for cinc argument. 
 
here is my script :
 'set grads off'
  'set parea 0.5 7.7 0.5 9.5'
  'set mpdset /usr/local/lib/grads/hires'
  'set map 1 1 2'
  'set annot 1'
  'set gxout shaded'
  'set clevs 'colndx
  'set ccols 'colevs
* 'd wht*1.25'
  'd wht'
  'run /usr/local/lib/grads/script/cbarn.gs 1.0 1 7.9 4.9'--->corrected cbarn.gs 1 1.0 1 7.9 4.9

  'set gxout vector'
  'set ccolor 1'
  'set arrscl 0.15'
  'define wamv=cos(0.0174532*wdir)'
  'define wamu=sin(0.0174532*wdir)'
  skp=4
  'd skip(wamu,'skp','skp');wamv'
  'set gxout contour'
  'set cint 1'
  'set clab forced'
  'set ccolor 0'
  'd mpr'
   'draw string 7.5 0.35 'metres 
 
But i don't know why the i encounter the problem since 2 days ago after using the same script for plotting since 2005.....
 
Regards,
Antoy


--- On Thu, 2/5/09, Douglas Clark <dbcl at ceh.ac.uk> wrote:

From: Douglas Clark <dbcl at ceh.ac.uk>
Subject: Re: Color legend in horizontal / vertical position (cbarn)
To: antoyc at yahoo.com
Date: Thursday, February 5, 2009, 5:33 PM

Sorry - just saw your later post in which you say the optional arguments
didn't work.
I've no idea.

Doug

>>> Douglas Clark 05/02/2009 09:28 >>>
Antoy,

No idea why the bar changes if everything else really is identical as you said.
Could be some hard-to-find quirk.

Can't you solve this using the optional arguments to cbarn?
Form cbarn.gs:

*       run cbarn sf vert xmid ymid
*
*       sf   - scale the whole bar 1.0 = original 0.5 half the size, etc.
*       vert - 0 FORCES a horizontal bar = 1 a vertical bar
*       xmid - the x position on the virtual page the center the bar
*       ymid - the x position on the virtual page the center the bar

So set vert=1 to ensure a vertical bar (and then xmid,ymid if it still moves
about at all).

Doug



>>> Antoy Chang <antoyc at yahoo.com> 05/02/2009 01:04 >>>
Hi everybody,
I have problem when displaying the 2 wave forecast using exactly the same
script but different color bar position (using cbarn) one is placed horizontally
while the other vertically. How to solve this?, i want to place both vertically,
the print area is exactly the same on both display. Why this inconsistency
happen?. Really appreciate your feedback.Thank You.
 
p/s : Look at the attached files.
 
--- On Wed, 2/4/09, Madhusoodanan M.S. <madhusoodanan at GMAIL.COM> wrote:

From: Madhusoodanan M.S. <madhusoodanan at GMAIL.COM>
Subject: Re: error in ctl file
To: GRADSUSR at LIST.CINECA.IT 
Date: Wednesday, February 4, 2009, 10:11 PM




hi,

your script appears to have some problems.

check the header of taux.cdf (ncdump -h taux.cdf ==> it will give nx and
ny.)

'set x 129.5 320.5'   ==> ??? longitude will vary from 0 359.5 (if
global) 
that means x will vary from 1 720 and
                 y              from 1 361 (if from 90S to 90N)

.ctl file to read the tauxobs.grd should be correctly made then.

cheers,
Madhu



 







 
'reinit'
'sdfopen taux.cdf'
'set gxout fwrite'
'set fwrite tauxobs.grd'
'set x 129.5 320.5' 
'set y 121.5 171.5' 
'set z 1'
'set t 1 24'
'd taux'
'disable fwrite'
 
and the data length in tauxobs.grd is 193*52*24*4, where nx=193, ny=52, and
t=24,
so, where is the error in file i am not getting it, that is it display the
variable for only time t=1, not for the other time,
please help me.
 
with redgards
 
anushri








-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090205/8f753be8/attachment.html 


More information about the gradsusr mailing list