MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica 5,6,7 WeatherData, CityData

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94184] Re: Mathematica 5,6,7 WeatherData, CityData
  • From: Mac <mwjdavidson at googlemail.com>
  • Date: Sat, 6 Dec 2008 19:56:20 -0500 (EST)
  • References: <gh5nqh$odq$1@smc.vnet.net> <gh8hgg$qt8$1@smc.vnet.net>

Tugrul,

There is some weather data for Kenya but no instantaneous
precipitation measurements. However, there are total accumulation
values meaning that if you can live with daily, weekly or monthly
total precipitation amounts you do have access to data via
Mathematica. Here some basic code snippits to illustrate.

1) A list of all weather stations in Kenya

In[168]:= kenyastations = (WeatherData[#] & /@ (CityData[#,
         "Coordinates"] & /@ CityData[{All, "Kenya"}] //
      DeleteCases[#, {_Missing, _Missing}] &) // Union)

Out[168]= {"HKEL", "HKGA", "HKJK", "HKKI", "HKKR", "HKKT", "HKLO", \
"HKLU", "HKMA", "HKMB", "HKME", "HKML", "HKMO", "HKNA", "HKNC", \
"HKNK", "HKNW", "HKVO", "HKWJ", "HTAR", "HTMS", "HTMU", "HTTG", \
"HUTO", "WMO63688"}

2) Weekly total precipitation for weather station "HKGA"

In[171]:= WeatherData["HKGA", "TotalPrecipitation", {{2007, 1,
   1}, {2007, 12, 31}, "Week"}]

Out[171]= {{{2007, 1, 1}, 0.}, {{2007, 1, 7}, 0.}, {{2007, 1, 14},
  0.}, {{2007, 1, 21}, 0.}, {{2007, 1, 28}, 0.}, {{2007, 2, 4},
  0.}, {{2007, 2, 11}, 0.}, {{2007, 2, 18}, 0.}, {{2007, 2, 25},
  0.}, {{2007, 3, 4}, 0.}, {{2007, 3, 11}, 0.61}, {{2007, 3, 18},
  0.71}, {{2007, 3, 25}, 0.}, {{2007, 4, 1}, 0.}, {{2007, 4, 8},
  0.}, {{2007, 4, 15}, 0.}, {{2007, 4, 22}, 0.2}, {{2007, 4, 29},
  0.1}, {{2007, 5, 6}, 1.4}, {{2007, 5, 13}, 0.}, {{2007, 5, 20},
  0.}, {{2007, 5, 27}, 0.}, {{2007, 6, 3}, 0.81}, {{2007, 6, 10},
  0.}, {{2007, 6, 17}, 0.}, {{2007, 6, 24}, 0.}, {{2007, 7, 1},
  0.}, {{2007, 7, 8}, 0.}, {{2007, 7, 15}, 0.05}, {{2007, 7, 22},
  0.}, {{2007, 7, 29}, 0.}, {{2007, 8, 5}, 0.}, {{2007, 8, 12},
  0.1}, {{2007, 8, 19}, 0.81}, {{2007, 8, 26}, 0.}, {{2007, 9, 2},
  0.}, {{2007, 9, 9}, 0.}, {{2007, 9, 16}, 0.}, {{2007, 9, 23},
  0.71}, {{2007, 9, 30}, 0.1}, {{2007, 10, 7}, 0.3}, {{2007, 10, 14},
  0.}, {{2007, 10, 21}, 1.42}, {{2007, 10, 28}, 0.}, {{2007, 11, 4},
  0.4}, {{2007, 11, 11}, 9.88}, {{2007, 11, 18},
  2.56}, {{2007, 11, 25}, 5.99}, {{2007, 12, 2},
  0.71}, {{2007, 12, 9}, 1.19}, {{2007, 12, 16}, 0.}, {{2007, 12, 23},
   0.}, {{2007, 12, 30}, 0.}}

3) A command to plot the previous result

In[172]:= DateListPlot[%, Joined -> True, Filling -> Axis]

For the rest refer to the documentation.

Hope this helps.

Mac

