0
$\begingroup$

So the following code uses WeatherData to get a list of longitude, latitude and maximum wind-speed from 400 weather stations around Dallas and plots the data.

 dallas = CityData[{"Dallas", "Texas", "UnitedStates"}, "Coordinates"];
 With[{n = 400}, weatherStations = WeatherData[{dallas, n}]];
 coordinates = Through[weatherStations["Coordinates"]];
 dailyMaxWinds = 
 WeatherData[#,"MaxWindSpeed", {{2017, 8, 17}, {2017, 9, 3}, "Day"}] & /@ 
 weatherStations;
 maxWinds =
 (Max /@ DeleteCases[Through[dailyMaxWinds["Values"]], 
 Missing[_], {-2}, Heads -> True]) /. {"Values" -> 
 0., -\[Infinity] -> 0.};
 windData = MapThread[{Sequence @@ #1, #2} &, {coordinates, maxWinds}];
 ListPlot3D[windData]

enter image description here

What I want to do is "smooth" this graph out using Interpolation. I want to interpolate wind speed at specific coordinates using 'cubic' interpolation. I am able to "quietly" interpolate the data by doing

 windData = MapThread[{#1, #2} &, {coordinates, maxWinds}];
 windC=Quiet@Interpolation[windData];

But I am getting an input value error lies outside the range of data interpolation function. Extrapolation will be used if I try to plot it.

 Plot3D[windC[lat, lon], {lat, Min[windData[[All, 1]]], 
 Max[windData[[All, 1]]]}, {lon, Min[windData[[All, 2]]], 
 Max[windData[[All, 2]]]}]

Can anyone please help me with the code to smooth this graph?

$\endgroup$
  • $\begingroup$ If what you want to do is to smooth the data, then interpolation is probably not your best bet. Some kind of low pass filtering might be more applicable. $\endgroup$ – bill s Nov 20 '17 at 17:14
  • $\begingroup$ Hmmm... let me see how that works... $\endgroup$ – hwhorf Nov 20 '17 at 17:20

Your Answer

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

Browse other questions tagged or ask your own question.