Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

forecast

 [1/6] from: ryan::christiansen::intellisol::com at: 7-May-2001 13:53


I thought I'd share this quick function for any web developers who may be interested in grabbing National Weather Service (U.S.) forecasts from Accuweather.com. forecast: func [ ZIP [integer!] {The ZIP code for where you want the forecast} /local weather-URL weather-info future-weather ][ weather-URL: make url! rejoin [{http://www.accuweather.com/adcbin/local_index?thisZip=} ZIP {&nav=home}] weather-info: read weather-URL parse/all weather-info [thru "^/." copy text to "^/^/" (future-weather: copy text)] future-weather ] USAGE example...
>> print forecast 98270
connecting to: www.accuweather.com THIS AFTERNOON...MOSTLY SUNNY THEN INCREASING CLOUDS. HIGHS IN THE 60S. WIND LIGHT AND VARIABLE...BECOMING SOUTHWEST 5 TO 10 MPH LATE. .TONIGHT...CLOUDY. A CHANCE OF LIGHT RAIN OR DRIZZLE. LOWS AROUND 45. WIND SOUTHWEST 10 TO 15 MPH EXCEPT NORTHWEST TO 10 MPH NORTH OF SEATTLE. .TUESDAY...MOSTLY CLOUDY WITH SPRINKLES OR DRIZZLE MAINLY IN THE MORNING. HIGHS 55 TO 60. SOUTHWEST WIND 10 TO 15 MPH BECOMING NORTHWEST 5 TO 15 MPH LATE. .< TEMPERATURE / PRECIPITATION SEATTLE 65 45 59 / 10 30 20 EVERETT 62 45 58 / 10 40 30 SHELTON 67 45 60 / 10 20 20
>>
Ryan C. Christiansen Web Developer Intellisol International 4733 Amber Valley Parkway Fargo, ND 58104 701-235-3390 ext. 6671 FAX: 701-235-9940 http://www.intellisol.com Global Leader in People Performance Software _____________________________________ Confidentiality Notice This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email to [ryan--christiansen--intellisol--com]

 [2/6] from: thundrebol:ya:hoo at: 7-May-2001 12:38


Thanks for this cool script, Ryan. You might want to change that integer! argument to a string! in that function definition, since there are Zip codes that begin with a zero (like mine): ;snip------------- forecast: func [ ZIP [string!] ...
>> print forecast "07940"
... ;end snip------------ Cheers. --- [ryan--christiansen--intellisol--com] wrote:

 [3/6] from: chris:ross-gill at: 7-May-2001 16:19


Hi Ed,
> You might want to change that integer! argument to a > string! in that function definition, since there are > Zip codes that begin with a zero (like mine):
Or an issue! as that is its purpose :o)
>> forecast #02155
- Chris

 [4/6] from: mike_berrisford:admin:state:ak:us at: 7-May-2001 13:34


An interger that begins with a zero is still an integer ? integer? 12345 == true
>> integer? 01234
== true

 [5/6] from: chris:ross-gill at: 7-May-2001 18:24


Hi,
> An interger that begins with a zero is still an integer ? > > integer? 12345 > == true > >> integer? 01234 > == true
For the purposes of joining it to a url! or a string! -
>> zip: 02155
== 2155
>> type? zip
== integer!
>> join "My zip is " zip
== "My zip is 2155" Isn't quite true. Whereas -
>> zip: #02155
== #02155
>> type? zip
== issue!
>> join "My zip is " zip
== "My zip is 02155" Is correct. - Chris

 [6/6] from: ammoncooke:yaho:o at: 7-May-2001 17:17


yes it is still an integer, but the first zero gets dropped. HTH Ammon