示例#1
0
文件: csk.py 项目: Ryanzgy/sarpy
        def get_collection_info():  # type: () -> CollectionInfoType
            acq_mode = h5_dict['Acquisition Mode'].upper()
            if 'CSK' in self._satellite:
                if acq_mode in ['HIMAGE', 'PINGPONG']:
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['WIDEREGION', 'HUGEREGION']:
                    # scansar, processed as stripmap
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['ENHANCED SPOTLIGHT','SMART']:
                    mode_type = 'DYNAMIC STRIPMAP'
                else:
                    logging.warning('Got unexpected acquisition mode {}'.format(acq_mode))
                    mode_type = 'DYNAMIC STRIPMAP'
            elif 'KMP' in self._satellite:
                if acq_mode in ['STANDARD', 'ENHANCED STANDARD']:
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['WIDE SWATH', 'ENHANCED WIDE SWATH']:
                    # scansar, processed as stripmap
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['HIGH RESOLUTION', 'ENHANCED HIGH RESOLUTION', 'ULTRA HIGH RESOLUTION']:
                    # "spotlight"
                    mode_type = 'DYNAMIC STRIPMAP'
                else:
                    logging.warning('Got unexpected acquisition mode {}'.format(acq_mode))
                    mode_type = 'DYNAMIC STRIPMAP'
            else:
                raise ValueError('Unhandled satellite type {}'.format(self._satellite))

            return CollectionInfoType(Classification='UNCLASSIFIED',
                                      CollectorName=h5_dict['Satellite ID'],
                                      CoreName=str(h5_dict['Programmed Image ID']),
                                      CollectType='MONOSTATIC',
                                      RadarMode=RadarModeType(ModeID=h5_dict['Multi-Beam ID'],
                                                              ModeType=mode_type))
示例#2
0
    def get_collection_info():
        # type: () -> CollectionInfoType
        isorce = img_header.ISORCE.strip()
        collector_name = None if len(isorce) < 1 else isorce

        iid2 = img_header.IID2.strip()
        core_name = img_header.IID1.strip() if len(iid2) < 1 else iid2

        class_str = img_header.Security.CLAS
        if class_str == 'T':
            classification = 'TOPSECRET'
        elif class_str == 'S':
            classification = 'SECRET'
        elif class_str == 'C':
            classification = 'CONFIDENTIAL'
        elif class_str == 'U':
            classification = 'UNCLASSIFIED'
        else:
            classification = ''
        ctlh = img_header.Security.CTLH.strip()
        if len(ctlh) < 1:
            classification += '//' + ctlh
        code = img_header.Security.CODE.strip()
        if len(code) < 1:
            classification += '//' + code

        return CollectionInfoType(
            CollectorName=collector_name,
            CoreName=core_name,
            Classification=classification)
示例#3
0
 def append_country_code(cc):
     if len(cc) > 0:
         if the_sicd.CollectionInfo is None:
             the_sicd.CollectionInfo = CollectionInfoType(CountryCodes=[cc, ])
         elif the_sicd.CollectionInfo.CountryCodes is None:
             the_sicd.CollectionInfo.CountryCodes = [cc, ]
         elif cc not in the_sicd.CollectionInfo.CountryCodes:
             the_sicd.CollectionInfo.CountryCodes.append(cc)
