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): ...@@ -372,23 +372,23 @@ class HimawariAHIasCMIP(object):
_, _, mb = self._hs.coords(lines=1, columns=1, unscaled=True) _, _, mb = self._hs.coords(lines=1, columns=1, unscaled=True)
y, x = self.y, self.x 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'}) assert (name in {'y', 'x'})
a = { a = {
'.dtype': np.int16, # annotation telling goesr.rockfall.nc_write what kind of var to make '.dtype': np.int16, # annotation telling goesr.rockfall.nc_write what kind of var to make
'units': 'rad', 'units': 'rad',
'long_name': "AHI fixed grid projection %s-coordinate" % name, 'long_name': "AHI fixed grid projection %s-coordinate" % name,
'standard_name': "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 'scale_factor': -m if invert else m, # PUG has negative y north of equator; prefer monotonic +1 raw value however
'add_offset': -b if name=='y' else b # ref GIT 3ebfc9ab1f 'add_offset': -b if invert else b # ref GIT 3ebfc9ab1f
} }
# y/x # 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 # y_image/x_image single value
v_image = np.nanmean(v) v_image = np.nanmean(v)
a['long_name'] = "AHI fixed grid projection %s-coordinate center of image" % name, 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 # y_image_bounds
vrange = np.array([np.nanmin(v), np.nanmax(v)]) vrange = np.array([np.nanmin(v), np.nanmax(v)])
...@@ -398,10 +398,10 @@ class HimawariAHIasCMIP(object): ...@@ -398,10 +398,10 @@ class HimawariAHIasCMIP(object):
}[name] }[name]
a = {} a = {}
a['long_name'] = "AHI fixed grid projection %s-coordinate %s extent of image" % (name, nsew) 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 # y and x variables and their bounds and centerpoints
for each in yx_pvda('y', y, mb.my, mb.by): for each in yx_pvda('y', y, mb.my, mb.by, invert=True):
yield each yield each
for each in yx_pvda('x', x, mb.mx, mb.bx): for each in yx_pvda('x', x, mb.mx, 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