[gradsusr] set clevs dynamically

Sam Wilson sam at surfline.com
Fri May 24 19:04:42 EDT 2013


Jeff,

Thanks a lot for your help! This worked for me.

Best Regards,
Sam

From: Jeff Duda <jeffduda319 at gmail.com<mailto:jeffduda319 at gmail.com>>
Reply-To: GrADS Users Forum <gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>>
Date: Tue, 21 May 2013 20:53:32 -0500
To: GrADS Users Forum <gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>>
Subject: Re: [gradsusr] set clevs dynamically

Oh...in that case use a while loop to build a text string adding each contour level.  Here's a simplified example from one of my own scripts:

 c_levs = ''
 c_cols = ''
 value = min_deg
 init_color_value = 16
 i = 0
 while (value <= max_deg)
  color_value = math_int(init_color_value + i*skips)
  i = i + 1
  c_levs = c_levs' 'value
  c_cols = c_cols' 'color_value
  value = value + diff
 endwhile
* These two lines are required since set ccols requires one more value than set clevs
* at this point, i should be equal to n_levs
 color_value = math_int(init_color_value + i*skips)
 if (color_value > 69)
  color_value = 69
 endif
 c_cols = c_cols' 'color_value

 'set clevs 'c_levs
 'set ccols 'c_cols

Jeff


On Tue, May 21, 2013 at 8:49 PM, Sam Wilson <sam at surfline.com<mailto:sam at surfline.com>> wrote:
Hi Jeff,

Thanks for the response. I have the RGB values and the 'set ccols' command covered I think. Those will remain static no matter what the high/low temps are. I'm looking for how to work the 'set clevs' command, which I need to be variable from data file to data file, given that the temperature ranges will change. So, I'm wondering if I can create an array of clevs, and pass that to the 'set clevs' command.

Thanks,
Sam



On May 21, 2013, at 6:32 PM, "Jeff Duda" <jeffduda319 at gmail.com<mailto:jeffduda319 at gmail.com>> wrote:

You need to also set the contour colors.  This means you will need to use the 'set rgb R G B' commands to define color numbers up to 255 (the highest allowable in Grads) and set the color values using the 'set ccols (list#)'.

Jeff Duda


On Tue, May 21, 2013 at 6:41 PM, Sam Wilson <sam at surfline.com<mailto:sam at surfline.com>> wrote:
Hi all,

I have a grads script that reads satellite data and figures out a temperature range based on the data over an area:

sstrange = maxtemp – mintemp

I would like to have 254 levels (colors) between that high and low temp, so I calculate an interval like so:

interval = sstrange/254

I have all the colors I need for the set ccols option, however I'm wondering if there is a way to dynamically set clevs based on the high and low temp and the interval.  I tried the below, but I don't think it worked:

i = 1
while (i < 254)
clev.i = mintemp+(interval*i)
'set clevs 'clev.i
i = i + 1
endwhile

I also tried the following:

'set cmin 'finallowt
'set cmax 'finalhight
'set cint 'interval

But I get a message saying 'Too many contour levels -- adjusting cint'.

Any ideas if this is possible or how to solve it?

Thanks and best regards.

Sam

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr




--
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr




--
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
_______________________________________________ gradsusr mailing list gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130524/de8cd9e3/attachment-0003.html 


More information about the gradsusr mailing list