question about LINEAR definition

Charles Seman Charles.Seman at NOAA.GOV
Fri Dec 16 16:09:06 EST 2005


Dan,

The "xdef" "increment" is in "degrees longitude" as measured on the globe.
The "ydef" "increment" is in "degrees latitude" as measured on the globe.

I think you'll have to convert your 5 km increment to "degrees"... Note,
in general, if dx = dy, the "xdef" and "ydef" increments will not be the
same (only at the Equator).

Here is some code from a Unix C-Shell script that we use to convert the
WRF model constant "dx", "dy" to "degrees"...

-----------------------------------------------------------------------------------------------------------------------
#-----
#
#  echo Convert Horizontal Grid Spacings from units of "m" to "degrees"
#
#-----

   set earth_radius = 6370000    # meters
   set pie = `(echo "scale=10; 4*a(1)" | bc -l)`
#
# Convert "hcoord_cen_lat" from "degrees" to "radians" for "bc"
calculator...
#
   set hcoord_cen_lat_rad = `(echo "scale=10; $hcoord_cen_lat*$pie/180"
| bc -l)`
#
# "m_per_lat_deg" valid at the Equator for all longitudes, and at all
latitudes...
# "m_per_lon_deg" at central latitude...
#
   set m_per_lat_deg = `(echo "scale=10; $earth_radius*$pie/180" | bc
-l)`
   set m_per_lon_deg = `(echo "scale=10;
$m_per_lat_deg*c($hcoord_cen_lat_rad)" | bc -l)`
#
# convert "hcoord_dx", "hcoord_dy" to "hcoord_dlon", "hcoord_dlat"
(meters to degrees)
# GrADS needs grid spacings in "degrees"...
#
   set hcoord_dlon = `(echo "scale=10; $hcoord_dx/$m_per_lon_deg" | bc -l)`
   set hcoord_dlat = `(echo "scale=10; $hcoord_dy/$m_per_lat_deg" | bc -l)`

-----------------------------------------------------------------------------------------------------------------------

Note, the "bc" calculator is used... Here is some documentation from the
"bc" man page:

   MATH LIBRARY
       If bc is invoked with the -l option, a math library is preloaded
and the default scale is set
       to  20.    The  math  functions  will calculate their results to
the scale set at the time of
       their call.  The math library defines the following functions:

       s (x)  The sine of x, x is in radians.

       c (x)  The cosine of x, x is in radians.

       a (x)  The arctangent of x, arctangent returns radians.

       l (x)  The natural logarithm of x.

       e (x)  The exponential function of raising e to the value x.

       j (n,x)
              The bessel function of integer order n of x.

   EXAMPLES
       In /bin/sh,  the following will assign the value of "pi" to the
shell variable pi.

              pi=$(echo "scale=10; 4*a(1)" | bc -l)
-----------------------------------------------------------------------------------------------------------------------

I hope this helps.  Please let me know if you have any questions about
this, OK?

Thanks,
Chuck

Dan Leins wrote:

> When looking at the definition of how to use the LINEAR
> option...specifically the increment section...
>
> increment -- the spacing between grid values in the Y direction. It is
> assumed that the Y dimension values go from south to north. Specified
> as a positive floating point value. Used only for LINEAR mapping.
>
> What exactly is the "spacing" measured in....kilometers?  Thinking it
> was measured in kilometers, and knowing that I'm mapping 5km data, I
> tried setting the increment to 5, however what I got was FAR from
> desirable.
>
> Thanks,
> Dan


--

********************************************************************
 Charles Seman                                charles.seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20051216/81200e2c/attachment.html 


More information about the gradsusr mailing list