Commit 4f526cde authored by R.K.Garcia's avatar R.K.Garcia
Browse files

technically a negation and not an inversion

parent 4e7d559a
......@@ -372,23 +372,23 @@ class HimawariAHIasCMIP(object):
_, _, mb = self._hs.coords(lines=1, columns=1, unscaled=True)
y, x = self.y, self.x
def yx_pvda(name, v, m, b, invert=False):
def yx_pvda(name, v, m, b, negate=False):
assert (name in {'y', 'x'})
a = {
'.dtype': np.int16, # annotation telling goesr.rockfall.nc_write what kind of var to make
'units': 'rad',
'long_name': "AHI fixed grid projection %s-coordinate" % name,
'standard_name': "projection_%s_coordinate" % name,
'scale_factor': -m if invert else m, # PUG has negative y north of equator; prefer monotonic +1 raw value however
'add_offset': -b if invert else b # ref GIT 3ebfc9ab1f
'scale_factor': -m if negate else m, # PUG has negative y north of equator; prefer monotonic +1 raw value however
'add_offset': -b if negate else b # ref GIT 3ebfc9ab1f
}
# y/x
yield self.p(name), -v if invert else v, self.d(name), a
yield self.p(name), -v if negate else v, self.d(name), a
# y_image/x_image single value
v_image = np.nanmean(v)
a['long_name'] = "AHI fixed grid projection %s-coordinate center of image" % name,
yield self.p('%s_image' % name), -v_image if invert else v_image, {}, a
yield self.p('%s_image' % name), -v_image if negate else v_image, {}, a
# y_image_bounds
vrange = np.array([np.nanmin(v), np.nanmax(v)])
......@@ -398,10 +398,10 @@ class HimawariAHIasCMIP(object):
}[name]
a = {}
a['long_name'] = "AHI fixed grid projection %s-coordinate %s extent of image" % (name, nsew)
yield self.p('%s_image_bounds' % name), -vrange if invert else vrange, self.d(DEFAULT_YX_BOUNDS_NAME), a
yield self.p('%s_image_bounds' % name), -vrange if negate else vrange, self.d(DEFAULT_YX_BOUNDS_NAME), a
# y and x variables and their bounds and centerpoints
for each in yx_pvda('y', y, mb.my, mb.by, invert=True):
for each in yx_pvda('y', y, mb.my, mb.by, negate=True):
yield each
for each in yx_pvda('x', x, mb.mx, mb.bx):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment