Re: Formatting strings to coordinates [message #20138] |
Fri, 19 May 2000 00:00  |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
Simon de Vet wrote:
>
> The data analysis adventure continues... I have read in the data, and am
> now working on the various plots.
>
> I have a string array, taken from the text file, of coordinates.
> However, they are in the form "43.92�S" ,and "176.50�W".
Off the top of my head, I can think of two ways:
1) The STR_SEP method where the degree symbol, �, is the separator. The
first element of the result is then just the number in string form. By
using FLOAT, you'll have a real number. (However, I don't know how to
represent the symbol � in the command....ASCII escape sequence or
something like that?)
2) Lopping off the last two characters manually, e.g.:
c_lat = "43.92�S"
len = STRLEN( STRTRIM( c_lat, 2 ) ) ; Make sure there are no " " at
the end
c_lat = STRMID( c_lat, 0, len - 2 )
lat = FLOAT( c_lat )
I do this sort of thing all the time reading in radiosonde data
good luck
paulv
--
Paul van Delst Ph: (301) 763-8000 x7274
CIMSS @ NOAA/NCEP Fax: (301) 763-8545
Rm.202, 5200 Auth Rd. Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746
|
|
|