<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: weather report as information source</title>
		<atom:link href="http://cycling74.com/forums/topic/weather-report-as-information-source/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/weather-report-as-information-source/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 22:40:43 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-24453</guid>
					<title><![CDATA[weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-24453</link>
					<pubDate>Thu, 16 Feb 2006 09:56:06 +0000</pubDate>
					<dc:creator>Falk</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70716</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70716</link>
					<pubDate>Thu, 16 Feb 2006 11:07:40 +0000</pubDate>
					<dc:creator>nick rothwell / cassiel</dc:creator>

					<description>
						<![CDATA[
						<p>Sure.</p>
<p>It might be fairly simple to reverse-engineer the weather report  <br />
Dashboard item under OS X&#8230; (failing that, to just google for a  <br />
weather report API).</p>
<p>	&#8211; N.</p>
<p>
   nick rothwell &#8212; composition, systems, performance &#8212; http:// <br />
<a href="http://www.cassiel.com" rel="nofollow">http://www.cassiel.com</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70717</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70717</link>
					<pubDate>Thu, 16 Feb 2006 16:46:05 +0000</pubDate>
					<dc:creator>Leafcutter John</dc:creator>

					<description>
						<![CDATA[
						<p>There is a Flight Simulator called X-Plane which periodically downloads current weather conditions for the region your are flying.</p>
<p>It uses files called &#8216;METAR.rwx&#8217; </p>
<p>Thats as much as i can tell you&#8230;.</p>
<p>john.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70718</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70718</link>
					<pubDate>Thu, 16 Feb 2006 17:31:03 +0000</pubDate>
					<dc:creator>projects</dc:creator>

					<description>
						<![CDATA[
						<p>> There is a Flight Simulator called X-Plane which periodically downloads current weather conditions for the region your are flying.</p>
<p>It probably uses the data from this service:</p>
<p><a href="http://adds.aviationweather.gov/java/" rel="nofollow">http://adds.aviationweather.gov/java/</a></p>
<p>Ben</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70719</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70719</link>
					<pubDate>Thu, 16 Feb 2006 17:32:16 +0000</pubDate>
					<dc:creator>mzed</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70720</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70720</link>
					<pubDate>Fri, 17 Feb 2006 00:55:44 +0000</pubDate>
					<dc:creator>jim altieri</dc:creator>

					<description>
						<![CDATA[
						<p>Hi friends,<br />
  Strangely enough, I&#8217;m working on a project right now where we take in clouds and visibility.  The easiest would be to use NOAA&#8217;s &#8220;experimental&#8221; XML feeds, but because they don&#8217;t include visibility data for that, I&#8217;m just using their good old METAR files available via FTP.  Find your URL for the one you want.  The one in my code is for Fairbanks.<br />
  So, like I said, I&#8217;m using the METAR files.  You can google for the specs.  I made some regular expressions to find the cloud and visibility data.<br />
  Hope this helps.  Perhaps Wally the bartender can move this thingy over to the Java thread?<br />
  In case you don&#8217;t want to scroll through my ugly code, here are the regex&#8217;s (note that they&#8217;re double-escaped for use in java string literals):</p>
<p>Visibility: \s((9{4})|(M?(\d{1,2})?\s?(\d/\d)?SM))\s<br />
Clouds: \s((((VV|OVC|BKN|SCT|FEW)\d{3}(TCU|CB)?)|(SKC|CLR))\s)+</p>
<p>with love,<br />
jim</p>
<p>	private char[] URLReader() throws Exception // reads the metar file from the noa ftp server, and returns it as an array of chars<br />
	{<br />
		URL PAFAurl = new URL(&#8221; <a href="ftp://weather.noaa.gov/data/observations/metar/stations/PAFA" rel="nofollow">ftp://weather.noaa.gov/data/observations/metar/stations/PAFA</a> .TXT &#8220;);<br />
		BufferedReader instream = new BufferedReader(<br />
			new InputStreamReader(<br />
			PAFAurl.openStream()));</p>
<p>		char inbuffer[] = new char[2000];</p>
<p>		instream.read(inbuffer, 0, 2000);<br />
		instream.close();</p>
<p>		post(String.valueOf(inbuffer));	</p>
<p>		return inbuffer;<br />
	}</p>
<p>
	private void metarParser(char[] inbuffer) <br />
	{</p>
<p>		float visfloat = 0;<br />
		int cloudint = 0; // this will range from 0 at no clouds, to 4 at OVC/VV</p>
<p>		String inbufstring = String.valueOf(inbuffer);</p>
<p>		CharSequence inbufcharseq = inbufstring.subSequence(0, (inbufstring.length() &#8211; 1));</p>
<p>		Pattern p = Pattern.compile(&#8220;\s((9{4})|(M?(\d{1,2})?\s?(\d/\d)?SM))\s &#8220;);<br />
		Matcher m = p.matcher(inbufcharseq);</p>
<p>		if (m.find())<br />
		{<br />
			String visstring = m.group().trim();<br />
			//post(&#8220;the visibility string is: &#8220;+ visstring);<br />
			if (visstring == &#8220;9999&#8243;)<br />
			{<br />
				visfloat = 9999;<br />
			} else if (visstring == &#8220;M1/4SM&#8221;) // automated stations with less than 1/4 mile vis should report this<br />
			{<br />
				visfloat = (float)0.125;<br />
			} else<br />
			{<br />
				String dummyarray[] = visstring.split(&#8220;SM&#8221;); //trim off the &#8220;SM&#8221; at the end;<br />
				String visnumberstring = dummyarray[0];<br />
				//post(&#8220;the visnumberstring is: &#8220;+visnumberstring);<br />
				String visarray[] = visnumberstring.split(&#8220;/&#8221;);<br />
				if (visarray.length > 1) //if there&#8217;s a fraction<br />
				{<br />
					Float denom = Float.valueOf(visarray[1]);<br />
					String fracarray[] = visarray[0].split(&#8220;\s&#8221;);<br />
					if (fracarray.length > 1) // if it&#8217;s a mixed number<br />
					{<br />
						Float numerator = Float.valueOf(fracarray[1]);<br />
						Float wholepart = Float.valueOf(fracarray[0]);<br />
						visfloat = wholepart.floatValue() + (numerator.floatValue() / denom.floatValue());<br />
					} else<br />
					{<br />
						Float numerator = Float.valueOf(fracarray[0]);<br />
						visfloat = numerator.floatValue() / denom.floatValue();<br />
					}</p>
<p>				} else<br />
				{<br />
					visfloat = Float.valueOf(visarray[0]).floatValue();<br />
				}<br />
			}<br />
		} else<br />
		{<br />
			post(&#8220;couldn&#8217;t find the visibility in: &#8221; + inbufcharseq.toString());<br />
		}</p>
<p>
		p = Pattern.compile(&#8220;\s((((VV|OVC|BKN|SCT|FEW)\d{3}(TCU|CB)?)|(SKC|CLR))\s)+ &#8220;);<br />
		m = p.matcher(inbufcharseq);<br />
		if (m.find())<br />
		{<br />
			String cloudstring = m.group().trim();<br />
			//post(&#8220;the cloud cover string is: &#8220;+ cloudstring);</p>
<p>			String cloudstrings[] = cloudstring.split(&#8220;\s&#8221;);</p>
<p>			for (int i = 0; i < cloudstrings.length; i++)<br />
			{<br />
				char c = cloudstrings[i].charAt(0);<br />
				if ((c == &#8216;V&#8217;)||(c == &#8216;O&#8217;))<br />
				{<br />
					cloudint = 4;<br />
				} else if (c == &#8216;B&#8217;)<br />
				{<br />
					if (cloudint < 3)<br />
					{<br />
						cloudint = 3;<br />
					}<br />
				} else if ((c == &#8216;S&#8217;)&#038;&#038;(cloudstrings[i].charAt(1) == &#8216;C&#8217;)) //to make sure it&#8217;s SCT and not SKC<br />
				{<br />
					if (cloudint < 2) <br />
					{	<br />
						cloudint = 2;<br />
					}<br />
				} else if (c == &#8216;F&#8217;)<br />
				{<br />
					if (cloudint == 0)<br />
					{<br />
						cloudint = 1;<br />
					}<br />
				} else<br />
				{<br />
					post(&#8220;malformed cloud string:&#8221; + cloudstrings[i]);<br />
				}<br />
			}<br />
			//post(&#8220;the cloud cover int is: &#8220;+ String.valueOf(cloudint));<br />
		} else<br />
		{<br />
			post(&#8220;couldn&#8217;t find the cloud cover in: &#8221; + inbufcharseq.toString());<br />
		}</p>
<p>		outlet(1, cloudint);	<br />
		outlet(0, visfloat);		</p>
<p>	}</p>
<p>	public void update()<br />
	{<br />
		if (busyflag == 0)<br />
		{<br />
			busyflag = 1;<br />
			//create a new thread to do the weather stuff.  ftp takes a long time<br />
			Thread t = new Thread()<br />
			{<br />
				public void run()<br />
				{<br />
					boolean successfulread = true;</p>
<p>					try<br />
					{<br />
						post(&#8220;starting the read/parse&#8221;);<br />
						metarParser(URLReader());<br />
					}<br />
					catch (Exception e)<br />
					{<br />
						post(e.toString());<br />
					}</p>
<p>					busyflag = 0;<br />
				}<br />
			};<br />
			t.start(); //start the thread executing</p>
<p>		} else<br />
		{<br />
			post(&#8220;busy.  call back later.&#8221;);<br />
		}<br />
	}</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70721</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70721</link>
					<pubDate>Fri, 17 Feb 2006 10:34:33 +0000</pubDate>
					<dc:creator>nick rothwell / cassiel</dc:creator>

					<description>
						<![CDATA[
						<p>
On 16 Feb 2006, at 17:32, mzed wrote:</p>
<p>> And I&#8217;d think it wouldn&#8217;t be too hard to parse this out with Java.</p>
<p>Pretty easy; it&#8217;s not too onerous to link up MXJ, HTTP fetches and  <br />
dom4j to interpret incoming XML via XPath.</p>
<p>I&#8217;d do it, but why do I care about the weather in America? :-)</p>
<p>
   nick rothwell &#8212; composition, systems, performance &#8212; http:// <br />
<a href="http://www.cassiel.com" rel="nofollow">http://www.cassiel.com</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70722</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70722</link>
					<pubDate>Fri, 17 Feb 2006 10:55:07 +0000</pubDate>
					<dc:creator>Peter Castine</dc:creator>

					<description>
						<![CDATA[
						<p>On around Feb 17, 2006, at 11:34, Nick Rothwell said something like:<br />
> I&#8217;d do it, but why do I care about the weather in America? :-)</p>
<p>Because when Bush sneezes, Blair says &#8220;I&#8217;m with you&#8221;?</p>
<p>(Sorry, it was such an easy shot)</p>
<p>&#8211; P.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;    <a href="http://www.bek.no/~pcastine/Litter/" rel="nofollow">http://www.bek.no/~pcastine/Litter/</a>    &#8212;&#8212;&#8212;&#8212;&#8211;<br />
Peter Castine    |                             ^<br />
                  |         Litter Power &#038; Litter Bundle for Jitter<br />
<a href="mailto:pcastine@gmx.net">pcastine@gmx.net</a> |<br />
<a href="mailto:pcastine@bek.no">pcastine@bek.no</a>  | iCE:  Sequencing, Recording, and Interface Building<br />
<a href="mailto:4-15@kagi.com">4-15@kagi.com</a>    |       for Max/MSP<br />
                  |                                      Extremely cool<br />
                  |      <a href="http://www.dspaudio.com" rel="nofollow">http://www.dspaudio.com</a><br />
                  |      <a href="http://www.dspaudio.com/software/software.html" rel="nofollow">http://www.dspaudio.com/software/software.html</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70723</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70723</link>
					<pubDate>Fri, 17 Feb 2006 11:13:41 +0000</pubDate>
					<dc:creator>Patrick Delges</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70724</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70724</link>
					<pubDate>Fri, 17 Feb 2006 22:42:49 +0000</pubDate>
					<dc:creator>mzed</dc:creator>

					<description>
						<![CDATA[
						<p>I&#8217;m hip to that.  Try this site, then:</p>
<p><a href="http://www.rssweather.com/dir/" rel="nofollow">http://www.rssweather.com/dir/</a></p>
<p>mzed</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70725</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70725</link>
					<pubDate>Sat, 18 Feb 2006 01:55:52 +0000</pubDate>
					<dc:creator>mzed</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70726</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70726</link>
					<pubDate>Sat, 18 Feb 2006 02:43:00 +0000</pubDate>
					<dc:creator>mzed</dc:creator>

					<description>
						<![CDATA[
						<p>Ok.</p>
<p>With jit.uldl, my max patches now know the weather.  My solutions are here:</p>
<p><a href="http://homepage.mac.com/mikezed/weather.zip" rel="nofollow">http://homepage.mac.com/mikezed/weather.zip</a></p>
<p>And I&#8217;m still cleaing it up.</p>
<p>Still hoping for a non-Jitter method.</p>
<p>best,</p>
<p>mzed</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70727</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70727</link>
					<pubDate>Sat, 18 Feb 2006 09:27:50 +0000</pubDate>
					<dc:creator>Falk</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks everybody for the great hints.</p>
<p>Michael, my machine reports an error in finding your zip, could you <br />
paste it as text</p>
<p>thanks, Falk</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70728</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70728</link>
					<pubDate>Mon, 20 Feb 2006 19:17:17 +0000</pubDate>
					<dc:creator>mzed</dc:creator>

					<description>
						<![CDATA[
						<p>> ><br />
> > <a href="http://homepage.mac.com/mikezed/weather.zip" rel="nofollow">http://homepage.mac.com/mikezed/weather.zip</a><br />
> ></p>
<p>Sorry, I messed up. It should work now.</p>
<p>mz</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70729</guid>
					<title><![CDATA[Re: weather report as information source]]></title>
					<link>http://cycling74.com/forums/topic/weather-report-as-information-source/#post-70729</link>
					<pubDate>Tue, 21 Feb 2006 19:48:41 +0000</pubDate>
					<dc:creator>jim altieri</dc:creator>

					<description>
						<![CDATA[
						<p>michael,<br />
  sorry, but are you looking for something more than the java code that <br />
i posted before (repeated below)? replace the URL with the one <br />
appropriate for your weather station.  this gives you the noaa METAR <br />
report for any weather station.  turn this array of chars into a <br />
CharSequence, and use regexp to find the stuff you&#8217;re looking for.  the <br />
METAR specification is pretty rigorous and well documented on the web.<br />
-jim</p>
<p>private char[] URLReader() throws Exception // reads the metar file from the noaa ftp server, and returns it as an array of chars<br />
	{<br />
		URL PAFAurl = new URL(&#8221;   <a href="ftp://weather.noaa.gov/data/observations/metar/stations/PAFA" rel="nofollow">ftp://weather.noaa.gov/data/observations/metar/stations/PAFA</a> .TXT &#8220;);<br />
		BufferedReader instream = new BufferedReader(<br />
			new InputStreamReader(<br />
			PAFAurl.openStream()));</p>
<p>		char inbuffer[] = new char[2000];</p>
<p>		instream.read(inbuffer, 0, 2000);<br />
		instream.close();</p>
<p>		post(String.valueOf(inbuffer));	</p>
<p>		return inbuffer;<br />
	}</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

