def get self lat lon if lon lon 360 fy 90 lat self rlatres fx lon self

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
def get(self, lat, lon):
if lon < 0:
lon += 360
fy = (90 - lat) * self.rlatres
fx = lon * self.rlonres
iy = int(fy)
ix = int(fx)
fx -= ix
fy -= iy
if iy == self.height - 1:
iy -= 1
v00 = self._rawval(ix, iy)
v01 = self._rawval(ix+1, iy)
v10 = self._rawval(ix, iy+1)
v11 = self._rawval(ix+1, iy+1)
a = (1 - fx) * v00 + fx * v01
b = (1 - fx) * v10 + fx * v11
h = (1 - fy) * a + fy * b
return self.offset + self.scale * h