[gradsusr] Horizontal Temperature Gradient

Jeff Duda jeffduda319 at gmail.com
Wed Jun 17 01:40:11 EDT 2020


You are probably not accurately converting degrees to radians in your dx
definition. The correct formula for degrees to radians is radians = degrees
* pi/180. You seem to be missing the "/180" part.

Jeff Duda

On Tue, Jun 16, 2020 at 10:26 PM Ricardo Hallak <ricardo.hallak at iag.usp.br>
wrote:

> Hy, Mano. Follow the instructions below, from the GrADS homepage. It will
> fix your mistake.
> *cdiff*
>
> cdiff(*expr,dim*)
>
> Performs a centered difference operation on *expr* in the direction
> specified by *dim*. The difference is done in the grid space, and no
> adjustment is performed for unequally spaced grids. The result value at
> each grid point is the value at the grid point plus one minus the value at
> the grid point minus one. The *dim* argument specifies the dimension over
> which the difference is to be taken, and is a single character: X, Y, Z, or
> T.
>
> Result values at the grid boundaries are set to missing.
>
> Usage Notes
>
> Examples
>
>
>    1. The cdiff function may be used to duplicate the calculation done by
>    the hcurl <http://cola.gmu.edu/grads/gadoc/gradfunchcurl.html>
>     function:
>
>    define dv = cdiff(v,x)define dx = cdiff(lon,x)*3.1416/180define du =
>    cdiff(u*cos(lat*3.1416/180),y)define dy = cdiff(lat,y)*3.1416/180display
>    (dv/dx-du/dy)/(6.37e6*cos(lat*3.1416/180))
>
>    The above example assumes an X-Y varying dimension environment. Note
>    that the intrinsic variables lat and lon give results in degrees and
>    must be converted to radians in the calaculation. Also note the radius of
>    the earth is assumed to be 6.37e6 meters thus the U and V winds are
>    assumed to have units of m/sec.
>
>    2. Temperature advection can be calculated using the cdiff function as
>    follows:
>
>    define dtx = cdiff(t,x)define dty = cdiff(t,y)define dx =
>    cdiff(lon,x)*3.1416/180define dy = cdiff(lat,y)*3.1416/180display -1*(
>    (u*dtx)/(cos(lat*3.1416/180)*dx) + v*dty/dy )/6.37e6
>
>    where the variable t is temperature, u is the U component of the wind,
>    and v is the V component of the wind.
>
> --
> Prof. Ricardo Hallak
> Laboratório de Meteorologia de Mesoescala - LMM
> Departamento de Ciências Atmosféricas
> Instituto de Astronomia, Geofísica e Ciências Atmosféricas
> Universidade de São Paulo
>
> Phone: +55(11)3091-4698
>
>
> Em ter., 16 de jun. de 2020 às 23:25, lpasmanoranjan <
> lpasmanoranjan at gmail.com> escreveu:
>
>> Dear Users,
>> I would like to calculate horizontal temperature gradient. The following
>> script plots strange values. Perhaps I am making some mistake, would anyone
>> please check the script.
>>
>> dtx = cdiff(t,x)
>> dx = cdiff(lon,x)*3.1416*6.37e6*cos(lat*3.1416)
>> d dtx/dx
>>
>> Thank you.
>> --
>> Kind Regards,
>> Mano
>> _______________________________________________
>> 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, Research Scientist
University of Colorado Boulder
Cooperative Institute for Research in Environmental Sciences
NOAA/OAR/ESRL/Global Systems Laboratory
Boulder, CO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20200616/19dae1eb/attachment.html>


More information about the gradsusr mailing list