On Dec 6, 12:13 pm, "Tugrul Temel" <tem... at xs4all.nl> wrote:
> Dear All,
>
> I also liked the Whether Data option. It is an excellent utility for spat=
ial
> analysis. But I wonder how I can get, for example, Precipitation Rate for
> Kenya.
>
> Please let me know your input.
>
> Regards,
> Tugrul
>
> -----Original Message-----
> From: Mac [mailto:mwjdavid... at googlemail.com]
> Sent: Friday, December 05, 2008 1:04 PM
> Subject:  Re: Mathematica 5,6,7 WeatherData, CityData
>
> I'm also very impressed with the possibilities offered by the newweathers=
tation function in Mathematica 7.0. The geographical and
> environmental data functions for Mathematica are growing quickly and
> valuable (at least to me).
>
> My guess is for the city data function that Wolfram is limited by the
> data source that they are using. It is not clear to me how much
> Wolfram is actively contributing to filling gaps in the dataset as
> coordinates for cities can be derived from a number of locations. I've
> proposed data for some missing cities to them but never got feedback.
>
> Out of interest I tried the following functions to determine what
> percentage of cities in CityData have coordinates.
>
> In[61]:= allcities =
>   Flatten[CityData[{All, #}] & /@ CountryData[] , {1, 2}];
>
> In[62]:= allcities // Dimensions
>
> Out[62]= {163391, 3}
>
> In[63]:= DeleteCases[
>   CityData[#, "Coordinates"] & /@
>    allcities, {_Missing, _Missing}] // Dimensions
>
> Out[63]= {148733, 2}
>
> In short - about 90% (or 148733/163391*100) of cities have coordinates
> associated with them. Deventer must belong to the 10% without
> coordinates.
>
> Still this is not too bad and certainly a lot of useful data.
>
> Mac
>
> On Dec 4, 1:13 pm, "sjoerd.c.devr... at gmail.com"
> <sjoerd.c.devr... at gmail.com> wrote:
> > You're right here.
>
> > The "Shape" properties of The Netherlands falls woefully short. Ik
> > looks a bit like a 1930 map or so. The "FullPolygon" data set is
> > somewhat better, with the large Waddenzee islands present, though one
> > of the IJsselmeer polders is still missing.
>
> > I suggest you collect your own contour using a google earth bitmap and
> > mathematica's coordinate picker tool. Shouldn't be too difficult, but
> > getting lat/longs right might be more complex.
>
> > Deventer has indeed its coordinates missing from the database.
> > Mathematica does know its population though. Not very satisfactory, I
> > agree.
>
> > Cheers -- Sjoerd
>
> > On Dec 3, 12:42 pm, P_ter <petervansumme... at gmail.com> wrote:> Hello,
>
> > > I was impressed by an example for Mathematica 7.0, that is, the globe=
 w=
> it=
>
> > h theweatherstations. So, I wanted to make something like that for the =
Ne=
> =
> > therlands.> First of all, have a look atwww.maps.google.nltocomparethat=
 =
> map with th=
>
> > e map from the CountryData: islands are missing, a famous dike is missi=
ng=
> , =
> > and a piece of land won from the sea is missing. So making a polygon fo=
r =
> th=
> > e Netherlands does not work.
>
> > > How to find all theweatherstations in the Netherlands with Mathematic=
a?=
> =
>
> >  There is no method to determine if aweatherstation is in a certain c=
ou=
> nt=
> > ry.> It is here that I stumbled also on holes in CityData: CityData[{Al=
l,=
>  "Ove=
>
> > rijssel", "Netherlands"}] shows that the city Deventer is in it.> But w=
he=
> n I do: CityData[{"Deventer", "Netherlands"}, "Coordinates"],
> > > I get: {Missing["NotAvailable"], Missing["NotAvailable"]}
>
> > > It means that the missing coordinates make it difficult to combine th=
e =
> av=
>
> > ailable CityData and WeatherData as to determine if aweatherstation is =
(n=
> =
> > ear a city) in the Netherlands.
>
> > > ??
> > > with friendly greetings,
> > > P_ter



  • Prev by Date: Re: Subscripts in version 7
  • Next by Date: Re: Subscripts in version 7
  • Previous by thread: Re: Mathematica 5,6,7 WeatherData, CityData
  • Next by thread: Re: Mathematica 5,6,7 WeatherData, CityData