Commit 2afd8450 authored by R.K.Garcia's avatar R.K.Garcia
Browse files

better fix for y angles

parent 4f526cde
......@@ -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, negate=False):
def yx_frames(name, v, m, b, negate_scaling=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 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
'scale_factor': -m if negate_scaling else m,
'add_offset': -b if negate_scaling else b # ref GIT 3ebfc9ab1f
}
# y/x
yield self.p(name), -v if negate else v, self.d(name), a
yield self.p(name), 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 negate else v_image, {}, a
yield self.p('%s_image' % name), v_image, {}, a
# y_image_bounds
vrange = np.array([np.nanmin(v), np.nanmax(v)])
......@@ -398,13 +398,13 @@ 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 negate else vrange, self.d(DEFAULT_YX_BOUNDS_NAME), a
yield self.p('%s_image_bounds' % name), 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, negate=True):
for each in yx_frames('y', y, mb.my, mb.by, negate_scaling=True):
yield each
for each in yx_pvda('x', x, mb.mx, mb.bx):
for each in yx_frames('x', x, mb.mx, mb.bx):
yield each
def pvda_nav(self):
......@@ -576,8 +576,13 @@ class HimawariAHIasCMIP(object):
@property
def y(self):
"""
negate y values to match PUG convention
also see yx_pvda regarding negation of scale_factor and add_offset to keep monotonic increasing unscaled values
:return:
"""
y, _ = self._hs.coords(columns=1)
return y.squeeze()
return -y.squeeze()
@property
def x(self):
......
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