diff --git a/satpy/readers/ahi_hsd.py b/satpy/readers/ahi_hsd.py index 538b6af9f8..a316d26c9e 100644 --- a/satpy/readers/ahi_hsd.py +++ b/satpy/readers/ahi_hsd.py @@ -49,7 +49,7 @@ from pyresample import geometry from satpy import CHUNK_SIZE from satpy.readers.file_handlers import BaseFileHandler -from satpy.readers.utils import get_geostationary_angle_extent, np2str +from satpy.readers.utils import get_geostationary_mask, np2str AHI_CHANNEL_NAMES = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", @@ -317,126 +317,115 @@ def get_area_def(self, dsid): self.area = area return area - def geo_mask(self): - """Masking the space pixels from geometry info.""" - cfac = np.uint32(self.proj_info['CFAC']) - lfac = np.uint32(self.proj_info['LFAC']) - coff = np.float32(self.proj_info['COFF']) - loff = np.float32(self.proj_info['LOFF']) - nlines = int(self.data_info['number_of_lines']) - ncols = int(self.data_info['number_of_columns']) - - # count starts at 1 - local_coff = 1 - local_loff = (self.total_segments - self.segment_number) * nlines + 1 - - xmax, ymax = get_geostationary_angle_extent(self.area) - - pixel_cmax = np.rad2deg(xmax) * cfac * 1.0 / 2**16 - pixel_lmax = np.rad2deg(ymax) * lfac * 1.0 / 2**16 - - def ellipse(line, col): - return ((line / pixel_lmax) ** 2) + ((col / pixel_cmax) ** 2) <= 1 + def _read_header(self, fp_): + """Read header""" + header = {} - cols_idx = da.arange(-(coff - local_coff), - ncols - (coff - local_coff), - dtype=np.float, chunks=CHUNK_SIZE) - lines_idx = da.arange(nlines - (loff - local_loff), - -(loff - local_loff), - -1, - dtype=np.float, chunks=CHUNK_SIZE) - return ellipse(lines_idx[:, None], cols_idx[None, :]) + header['block1'] = np.fromfile( + fp_, dtype=_BASIC_INFO_TYPE, count=1) + header["block2"] = np.fromfile(fp_, dtype=_DATA_INFO_TYPE, count=1) + header["block3"] = np.fromfile(fp_, dtype=_PROJ_INFO_TYPE, count=1) + header["block4"] = np.fromfile(fp_, dtype=_NAV_INFO_TYPE, count=1) + header["block5"] = np.fromfile(fp_, dtype=_CAL_INFO_TYPE, count=1) + logger.debug("Band number = " + + str(header["block5"]['band_number'][0])) + logger.debug('Time_interval: %s - %s', + str(self.start_time), str(self.end_time)) + band_number = header["block5"]['band_number'][0] + if band_number < 7: + cal = np.fromfile(fp_, dtype=_VISCAL_INFO_TYPE, count=1) + else: + cal = np.fromfile(fp_, dtype=_IRCAL_INFO_TYPE, count=1) + + header['calibration'] = cal + + header["block6"] = np.fromfile( + fp_, dtype=_INTER_CALIBRATION_INFO_TYPE, count=1) + header["block7"] = np.fromfile( + fp_, dtype=_SEGMENT_INFO_TYPE, count=1) + header["block8"] = np.fromfile( + fp_, dtype=_NAVIGATION_CORRECTION_INFO_TYPE, count=1) + # 8 The navigation corrections: + ncorrs = header["block8"]['numof_correction_info_data'][0] + dtype = np.dtype([ + ("line_number_after_rotation", "