From: Luc Barthelet on
My dear friend Sarah is in Europe and needs to fly back in the US this
week end. I wanted to follow up on the ash cloud evolution.
Here is the code that reads the reports from the London Volcanic Ash
Advisory Center, and displays it in Mathematica, which I think is pretty
cool.

Hopefully some of you will feel the need to improve on these few lines.
Make sure you copy me on the improvements. Maybe this would be worth a
wolfram blog post?
I searched for Volcanic Ash Cloud in Wolfram Alpha, but did not get any
answer.
( This is in version 7)
Enjoy,
Luc

VAAMessageLinks=Import /@
Select[Import["http://www.ssd.noaa.gov/VAAC/OTH/UK/messages.html","Hyperlinks"],
StringCases[#,".txt"]!={}&];
FormatDate[str_]:=DateString[ToExpression [StringTake[str,#]]&/@
{{1,4},{5,6},{7,8},{10,11},{12,13}}];
extractLatLong[str_]:=Reverse /@
Select[(StringCases[#,{"N"~~u__:>ToExpression[u]/100.,"S"~~u__:>-ToExpression[u]/100.,"W"~~u__:>-ToExpression[u]/100.,"E"~~u__:>ToExpression[u]/100.}][[1]]&
/@StringSplit[#," "])& /@ StringSplit[str,{"-","\n"}],Length[#]>0&];
renderVAAMessage[msg_]:=Module[{Observation,polys,color,Title,date},
date = StringCases[msg,"\nDTG: "~~Shortest[x__]~~"\n":>x][[1]];
Title="Volcanic Ash Cloud Over Europe Observed On "<>FormatDate[date];
Observation = StringReplace[StringCases[msg,"OBS VA
CLD:"~~Shortest[x__]~~Alternatives["FCST VA
CLD",EndOfString]:>x][[1]],"\n"->" "];
polys =
StringCases[Observation,Alternatives["SFC/FL"~~DigitCharacter..~~"
","FL"~~DigitCharacter..~~"/FL"~~DigitCharacter..]~~
Shortest[x__]~~Alternatives["FL"~~DigitCharacter..~~"/FL"~~DigitCharacter..,EndOfString]:>extractLatLong[x],Overlaps->True];
Graphics[{White,{EdgeForm[Gray],CountryData[#,"SchematicPolygon"]}&/@CountryData["Europe"],
Opacity[.5],MapIndexed[{color={Yellow,Red,Orange}[[#2[[1]]]];EdgeForm[color],FaceForm[color],Polygon[#1]}&,polys]
},ImageSize->700,PlotRange->{{-30,30},{35,70}},PlotLabel->Title]];
Manipulate[
renderVAAMessage[VAAMessageLinks[[date]]],{date,1,Length[VAAMessageLinks],1}]



 | 
Pages: 1
Prev: Button Problem
Next: cant free ram..