Skip to content
Snippets Groups Projects
Commit 4e2cd703 authored by Ray Garcia's avatar Ray Garcia :scream_cat:
Browse files

alternate calculation of line and column

parent f2bff176
No related tags found
No related merge requests found
......@@ -433,14 +433,14 @@ class PugL1bTools(object):
# convert to nadir-meters using proj4
xm, ym = proj(lon, lat, inverse=False)
# divide out height to get back to projection view angles
h = self.nav['perspective_point_height']
y, x = ym / h, xm / h
h = float(self.nav['perspective_point_height'])
# y, x = ym / h, xm / h
# extract scale factor and add offset to back out to line-from-0, column-from-0
yvar, xvar = self.nc[self.y_var_name], self.nc[self.x_var_name]
ysf, yao = yvar.scale_factor, yvar.add_offset
xsf, xao = xvar.scale_factor, xvar.add_offset
ysf, yao = float(yvar.scale_factor) * h, float(yvar.add_offset) * h
xsf, xao = float(xvar.scale_factor) * h, float(xvar.add_offset) * h
# reverse scale factor and add offset to get line and column
line, column = (y - yao) / ysf, (x - xao) / xsf
line, column = (ym - yao) / ysf, (xm - xao) / xsf
# round to nearest integer
if round:
return np.round(line).astype(np.int32), np.round(column).astype(np.int32)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment