def update_image_data(sicd, band_name): # type: (SICDType, str) -> Tuple[float, float, float, float, int] cols, rows = shape_dict[band_name] # zero doppler time of first/last columns t_az_first_time = band_dict[band_name][ 'Zero Doppler Azimuth First Time'] t_az_last_time = band_dict[band_name][ 'Zero Doppler Azimuth Last Time'] t_ss_az_s = band_dict[band_name]['Line Time Interval'] t_use_sign2 = 1 if h5_dict['Look Side'].upper() == 'LEFT': t_use_sign2 = -1 t_az_first_time, t_az_last_time = t_az_last_time, t_az_first_time # zero doppler time of first row t_rg_first_time = band_dict[band_name][ 'Zero Doppler Range First Time'] # row spacing in range time (seconds) t_ss_rg_s = band_dict[band_name]['Column Time Interval'] sicd.ImageData = ImageDataType(NumRows=rows, NumCols=cols, FirstRow=0, FirstCol=0, FullImage=(rows, cols), PixelType=dtype_dict[band_name], SCPPixel=RowColType( Row=int(rows / 2), Col=int(cols / 2))) return t_rg_first_time, t_ss_rg_s, t_az_first_time, t_ss_az_s, t_use_sign2
def get_sicd(self): """ Extract the SICD details. Returns ------- SICDType """ if self._sicd is not None: return self._sicd if self._user_data is None: self._read_user_data() if self._caspr_data is None: self._find_caspr_data() # Check if the user data contains a sicd structure. sicd_string = None for nam in ['SICDMETA', 'SICD_META', 'SICD']: if sicd_string is None: sicd_string = self._user_data.get(nam, None) # If so, assume that this SICD is valid and simply present it if sicd_string is not None: root_node, xml_ns = parse_xml_from_string(sicd_string) self._sicd = SICDType.from_node(root_node, xml_ns) self._sicd.derive() else: # otherwise, we populate a really minimal sicd structure num_rows, num_cols = self.data_size self._sicd = SICDType(ImageData=ImageDataType(NumRows=num_rows, NumCols=num_cols, FirstRow=0, FirstCol=0, PixelType=self.pixel_type, FullImage=FullImageType(NumRows=num_rows, NumCols=num_cols), SCPPixel=RowColType(Row=num_rows/2, Col=num_cols/2))) return self._sicd
def update_image_data(sicd, band_name): # type: (SICDType, str) -> Tuple[float, float, float, float] cols, rows = shape_dict[band_name] t_az_first_time = band_dict[band_name]['Zero Doppler Azimuth First Time'] # zero doppler time of first column t_ss_az_s = band_dict[band_name]['Line Time Interval'] if base_sicd.SCPCOA.SideOfTrack == 'L': # we need to reverse time order t_ss_az_s *= -1 t_az_first_time = band_dict[band_name]['Zero Doppler Azimuth Last Time'] # zero doppler time of first row t_rg_first_time = band_dict[band_name]['Zero Doppler Range First Time'] # row spacing in range time (seconds) t_ss_rg_s = band_dict[band_name]['Column Time Interval'] sicd.ImageData = ImageDataType(NumRows=rows, NumCols=cols, FirstRow=0, FirstCol=0, PixelType='RE16I_IM16I', SCPPixel=RowColType(Row=int(rows/2), Col=int(cols/2))) return t_rg_first_time, t_ss_rg_s, t_az_first_time, t_ss_az_s