示例#4
0
文件: csk.py 项目: bombaci-vsc/sarpy
        def get_collection_info():  # type: () -> (dict, CollectionInfoType)
            acq_mode = h5_dict['Acquisition Mode'].upper()
            if self.mission_id == 'CSK':
                if acq_mode in ['HIMAGE', 'PINGPONG']:
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['WIDEREGION', 'HUGEREGION']:
                    # scansar, processed as stripmap
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['ENHANCED SPOTLIGHT', 'SMART']:
                    mode_type = 'DYNAMIC STRIPMAP'
                else:
                    logger.warning(
                        'Got unexpected acquisition mode {}'.format(acq_mode))
                    mode_type = 'DYNAMIC STRIPMAP'
            elif self.mission_id == 'KMPS':
                if acq_mode in ['STANDARD', 'ENHANCED STANDARD']:
                    mode_type = 'STRIPMAP'
                elif acq_mode in ['WIDE SWATH', 'ENHANCED WIDE SWATH']:
                    # scansar, processed as stripmap
                    mode_type = 'STRIPMAP'
                elif acq_mode in [
                        'HIGH RESOLUTION', 'ENHANCED HIGH RESOLUTION',
                        'ULTRA HIGH RESOLUTION'
                ]:
                    # "spotlight"
                    mode_type = 'DYNAMIC STRIPMAP'
                else:
                    logger.warning(
                        'Got unexpected acquisition mode {}'.format(acq_mode))
                    mode_type = 'DYNAMIC STRIPMAP'
            elif self.mission_id == 'CSG':
                if acq_mode.startswith('SPOTLIGHT'):
                    mode_type = 'DYNAMIC STRIPMAP'
                elif acq_mode in ['STRIPMAP', 'QUADPOL']:
                    mode_type = "STRIPMAP"
                else:
                    logger.warning(
                        'Got unhandled acquisition mode {},\n\t'
                        'setting to DYNAMIC STRIPMAP'.format(acq_mode))
                    mode_type = 'DYNAMIC STRIPMAP'
            else:
                raise ValueError('Unhandled mission id {}'.format(
                    self._mission_id))

            start_time_dt = collect_start.astype('datetime64[s]').astype(
                datetime)
            date_str = start_time_dt.strftime('%d%b%y').upper()
            time_str = start_time_dt.strftime('%H%M%S') + 'Z'
            core_name = '{}_{}_{}'.format(date_str, h5_dict['Satellite ID'],
                                          time_str)
            collect_info = CollectionInfoType(
                Classification='UNCLASSIFIED',
                CollectorName=h5_dict['Satellite ID'],
                CoreName=core_name,
                CollectType='MONOSTATIC',
                RadarMode=RadarModeType(ModeID=h5_dict['Multi-Beam ID'],
                                        ModeType=mode_type))
            return collect_info
示例#5
0
文件: csk.py 项目: LordHui/sarpy
 def get_collection_info():  # type: () -> CollectionInfoType
     mode_type = 'STRIPMAP' if h5_dict['Acquisition Mode'] in \
                               ['HIMAGE', 'PINGPONG', 'WIDEREGION', 'HUGEREGION'] else 'DYNAMIC STRIPMAP'
     return CollectionInfoType(Classification='UNCLASSIFIED',
                               CollectorName=h5_dict['Satellite ID'],
                               CoreName=str(h5_dict['Programmed Image ID']),
                               CollectType='MONOSTATIC',
                               RadarMode=RadarModeType(ModeID=h5_dict['Multi-Beam ID'],
                                                       ModeType=mode_type))
示例#6
0
文件: nisar.py 项目: ngageoint/sarpy
 def get_collection_info() -> CollectionInfoType:
     gp = hf['/science/LSAR/identification']
     return CollectionInfoType(
         CollectorName=_stringify(hf.attrs['mission_name']),
         CoreName='{0:07d}_{1:s}'.format(gp['absoluteOrbitNumber'][()],
                                         _stringify(gp['trackNumber'][()])),
         CollectType='MONOSTATIC',
         Classification='UNCLASSIFIED',
         RadarMode=RadarModeType(ModeType='STRIPMAP'))
示例#7
0
 def get_collection_info():
     # type: () -> CollectionInfoType
     return CollectionInfoType(
         CollectorName=_stringify(hf['satellite_name'][()]),
         CoreName=_stringify(hf['product_name'][()]),
         CollectType='MONOSTATIC',
         Classification='UNCLASSIFIED',
         RadarMode=RadarModeType(
             ModeType=_stringify(hf['acquisition_mode'][()]).upper(),
             ModeID=_stringify(hf['product_type'][()])))
示例#8
0
    def try_ACFT():
        if tres is None:
            return
        tre = tres['ACFTA']
        if tre is None:
            tre = tres['ACFTB']
        if tre is None:
            return
        acft = tre.DATA

        sensor_id = acft.SENSOR_ID.strip()
        if len(sensor_id) > 1:
            if the_sicd.CollectionInfo is None:
                the_sicd.CollectionInfo = CollectionInfoType(
                    CollectorName=sensor_id)
            elif the_sicd.CollectionInfo.CollectorName is None:
                the_sicd.CollectionInfo.CollectorName = sensor_id

        row_ss = float(acft.ROW_SPACING)
        col_ss = float(acft.COL_SPACING)

        if hasattr(acft, 'ROW_SPACING_UNITS') and acft.ROW_SPACING_UNITS.strip(
        ).lower() == 'f':
            row_ss *= foot
        if hasattr(acft, 'COL_SPACING_UNITS') and acft.COL_SPACING_UNITS.strip(
        ).lower() == 'f':
            col_ss *= foot

        # NB: these values are actually ground plane values, and should be
        # corrected to slant plane if possible
        if the_sicd.SCPCOA is not None:
            if the_sicd.SCPCOA.GrazeAng is not None:
                col_ss *= numpy.cos(numpy.deg2rad(the_sicd.SCPCOA.GrazeAng))
            if the_sicd.SCPCOA.TwistAng is not None:
                row_ss *= numpy.cos(numpy.deg2rad(the_sicd.SCPCOA.TwistAng))

        if the_sicd.Grid is None:
            the_sicd.Grid = GridType(Row=DirParamType(SS=row_ss),
                                     Col=DirParamType(SS=col_ss))
            return

        if the_sicd.Grid.Row is None:
            the_sicd.Grid.Row = DirParamType(SS=row_ss)
        elif the_sicd.Grid.Row.SS is None:
            the_sicd.Grid.Row.SS = row_ss

        if the_sicd.Grid.Col is None:
            the_sicd.Grid.Col = DirParamType(SS=col_ss)
        elif the_sicd.Grid.Col.SS is None:
            the_sicd.Grid.Col.SS = col_ss
