Ejemplo n.º 1
0
 def test_dict_to_string(self):
     """dict_to_string() should return the proper representation"""
     self.assertEqual(
         utils.dict_to_string({
             'key1': 'value1',
             'key2': 'value2'
         }), 'key1: value1;key2: value2')
Ejemplo n.º 2
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'GMI is a dual-polarization, multi-channel, conical-scanning, passive '
         'microwave radiometer with frequent revisit times.',
         utils.SUMMARY_FIELDS['processing_level']: '3'
     })
Ejemplo n.º 3
0
    def get_summary(self, raw_metadata):
        """Get the dataset's summary"""
        description_attributes = [
            'Date', 'Instrument name', 'Mode', 'Satellite', 'Size',
            'Timeliness Category'
        ]
        summary_fields = {}

        description = ', '.join([
            f"{attribute}={raw_metadata[attribute]}"
            for attribute in description_attributes
            if attribute in list(raw_metadata.keys())
        ])
        if not description:
            raise MetadataNormalizationError(
                f"Could not build a description from {raw_metadata}")
        summary_fields[utils.SUMMARY_FIELDS['description']] = description

        for attribute_name in ['Processing level', 'Product level']:
            if attribute_name in raw_metadata.keys():
                processing_level = re.match(
                    '^(L|Level-)?([0-9A-Z]+)$',
                    raw_metadata[attribute_name]).group(2)
                summary_fields[utils.SUMMARY_FIELDS[
                    'processing_level']] = processing_level

        return utils.dict_to_string(summary_fields)
Ejemplo n.º 4
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']: (
             'This v2.1 SST_cci Climatology Data Record (CDR) consists of Level 4 daily'
             ' climatology files gridded on a 0.05 degree grid.'
         ),
         utils.SUMMARY_FIELDS['processing_level']: '4',
         utils.SUMMARY_FIELDS['product']: 'ESA SST CCI Climatology'
     })
Ejemplo n.º 5
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
             "Real Time Ocean Forecast System (RTOFS) Global is a data-assimilating "
             "nowcast-forecast system operated by the National Weather Service's National "
             "Centers for Environmental Prediction (NCEP).",
         utils.SUMMARY_FIELDS['processing_level']: '4',
         utils.SUMMARY_FIELDS['product']: 'RTOFS'
     })
Ejemplo n.º 6
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'This product is a NRT L4 global total velocity field at 0m and 15m.',
         utils.SUMMARY_FIELDS['processing_level']:
         '4',
         utils.SUMMARY_FIELDS['product']:
         'MULTIOBS_GLO_PHY_NRT_015_003'
     })
Ejemplo n.º 7
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'Altimeter satellite gridded Sea Level Anomalies (SLA) computed with '
         'respect to a twenty-year mean.',
         utils.SUMMARY_FIELDS['processing_level']:
         '4',
         utils.SUMMARY_FIELDS['product']:
         'SEALEVEL_GLO_PHY_L4_NRT_OBSERVATIONS_008_046'
     })
Ejemplo n.º 8
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'The Operational Mercator global ocean analysis and forecast system at '
         '1/12 degree is providing 10 days of 3D global ocean forecasts updated daily.',
         utils.SUMMARY_FIELDS['processing_level']:
         '4',
         utils.SUMMARY_FIELDS['product']:
         'GLOBAL_ANALYSIS_FORECAST_PHY_001_024'
     })
Ejemplo n.º 9
0
    def get_summary(self, raw_metadata):
        summary_fields = {}

        summary_fields[
            utils.SUMMARY_FIELDS['description']] = raw_metadata['summary']

        processing_level = raw_metadata['processing_level'].lstrip('Ll')
        summary_fields[
            utils.SUMMARY_FIELDS['processing_level']] = processing_level

        return utils.dict_to_string(summary_fields)
Ejemplo n.º 10
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'The physical component of the Mediterranean Forecasting System '
         '(Med-Currents) is a coupled hydrodynamic-wave model implemented over the whole '
         'Mediterranean Basin.',
         utils.SUMMARY_FIELDS['processing_level']:
         '4',
         utils.SUMMARY_FIELDS['product']:
         'MEDSEA_ANALYSISFORECAST_PHY_006_013'
     })
Ejemplo n.º 11
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'The operational IBI (Iberian Biscay Irish) Ocean Analysis and Forecasting'
         ' system provides a 5-day hydrodynamic forecast including high frequency '
         'processes of paramount importance to characterize regional scale marine '
         'processes.',
         utils.SUMMARY_FIELDS['processing_level']:
         '4',
         utils.SUMMARY_FIELDS['product']:
         'IBI_ANALYSISFORECAST_PHY_005_001'
     })
