Format Number
Charles Seman
Charles.Seman at NOAA.GOV
Thu Jan 5 17:17:52 EST 2006
Hi Stefan,
Please see GrADS Scripting Language Math Functions:
"math_nint" and "math_int"
at:
http://grads.iges.org/grads/gadoc/mathfunctions.html
and examples
* INTEGER CONVERSION
if (doint)
print 'Real-to-integer conversion:'
v = 3.0
while(v < 4.0)
rc1 = math_nint(v)
rc2 = math_int(v)
print 'nint of 'v' = 'rc1' int of 'v' = 'rc2
v = v + 0.1
endwhile
print ' '
endif
in script:
ftp://grads.iges.org/grads/scripts/script_math_demo.gs
I hope this helps,
Chuck
Stefan Echeff wrote:
>Hi all GrADS users,
>
>first, I'd like to wish you a happy New Year 2006.
>
>I try to write in a file the result of a display. I have no problem to do
>it. But I'd like to right the out as an integer.
>
>For example : at now my file looks like
>
>61;-11;123.5
>61;-10.5;135.8
>
>the first column is the latitude, the second is the longitude and the last
>HGT in meters.
>I would like to write HGT as an integer.
>
>61;-11;123
>61;-10.5;136
>
>How can I round my HGT ?
>
>
>Best regards from Stéfan
>
>
--
********************************************************************
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."
More information about the gradsusr
mailing list