I want to use scipy.interpolate.SmoothSphereBivariateSpline
to interpolate the temperature on the map (I am not familiar with data interpolation, so this may not be a good choice, but I would like to let go of it).
Here is what I did:
- Download the data from the tsv file, which looks like this:
latitude longitude temperature city
30.22 120.14 39 2caves
30.26 120.13 39 3caves
30.23 120.13 39 Anlong
33.48 108.5 30 Anda
37.2 100.74 15 Anan
...
in pandas
data = pandas.read_table('temp.tsv')
Get radians from lat, lon:
theta = numpy.array(data.latitude) / 180 * numpy.pi
phi = numpy.array(data.longitude) / 180 * numpy.pi
temp = numpy.array(data.temperature)
Submit them to scipy:
lut = SmoothSphereBivariateSpline(theta, phi, temps)
Then the function throws a ValueError value:
ValueError: : nxest nyest . .
s : 1, 2, 3 7000, 8000, . , ?