3
$\begingroup$

If I use WeatherData[], only some of my requests work. For example if I use

WeatherData[{"Chicago", 3}]

I get the correct output:

{"C3175", "KCGX", "C8163"}

But if I try

WeatherData["Chicago", "Temperature"]

I get:

$Failed

Other Collections of Curated Data like ChemicalData[] work fine, so I don't think it's a connection problem.

$\endgroup$
  • $\begingroup$ I know that's not a general problem, but maybe someone experienced a similar behaviour and could fix the problem somehow. $\endgroup$ – RMMA Aug 19 '14 at 7:07
  • $\begingroup$ Works well with me (22.8 C). Retry with a fresh kernel $\endgroup$ – eldo Aug 19 '14 at 9:20
  • $\begingroup$ I already tried to restart the kernel, but the result is still the same. $\endgroup$ – RMMA Aug 19 '14 at 10:19
  • $\begingroup$ What operating system do you have? $\endgroup$ – eldo Aug 19 '14 at 10:26
  • $\begingroup$ Windows7 SP1 32bit $\endgroup$ – RMMA Aug 19 '14 at 11:07
1
$\begingroup$

This will find the temperature at each of the weather stations:-

stations = WeatherData[{"Chicago", 3}]

{"C3175", "KCGX", "C8163"}

WeatherData[# , "Temperature"] & /@ stations

{23.3, 14., 2.8}

P.S.

WeatherData["Chicago", "Temperature"]

23.

Works ok, but it might be more reliable to use the nearest weather station.

| improve this answer | |
$\endgroup$
  • $\begingroup$ for me the second part (WeatherData[# , "Temperature"] & /@ stations) doesn't work. The output is {$Failed, $Failed, $Failed}. $\endgroup$ – RMMA Aug 19 '14 at 11:09
1
$\begingroup$

Extended comment

In version 10 you get Quantity data

$Version

"10.0 for Mac OS X x86 (64-bit) (September 10, 2014)"

stations = WeatherData[{"Chicago", 3}]

{"C3175", "KCGX", "C8163"}

WeatherData[#, "Coordinates"] & /@ stations

{GeoPosition[{41.834, -87.64}], GeoPosition[{41.859, -87.608}],
GeoPosition[{41.905, -87.673}]}

tempC = WeatherData[#, "Temperature"] & /@ stations

{Quantity[12.8, "DegreesCelsius"], Quantity[14., "DegreesCelsius"],
Quantity[2.8, "DegreesCelsius"]}

tempF = UnitConvert[#, "DegreesFahrenheit"] & /@ tempC

{Quantity[55.04, "DegreesFahrenheit"], Quantity[57.2, "DegreesFahrenheit"], Quantity[37.04, "DegreesFahrenheit"]}

WeatherData["Chicago", "Temperature"]

Quantity[12., "DegreesCelsius"]

UnitConvert[#, "DegreesFahrenheit"] &[%]

Quantity[53.6, "DegreesFahrenheit"]

| improve this answer | |
$\endgroup$
0
$\begingroup$

According to the documentation WeatherData[station,"Temperature"] extracts the "latest" recorded temperature from that station. But it has in its database many stations that are no longer operational. In this case it may return a not available value, however sometimes the last recorded value which may lie years in the past.

i.e. the following extracts 10 stations within Helsinki

helsinki = WeatherData[{"EFHF", 10}]

giving

{EFHF,D3495,D3161,EFHK,C4473,AP089,C3552,WMO02991,D2819,AS468}

Pulling out the current temperature:

WeatherData[#, "Temperature"] & /@ helsinki

yields the partially absurd result (today is June 25, 2017!):

$$ \{-1.9\text{${}^{\circ}$C},-,-,16.\text{${}^{\circ}$C},-,-,-,13.4\text{${}^{\circ}$C},15.6\text{${}^{\circ}$C},6.7\text{${}^{\circ}$C}\} $$

Checking the date range of observations at the stations shows that some of the stations stopped observing many years ago:

WeatherData[#, "DateRange"] & /@ helsinki

$$ \left( \begin{array}{cc} \{2008,3,1,0,20,0\} & \{2017,3,6,15,50,0\} \\ \{2011,5,4,16,0,0\} & \{2013,12,11,12,36,0\} \\ \{2011,5,4,16,0,0\} & \{2013,12,11,12,36,0\} \\ \{1952,1,1,0,0,0\} & \{2017,6,25,14,50,0\} \\ \{2011,5,4,16,0,0\} & \{2013,12,11,12,36,0\} \\ \{2011,5,4,16,0,0\} & \{2013,12,11,12,36,0\} \\ \{2011,5,4,16,0,0\} & \{2013,12,11,12,36,0\} \\ \{2004,8,3,12,0,0\} & \{2017,6,25,13,50,0\} \\ \{2009,5,5,15,21,0\} & \{2017,6,25,14,59,0\} \\ \{2008,3,1,0,15,0\} & \{2015,12,7,11,43,0\} \\ \end{array} \right) $$

Obviously, e.g. the absurd value of -1.9°C for the station EFHF was recorded on March 6, 2017 at at 15:50.

This is a bug - WeatherData should return temperatures only if available or provide a warning. If one adds as a third argument to WeatherData a date specification, TimeSeries are returned from those stations that are currently still operational. I'd expect this for "curated" data.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.