Пример #1
0
 def get_image_creation() -> ImageCreationType:
     from sarpy.__about__ import __version__
     return ImageCreationType(
         Application='ICEYE_P_{}'.format(hf['processor_version'][()]),
         DateTime=_parse_time(hf['processing_time'][()]),
         Site='Unknown',
         Profile='sarpy {}'.format(__version__))
Пример #2
0
 def get_image_creation():
     # type: () -> ImageCreationType
     from sarpy.__about__ import __version__
     return ImageCreationType(
         Application=self._tiff_details.tags['Software'],
         DateTime=parse_timestring(self._img_desc_tags['processing_time'], precision='us'),
         Profile='sarpy {}'.format(__version__),
         Site='Unknown')
Пример #3
0
 def get_image_creation():  # type: () -> ImageCreationType
     from sarpy.__about__ import __version__
     return ImageCreationType(
         DateTime=parse_timestring(h5_dict['Product Generation UTC'], precision='ns'),
         Site=h5_dict['Processing Centre'],
         Application='LO: `{}`, L1: `{}`'.format(h5_dict.get('L0 Software Version', 'NONE'),
                                             h5_dict.get('L1A Software Version', 'NONE')),
         Profile='sarpy {}'.format(__version__))
Пример #4
0
def validate_sicd_for_writing(sicd_meta):
    """
    Helper method which ensures the provided SICD structure provides enough
    information to support file writing, as well as ensures a few basic items
    are populated as appropriate.

    Parameters
    ----------
    sicd_meta : SICDType

    Returns
    -------
    SICDType
        This returns a deep copy of the provided SICD structure, with any
        necessary modifications.
    """

    if not isinstance(sicd_meta, SICDType):
        raise ValueError(
            'sicd_meta is required to be an instance of SICDType, got {}'.
            format(type(sicd_meta)))
    if sicd_meta.ImageData is None:
        raise ValueError(
            'The sicd_meta has un-populated ImageData, and nothing useful can be inferred.'
        )
    if sicd_meta.ImageData.NumCols is None or sicd_meta.ImageData.NumRows is None:
        raise ValueError(
            'The sicd_meta has ImageData with unpopulated NumRows or NumCols, '
            'and nothing useful can be inferred.')
    if sicd_meta.ImageData.PixelType is None:
        logging.warning(
            'The PixelType for sicd_meta is unset, so defaulting to RE32F_IM32F.'
        )
        sicd_meta.ImageData.PixelType = 'RE32F_IM32F'

    sicd_meta = sicd_meta.copy()

    profile = '{} {}'.format(__title__, __version__)
    if sicd_meta.ImageCreation is None:
        sicd_meta.ImageCreation = ImageCreationType(Application=profile,
                                                    DateTime=numpy.datetime64(
                                                        datetime.now()),
                                                    Profile=profile)
    else:
        sicd_meta.ImageCreation.Profile = profile
        if sicd_meta.ImageCreation.DateTime is None:
            sicd_meta.ImageCreation.DateTime = numpy.datetime64(datetime.now())
    return sicd_meta
Пример #5
0
    def try_AIMIDA():
        tre = None if tres is None else tres['AIMIDA']
        if tre is None:
            return
        aimida = tre.DATA

        append_country_code(aimida.COUNTRY.strip())

        create_time = datetime.strptime(aimida.CREATION_DATE, '%d%b%y')
        if the_sicd.ImageCreation is None:
            the_sicd.ImageCreation = ImageCreationType(DateTime=create_time)
        elif the_sicd.ImageCreation.DateTime is None:
            the_sicd.ImageCreation.DateTime = create_time

        collect_start = datetime.strptime(aimida.MISSION_DATE+aimida.TIME, '%d%b%y%H%M')
        set_collect_start(collect_start, override=False)
Пример #6
0
        def get_image_creation():
            # type: () -> ImageCreationType
            application = 'ISCE'
            # noinspection PyBroadException
            try:
                application = '{} {}'.format(
                    application,
                    _stringify(hf['/science/LSAR/SLC/metadata/processingInformation/algorithms/ISCEVersion'][()]))
            except:
                pass

            from sarpy.__about__ import __version__
            # TODO: DateTime?
            return ImageCreationType(
                Application=application,
                Site='Unknown',
                Profile='sarpy {}'.format(__version__))
Пример #7
0
    def _get_image_creation(self):
        """
        Gets the ImageCreation metadata.

        Returns
        -------
        ImageCreationType
        """

        from sarpy.__about__ import __version__
        processing_info = self._find(
            './imageGenerationParameters/generalProcessingInformation')
        return ImageCreationType(
            Application=processing_info.find('softwareVersion').text,
            DateTime=processing_info.find('processingTime').text,
            Site=processing_info.find('processingFacility').text,
            Profile='sarpy {}'.format(__version__))
Пример #8
0
        def get_image_creation() -> ImageCreationType:
            application = 'ISCE'
            # noinspection PyBroadException
            try:
                application = '{} {}'.format(
                    application,
                    _stringify(hf['/science/LSAR/SLC/metadata/processingInformation/algorithms/ISCEVersion'][()]))
            except Exception as e:
                logger.info('Failed extracting the application details with error\n\t{}'.format(e))
                pass

            from sarpy.__about__ import __version__
            # TODO: DateTime?
            return ImageCreationType(
                Application=application,
                Site='Unknown',
                Profile='sarpy {}'.format(__version__))
Пример #9
0
 def get_image_creation():  # type: () -> ImageCreationType
     from sarpy.__about__ import __version__
     return ImageCreationType(
         DateTime=parse_timestring(h5_dict['Product Generation UTC'], precision='ns'),
         Profile='sarpy {}'.format(__version__))