comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Formatting strings to coordinates
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Formatting strings to coordinates [message #20138] Fri, 19 May 2000 00:00
Paul van Delst is currently offline  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
Re: Formatting strings to coordinates [message #20143 is a reply to message #20138] Fri, 19 May 2000 00:00 Go to previous message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
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".
>
> I would like to be able to take this array of strings and convert it to
> a numerical array or real latitudes and longitudes, from -90 to 90 and 0
> to 360 so that they can eventually be plotted onto a globe.
>
> I've figured out how to use strings to generate numerical values (ie:
> 'Jan' -> 1, 'Feb' -> 2, etc..), but not how to handle parts of strings
> to modify the other parts.
>
> Any suggestions? This group has been a major help so far!
>
> Thanks,
>
> Simon


For example...

lat1 = ['43.92�S', '43.92�N', '43.92�S', '43.92�N']
lat2 = (-2 * (strpos(lat1, 'S') ge 0) + 1) * float(lat1)


--

Andrew Loughe **********************************************************
NOAA/FSL/AD Mailstop: R/FS5 * Email: loughe@fsl.noaa.gov
325 Broadway * Web: www-ad.fsl.noaa.gov/users/loughe/
Boulder, CO 80303 * Phn/Fax: (303)497-6211 / (303)497-6301
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: returning values from widget hierarchy
Next Topic: returning values from widget hierarchy

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:53:21 PDT 2025

Total time taken to generate the page: 0.00403 seconds