Dear friend, I try to find a code to estimate the temperature in any coordinate of a country or region using the weather station information. Here it is an example for Italy, however some thing is wrong. Any help
stations = GeoEntities[Entity["Country", "Italy"], "WeatherStation"];
locs = DeleteMissing[Through[stations["Position"]]];
temp = DeleteMissing[AirTemperatureData /@ stations];
PointValuePlot[locs -> temp, ColorFunction -> "Rainbow"]
sf = SpatialEstimate[locs -> temp]
sf[{45, 10}]
The documentation states that the locations can be GeoPosition and the values can be Quantity , but it does not work for your example. This does
sf = SpatialEstimate[(locs /. GeoPosition -> Identity) -> QuantityMagnitude@temp]
sf[{45, 10}]
(* 39.1 *)
This seems like a bug to me, you should report it to Wolfram Support.
Guillermo,
this might be a start:
stations = GeoEntities[Entity["Country", "Italy"], "WeatherStation"];
(* the data: *)
stationsData0 = Quiet[{#, #["Position"], AirTemperatureData[#]} & /@ stations];
(* data without "Missing[]" *)
stationsData = DeleteMissing[stationsData, 1, Infinity];
GeoDensityPlot[stationsData[[All, 2]] -> stationsData[[All, 3]],
ColorFunction -> "Rainbow", RegionFunction -> Entity["Country", "Italy"], GeoBackground -> None,
PlotLegends -> Automatic]
I guess that SpatialEstimate does not digest GeoPosition data; I would use cartesian coordinates (like UTM, i.e. their numeric values).
Addendum - @Rohit Namjoshi: I saw your post too late, sorry! Interestingly this works with units:
sf = SpatialEstimate[Identity @@@ stationsData1[[All, 2]] -> stationsData1[[All, 3]]]
but then the number which is given back seems to be the temperature in Kelvin:
Really strange!
[at0]: https://community.wolfram.com/web/rohitnamjoshi