From 069063afbefc1851002a3a9806c81e3cc4ba6671 Mon Sep 17 00:00:00 2001 From: mortenwh Date: Wed, 6 Feb 2019 11:44:57 +0100 Subject: [PATCH] #389: corrected typos, added warning, and removed old code --- nansat/mappers/mapper_opendap_globcurrent.py | 21 ++++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/nansat/mappers/mapper_opendap_globcurrent.py b/nansat/mappers/mapper_opendap_globcurrent.py index acbfde7b1..c4cd82573 100644 --- a/nansat/mappers/mapper_opendap_globcurrent.py +++ b/nansat/mappers/mapper_opendap_globcurrent.py @@ -5,6 +5,7 @@ # under the terms of GNU General Public License, v.3 # http://www.gnu.org/licenses/gpl-3.0.html import os +import warnings from dateutil.parser import parse import json @@ -48,21 +49,19 @@ def __init__(self, filename, gdalDataset, gdalMetadata, # add instrument and platform pi = [] if 'jason-1' in self.ds.sensor.lower(): - pi.append([pti.get_gcmd_platform('jason-1'), pti.get_gcmd_instrument('poseidon-2')]) + pi.append([pti.get_gcmd_platform('jason-1'), pti.get_gcmd_instrument('poseidon-2')]) if 'envisat' in self.ds.sensor.lower(): - pi.append([pti.get_gcmd_platform('envisat'), pti.get_gcmd_instrument('ra-2')] + pi.append([pti.get_gcmd_platform('envisat'), pti.get_gcmd_instrument('ra-1')]) if 'jason-2' in self.ds.sensor.lower(): - pi.append([pti.get_gcmd_platform('ostm/jason-2'), pti.get_gcmd_instrument('poseidon-3')] + pi.append([pti.get_gcmd_platform('ostm/jason-2'), + pti.get_gcmd_instrument('poseidon-3')]) - self.dataset.SetMetadataItem('platform/instrument', json.dumps(pi)) + if pi: + self.dataset.SetMetadataItem('platform/instrument', json.dumps(pi)) + else: + warnings.warn('Could not provide source metadata - please check and submit a git ' \ + 'issue if necessary') - #instr = pti.get_gcmd_instrument('active remote sensing') - #pltfr = pti.get_gcmd_platform('Earth Observation Satellites') - pltfr = pti.get_gcmd_platform('JASON-1') - instr = pti.get_gcmd_instrument('JASON-2 RADAR ALTIMETER') - - self.dataset.SetMetadataItem('instrument', json.dumps(instr)) - self.dataset.SetMetadataItem('platform', json.dumps(pltfr)) self.dataset.SetMetadataItem('Data Center', 'FR/IFREMER/CERSAT') self.dataset.SetMetadataItem('Entry Title', 'GLOBCURRENT')