示例#9
0
        def get_collection_info():
            # type: () -> CollectionInfoType

            mode_id_type_map = {
                "SpotlightExtendedArea": "DYNAMIC STRIPMAP", }
            mode_id = _stringify(hf['product_type'][()])
            mode_type = mode_id_type_map.get(mode_id, _stringify(hf['acquisition_mode'][()]).upper())

            return CollectionInfoType(
                CollectorName=_stringify(hf['satellite_name'][()]),
                CoreName=_stringify(hf['product_name'][()]),
                CollectType='MONOSTATIC',
                Classification='UNCLASSIFIED',
                RadarMode=RadarModeType(
                    ModeType=mode_type,
                    ModeID=mode_id))
示例#10
0
        def get_collection_info() -> CollectionInfoType:
            coll_name = collect['platform']
            mode = collect['mode'].strip().lower()
            if mode == 'stripmap':
                radar_mode = RadarModeType(ModeType='STRIPMAP', ModeID=mode)
            elif mode == 'spotlight':
                radar_mode = RadarModeType(ModeType='SPOTLIGHT', ModeID=mode)
            elif mode == 'sliding_spotlight':
                radar_mode = RadarModeType(ModeType='DYNAMIC STRIPMAP',
                                           ModeID=mode)
            else:
                raise ValueError('Got unhandled radar mode {}'.format(mode))

            return CollectionInfoType(CollectorName=coll_name,
                                      CoreName=collect['collect_id'],
                                      RadarMode=radar_mode,
                                      Classification='UNCLASSIFIED',
                                      CollectType='MONOSTATIC')
示例#11
0
        def get_collection_info():
            # type: () -> CollectionInfoType
            coll_name = collect['platform']
            start_dt = start_time.astype('datetime64[us]').astype(datetime)
            mode = collect['mode'].strip().lower()
            if mode == 'stripmap':
                radar_mode = RadarModeType(ModeType='STRIPMAP')
            elif mode == 'sliding_spotlight':
                radar_mode = RadarModeType(ModeType='DYNAMIC STRIPMAP')
            else:
                raise ValueError('Got unhandled radar mode {}'.format(mode))

            return CollectionInfoType(CollectorName=coll_name,
                                      CoreName='{}{}{}'.format(
                                          start_dt.strftime('%d%b%y').upper(),
                                          coll_name,
                                          start_dt.strftime('%H%M%S')),
                                      RadarMode=radar_mode,
                                      Classification='UNCLASSIFIED',
                                      CollectType='MONOSTATIC')
示例#12
0
    def _get_collection_info(self):
        """
        Gets the CollectionInfo.

        Returns
        -------
        CollectionInfoType
        """

        try:
            import sarpy.io.complex.radarsat_addin as radarsat_addin
        except ImportError:
            radarsat_addin = None

        collector_name = self.satellite
        start_time_dt = self._get_start_time(get_datetime=True)
        date_str = start_time_dt.strftime('%d%b%y').upper()
        nitf = {}
        if self.generation == 'RS2':
            classification = 'UNCLASSIFIED'
            core_name = '{}{}{}'.format(
                date_str, self.generation,
                self._find('./sourceAttributes/imageId').text)
        elif self.generation == 'RCM':
            class_str = self._find(
                './securityAttributes/securityClassification').text.upper()
            classification = class_str if radarsat_addin is None else radarsat_addin.extract_radarsat_sec(
                nitf, class_str)
            core_name = '{}{}{}'.format(date_str,
                                        collector_name.replace('-', ''),
                                        start_time_dt.strftime('%H%M%S'))
        else:
            raise ValueError('unhandled generation {}'.format(self.generation))
        return nitf, CollectionInfoType(Classification=classification,
                                        CollectorName=collector_name,
                                        CoreName=core_name,
                                        RadarMode=self._get_radar_mode(),
                                        CollectType='MONOSTATIC')