Skip to content
Snippets Groups Projects
Commit dd541731 authored by Ray Garcia's avatar Ray Garcia :scream_cat:
Browse files

CMI attribute trimming

reviewed nc_compare_schema output vs actual CMIP files
parent 7aaab154
No related branches found
No related tags found
No related merge requests found
......@@ -502,7 +502,8 @@ class axi_scmi_helper(object):
iy, ix, ny, nx = sl
A['.atomic_path'] = p = self.final_filename(sn[iy,ix])
# also add SCMI global attribute for total tile count
A['number_product_tiles'] = np.int16(np.max(sn.ravel()))
if not self.as_cmi:
A['number_product_tiles'] = np.int16(np.max(sn.ravel()))
LOG.debug('assigning final name {} to {}'.format(p, P[0]))
yield P, V, D,A
......@@ -621,41 +622,68 @@ class axi_scmi_helper(object):
latprodcen, lonprodcen = self.product_center_latlon
rez_km = float(self.pug.resolution) / 1000.0
q = dict(
product_tile_height=np.int32(th) if not self.as_cmi else None, # 1100,
product_tile_width=np.int32(tw) if not self.as_cmi else None, # 1375,
# projection=None,
periodicity=10, # 10?
tile_center_longitude=np.float32(loncen) if not self.as_cmi else None, # 88.0022078322,
tile_center_latitude=np.float32(latcen) if not self.as_cmi else None, # 62.41709885,
satellite_id=self.pug.platform_id, # "GOES-H8", "G16"?
tile_column_offset=np.int32(ix * tw), # 2750,
tile_row_offset=np.int32(iy * th), # 0,
start_date_time=self.pug.sched_time.strftime('%Y%j%H%M%S'), # 2015181030000, # %Y%j%H%M%S
product_rows=np.int32(ph), # 11000,
product_columns=np.int32(pw), # 11000,
title="Sectorized Cloud and Moisture Full Disk Imagery",
abi_mode=np.int16(self.pug.mode),
pixel_y_size=np.float32(np.abs(dym) / 1000.0), # km
pixel_x_size=np.float32(np.abs(dxm) / 1000.0), # km
zult = dict(
product_name=self.product_name, # "HFD-010-B11-M1C01", only used for SCMI
central_wavelength=np.float32(self.central_wavelength),
# number_product_tiles=np.int16(self.tile_count), # 76, added in annotate_atomic_paths based on actual yield!
bit_depth=np.int16(self.pug.bit_depth),
satellite_altitude=self.pug.nav['perspective_point_height'] / 1000.0, # 35785.863
satellite_longitude=self.pug.nav['longitude_of_projection_origin'], # 140.7, FIXME: ssp_longitude preferable for AHI
satellite_latitude=self.pug.nav['latitude_of_projection_origin'], # FIXME: ssp_latitude preferred for AHI
ICD_version="SE-08_7034704_GS_AWIPS_Ext_ICD_RevB.3" if not self.as_cmi else None,
source_scene=self.scene or self.pug.scene_id,
production_location=socket.gethostname(), # "MSC",
Conventions="CF-1.6",
channel_id=np.int16(self.pug.band), # 1,
product_center_latitude=np.float32(latprodcen),
product_center_longitude=np.float32(lonprodcen), # 140.7,
source_spatial_resolution=np.float32(rez_km), # km
request_spatial_resolution=np.float32(rez_km),
)
return q
if not self.as_cmi: # SCMI-specifics
s = dict(
abi_mode=np.int16(self.pug.mode),
bit_depth=np.int16(self.pug.bit_depth),
central_wavelength=np.float32(self.central_wavelength),
channel_id=np.int16(self.pug.band), # 1,
product_tile_height=np.int32(th) if not self.as_cmi else None, # 1100,
product_tile_width=np.int32(tw) if not self.as_cmi else None, # 1375,
production_location=socket.gethostname(), # "MSC",
# projection=None,
periodicity=10, # 10?
tile_center_longitude=np.float32(loncen) if not self.as_cmi else None, # 88.0022078322,
tile_center_latitude=np.float32(latcen) if not self.as_cmi else None, # 62.41709885,
satellite_id=self.pug.platform_id, # "GOES-H8", "G16"?
tile_column_offset=np.int32(ix * tw), # 2750,
tile_row_offset=np.int32(iy * th), # 0,
start_date_time=self.pug.sched_time.strftime('%Y%j%H%M%S'), # 2015181030000, # %Y%j%H%M%S
pixel_y_size=np.float32(np.abs(dym) / 1000.0), # km
pixel_x_size=np.float32(np.abs(dxm) / 1000.0), # km
product_rows=np.int32(ph), # 11000,
product_columns=np.int32(pw), # 11000,
product_center_latitude=np.float32(latprodcen),
product_center_longitude=np.float32(lonprodcen), # 140.7,
# number_product_tiles=np.int16(self.tile_count), # 76, added in annotate_atomic_paths based on actual yield!
satellite_altitude=self.pug.nav['perspective_point_height'] / 1000.0, # 35785.863
satellite_longitude=self.pug.nav['longitude_of_projection_origin'],
# 140.7, FIXME: ssp_longitude preferable for AHI
satellite_latitude=self.pug.nav['latitude_of_projection_origin'],
# FIXME: ssp_latitude preferred for AHI
source_scene=self.scene or self.pug.scene_id,
source_spatial_resolution=np.float32(rez_km), # km
request_spatial_resolution=np.float32(rez_km),
title="Sectorized Cloud and Moisture {} Imagery".format(self.scene),
)
zult.update(s)
else: # CMIP-specifics
c = dict(
title="{} Cloud and Moisture {} Imagery".format(self.pug.instrument_name, self.scene),
scene_id=self.scene or self.pug.scene_id,
# dataset_name=self.final_filename(0),
# id
# institution
# iso_series_metadata
# keywords
# keywords_vocabulary
# license
# production_data_source
# production_environment
# production_site
# project
# summary
)
zult.update(c)
return zult
def append_global_atts(self, pvda):
"""
......@@ -726,7 +754,7 @@ def axi2scmi(path, n_tiles=(1, 1), max_pixels=0,
# if autoscale is enabled, put autoscale on the CMI variable
if autoscale or is_ahi: # we always want to autoscale AHI data due to slight channel differences
LOG.info('adding autoscale stage for CMI data')
seq = rf.autoscale(seq, variable_names_matching={DEFAULT_SCMI_VAR_NAME}, dtype=np.uint16, dmin=0, dmax=32767)
seq = rf.autoscale(seq, variable_names_matching={DEFAULT_SCMI_VAR_NAME, DEFAULT_CMIP_VAR_NAME}, dtype=np.uint16, dmin=0, dmax=32767)
else:
# trim values below guidebook-provided add_offset, to avoid sparkles in night side reflectances
seq = scmi.pvda_trim_below_add_offset(seq)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment