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

fix to inverting y

had to both invert sf/ao and the value itself,
since sf/ao are removed during netcdf storage
parent 18a81a53
......@@ -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):
def yx_pvda(name, v, m, b, invert=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 name=='y' else m, # PUG has negative y north of equator
'add_offset': -b if name=='y' else b # ref GIT 3ebfc9ab1f
'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
# y/x
yield self.p(name), v, self.d(name), a
yield self.p(name), -v if invert 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, {}, a
yield self.p('%s_image' % name), -v_image if invert else v_image, {}, a
# y_image_bounds
vrange = np.array([np.nanmin(v), np.nanmax(v)])
......@@ -398,10 +398,10 @@ class HimawariAHIasCMIP(object):
a = {}
a['long_name'] = "AHI fixed grid projection %s-coordinate %s extent of image" % (name, nsew)
yield self.p('%s_image_bounds' % name), vrange, self.d(DEFAULT_YX_BOUNDS_NAME), a
yield self.p('%s_image_bounds' % name), -vrange if invert 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,,
for each in yx_pvda('y', y,,, invert=True):
yield each
for each in yx_pvda('x', x,, mb.bx):
Supports Markdown
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