Ejemplo n.º 12
0
 def get_summary(self, raw_metadata):
     """Get the dataset's summary if it is available in the
     metadata, otherwise use a default
     """
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']: (
             'The Arctic Sea Ice Analysis and Forecast system uses the neXtSIM stand-alone sea '
             'ice model running the Brittle-Bingham-Maxwell sea ice rheology on an adaptive '
             'triangular mesh of 10 km average cell length.'),
         utils.SUMMARY_FIELDS['processing_level']: '4',
         utils.SUMMARY_FIELDS['product']: 'ARCTIC_ANALYSISFORECAST_PHY_ICE_002_011'
     })
Ejemplo n.º 13
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']:
         'This system provides 4-day forecasts at 3-hour time steps, updated at 00Z '
         'daily. Navy Global HYCOM has a resolution of 1/12 degree in the horizontal '
         'and uses hybrid (isopycnal/sigma/z-level) coordinates in the vertical. The '
         'output is interpolated onto a regular 1/12-degree grid horizontally and '
         '40 standard depth levels.',
         utils.SUMMARY_FIELDS['processing_level']:
         '4',
         utils.SUMMARY_FIELDS['product']:
         'HYCOM'
     })
Ejemplo n.º 14
0
    def get_summary(self, raw_metadata):
        description_attributes = ('sensorMode', 'platform', 'instrument',
                                  'startDate')
        summary_fields = {}

        description = ', '.join([
            f"{attribute}={raw_metadata[attribute]}"
            for attribute in description_attributes
        ])
        summary_fields[utils.SUMMARY_FIELDS['description']] = description

        if 'processingLevel' in raw_metadata:
            processing_level = raw_metadata['processingLevel'].replace(
                'LEVEL', '')
            summary_fields[
                utils.SUMMARY_FIELDS['processing_level']] = processing_level

        return utils.dict_to_string(summary_fields)
Ejemplo n.º 15
0
    def get_summary(self, raw_metadata):
        """Get the dataset's summary if it is available in the
        metadata, otherwise use a default
        """
        description = None
        raw_summary = raw_metadata.get('summary')
        url = raw_metadata.get('url', '')

        if raw_summary and raw_summary.strip():
            description = raw_summary

        if 'INSITU_GLO_NRT_OBSERVATIONS_013_030' in url:
            product = 'INSITU_GLO_NRT_OBSERVATIONS_013_030'
            if not description:
                description = (
                    'Global Ocean - near real-time (NRT) in situ quality controlled '
                    'observations, hourly updated and distributed by INSTAC within 24-48 hours '
                    'from acquisition in average. Data are collected mainly through global '
                    'networks (Argo, OceanSites, GOSUD, EGO) and through the GTS'
                )
        elif 'INSITU_GLO_UV_NRT_OBSERVATIONS_013_048' in url:
            product = 'INSITU_GLO_UV_NRT_OBSERVATIONS_013_048'
            if not description:
                description = (
                    'This product is entirely dedicated to ocean current data observed in '
                    'near-real time. Surface current data from 2 different types of instruments'
                    ' are distributed: velocities calculated along the trajectories of drifting'
                    ' buoys from the DBCP’s Global Drifter Program, and velocities measured by '
                    'High Frequency radars from the European High Frequency radar Network'
                )
        else:
            product = utils.UNKNOWN
            if not description:
                description = 'CMEMS in situ TAC data'

        return utils.dict_to_string({
            utils.SUMMARY_FIELDS['description']:
            description or '',
            utils.SUMMARY_FIELDS['processing_level']:
            '2',
            utils.SUMMARY_FIELDS['product']:
            product
        })
Ejemplo n.º 16
0
    def get_summary(self, raw_metadata):
        summary_fields = {}
        description = ''
        umm = raw_metadata['umm']

        for platform in umm['Platforms']:
            description += (f"Platform={platform['ShortName']}, " +
                            ', '.join(f"Instrument={i['ShortName']}"
                                      for i in platform['Instruments']))

        description += (
            f", Start date={umm['TemporalExtent']['RangeDateTime']['BeginningDateTime']}"
        )
        summary_fields[utils.SUMMARY_FIELDS['description']] = description

        processing_level = re.match(
            r'^.*_L(\d[^_]*)_.*$',
            umm['CollectionReference']['ShortName']).group(1)
        summary_fields[
            utils.SUMMARY_FIELDS['processing_level']] = processing_level

        return utils.dict_to_string(summary_fields)
Ejemplo n.º 17
0
 def get_summary(self, raw_metadata):
     summary_fields = {}
     summary_fields[
         utils.SUMMARY_FIELDS['description']] = raw_metadata['abstract']
     return utils.dict_to_string(summary_fields)
Ejemplo n.º 18
0
 def test_empty_dict_to_string(self):
     """The representation of an empty dict is an empty string"""
     self.assertEqual(utils.dict_to_string({}), '')
Ejemplo n.º 19
0
 def get_summary(self, raw_metadata):
     return utils.dict_to_string({
         utils.SUMMARY_FIELDS['description']: 'GCOM-W AMSR2 data',
         utils.SUMMARY_FIELDS['processing_level']: '3'
     })