[gradsusr] Diagnostics in Ctl File?

Jeff Duda jeffduda319 at gmail.com
Sat Nov 12 00:07:31 EST 2011


Mason,
What happens when you enter the command
'd cdiff(tmpprs,x)' ?

Does it display something that looks like the meridional gradient in
temperature?

Jeff

On Fri, Nov 11, 2011 at 11:00 PM, Rowell, Mason D.
<Mason.D.Rowell-1 at ou.edu>wrote:

>  Jeff,
>
> My problem comes in using cdiff. Everything else should be fine (it is
> practically verbatim from the webpage). I have a suspicion it is because it
> uses x and y as arguments on two different lines but I don't really have
> much of a way to know without more Grads experience. Could this be causing
> the problem?
>
> Mason
>  ------------------------------
> *From:* gradsusr-bounces at gradsusr.org [gradsusr-bounces at gradsusr.org] on
> behalf of Jeff Duda [jeffduda319 at gmail.com]
> *Sent:* Friday, November 11, 2011 3:17 PM
>
> *To:* GrADS Users Forum
> *Subject:* Re: [gradsusr] Diagnostics in Ctl File?
>
>  Mason,
> I preferred to derive the formulas for spacings myself.  Simple
> trigonometry reveals the following that you should use for dx and dy (i.e.,
> meridional and zonal grid spacing):
> dx = Re*cos(phi)*d(theta)
> dy = Re*d(phi)
>
> where Re is the radius of the Earth (6371 to 6374 km), phi is latitude,
> theta is longitude, and the d operator means "change in".  To convert this
> to Grads scripting code, you use the cdiff command.  Also note that all
> angle measures need to be in radians, so you'll have to convert them as you
> do the operation.  Here are the literal Grads command lines I use for this:
>
> re = 6.371e3
> 'define dx = 're'*cos(lat*(3.1419/180))*cdiff(lon*(3.14159/180))'
> 'define dy = 're'*cdiff(lon*(3.14159/180))'
>
> Obviously you can assign the conversion factor pi/180 to a script variable
> to simplify the symbolism there:
>
> conv_factor = 3.14159/180
> e.g., 'define dy = 're'*cdiff(lon*'conv_factor')'
>
> If you try to display dx or dy, you should get a nice little image that
> contours or colors dx and dy (dx should decrease towards the poles and not
> change along a line of constant latitude, and dy should only be a function
> of latitude as well).  Now use this to define temperature advection
> (assuming the temperature variable is tmpprs and wind is ugrdprs/vgrdprs):
>
> 'define tadv = -ugrdprs*cdiff(tmpprs,x)/(2*dx) -
> vgrdprs*cdiff(tmpprs,y)/(2*dy)'
>
> The 98cbar.gs is indeed just a script that defines color levels and sets
> a color scheme for when you plot temperature advection.  Changing the color
> tables is rather easy in Grads.  You only need to define a color using 'set
> rgb # R G B', where # is anything between 16 and 255 (just a reference
> number) and R, G, and B are between 0 and 255.  Then you set the contour
> intervals manually using 'set clevs , , , , , ...' where you insert
> literally the levels you want to use (separated by SPACES, not COMMAS).
> Then set the colors for those levels using 'set ccols , , , , , , ,+1'
> again using the reference numbers for each color and separating by SPACES.
> The "+1" is for the fact that you need one additional color for the number
> of levls you put.  You can consult the controlling colors<http://www.iges.org/grads/gadoc/colorcontrol.html>page for full info on what I just said.  Also, I have a number of very
> simple color bar scripts that I've used in the past.  I can provide them to
> all if anyone is interested.
>
> You can also create a simple color bar using the cbar.gs script which is
> provided in the script library<http://www.iges.org/grads/gadoc/library.html>
> .
>
> Let me know if you need any more help.
>
> Jeff
>
> On Fri, Nov 11, 2011 at 2:50 PM, Rowell, Mason D. <Mason.D.Rowell-1 at ou.edu
> > wrote:
>
>>  Jeff and others,
>>
>> Strange. This is exactly what was suggested in the ctl file near the
>> comments at the bottom (that which I pulled from nomads). The only
>> difference is that they have also the inclusion of a 98cbar.gs script
>> right after the other expressions like that in this link you gave me, whose
>> utility is a mystery since it is not necessary, at least suggested as so by
>> the cdiff documenation given that it is not included. Perhaps it is just
>> some coloring scheme. At any rate, the script fails at the first line
>> (which attempts to define dtx), with each line coded exactly as it is shown
>> (with the appropriate NARR temp as TMPprs and wind as UGRDprs and VGRDprs
>> of course). I assume it will do so again at dty, and so forth. I originally
>> didn't include define with these since I thought they weren't necessary but
>> adding that in didn't solve the problem anyways. I suspect it is because
>> cdiff calls x, and since I define my domain with lat long, it doesn't have
>> a x variable to use? There definitely isn't a spacing issue this time...
>>
>> Mason
>>  ------------------------------
>> *From:* gradsusr-bounces at gradsusr.org [gradsusr-bounces at gradsusr.org] on
>> behalf of Jeff Duda [jeffduda319 at gmail.com]
>> *Sent:* Thursday, November 10, 2011 11:11 AM
>> *To:* GrADS Users Forum
>> *Subject:* Re: [gradsusr] Diagnostics in Ctl File?
>>
>>  Mason,
>> There is a good example of how to code temperature advection in the page
>> for the cdiff command: http://www.iges.org/grads/gadoc/gradfunccdiff.html
>> The reason for all of the crazy manipulations is because the data points
>> on your grid are not uniformly spaced on the globe.  Thus corrections have
>> to be made to get the correct distance between individual grid points.
>>
>> Jeff
>>
>> On Thu, Nov 10, 2011 at 11:00 AM, Wesley Ebisuzaki <
>> Wesley.Ebisuzaki at noaa.gov> wrote:
>>
>>> Mason,
>>>
>>> I think that you've discovered the "private" commands used by nomads
>>> plot software for defining new variables
>>> and custom plots.   The nomads plot package is a wrapper for GrADS.  It
>>> has the ability to run grads .gs files that
>>> are embedded within the ctl files.
>>>
>>>
>>>
>>> http://www.cpc.ncep.noaa.gov/products/wesley/ncep_data/plot_doc.htmlhttp://www.cpc.ncep.noaa.gov/products/wesley/ncep_data/plot_doc.html
>>>
>>> Ask NCDC for a copy of the .gs files.
>>>
>>> > Has anyone done this before with grads?
>>>  How do you expect the developers to debug the scripts?
>>>
>>>     Wesley
>>>
>>>
>>>
>>> Rowell, Mason D. wrote:
>>> > All,
>>> >
>>> > I noticed ample comments toward the end of the ctl files available on
>>> the nomads servers from the NARR page, with a description of how to
>>> implement these in grads scripting. I tried to take this to plot
>>> temperature advection but it didn't work, b/c the last line of the comments
>>> calls for some function never provided. Has anyone done this before with
>>> grads?
>>> >
>>> > Mason
>>> > _______________________________________________
>>> > gradsusr mailing list
>>> > gradsusr at gradsusr.org
>>> > http://gradsusr.org/mailman/listinfo/gradsusr
>>> >
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>
>>
>>
>> --
>> Jeff Duda
>> Grad student - PhD, Meteorology
>> University of Oklahoma School of Meteorology - Center for Analysis and
>> Prediction of Storms
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Jeff Duda
> Grad student - PhD, Meteorology
> University of Oklahoma School of Meteorology - Center for Analysis and
> Prediction of Storms
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Grad student - PhD, Meteorology
University of Oklahoma School of Meteorology - Center for Analysis and
Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20111111/ce5c6aea/attachment-0003.html 


More information about the gradsusr mailing list