Commit 658815b2 authored by R.K.Garcia's avatar R.K.Garcia
Browse files

ahi2cmi fixes for HCAST

parent 07ba71bc
......@@ -420,6 +420,9 @@ class HimawariAHIasCMIP(object):
units="km"
)
nsh = nav.distance_from_earth_center_to_satellite - nav.earth_equatorial_radius
if nsh < 1000.0:
LOG.warning('satellite height unknown, approximating with perspective_point_height')
nsh = self.perspective_point_height / 1000.0
assert (nsh >= 1000.0)
yield self.p('nominal_satellite_height'), np.float32(nsh), {}, a
......@@ -649,12 +652,15 @@ class tests(unittest.TestCase):
print("%d frames" % n_frames)
def write_netcdf(path, as_radiances=False):
from goesr.rockfall import rename, nc_write
from goesr.rockfall import rename, nc_write, autoscale
fnout = os.path.abspath(os.path.split(path)[-1] + '.nc')
lething = HimawariAHIasCMIP(path, as_radiances=as_radiances)
varname = DEFAULT_CMIP_RAD_NAME if as_radiances else DEFAULT_CMIP_NAME
for fnwrit in nc_write(
rename(
lething.walk(),
autoscale( lething.walk(),
variable_names_matching={varname}
),
fnout
)
):
......
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