diff --git a/nansat/mappers/mapper_opendap_mywave.py b/nansat/mappers/mapper_opendap_mywave.py index 12fb92bb3..32670e57f 100644 --- a/nansat/mappers/mapper_opendap_mywave.py +++ b/nansat/mappers/mapper_opendap_mywave.py @@ -50,26 +50,25 @@ def __init__(self, filename, gdal_dataset, gdal_metadata, date=None, @staticmethod def get_date(filename): """Extract date and time parameters from filename and return - it as a formatted string + it as a formatted (isoformat) string Parameters ---------- filename: str - nn Returns ------- - str, YYYY-mm-ddThh:MMZ + str, YYYY-mm-ddThh:MM:00Z Examples -------- >>> Mapper.get_date('/path/to/MyWave_wam4_WAVE_20171029T18Z.nc') - '2017-10-29T18:00Z' + '2017-10-29T18:00:00Z' """ _, filename = os.path.split(filename) t = datetime.strptime(filename.split('_')[-1], '%Y%m%dT%HZ.nc') - return datetime.strftime(t, '%Y-%m-%dT%H:%MZ') + return datetime.strftime(t, '%Y-%m-%dT%H:%M:00Z') def convert_dstime_datetimes(self, ds_time): """Convert time variable to np.datetime64""" diff --git a/nansat/tests/mappers/test_mapper_opendap_mywave.py b/nansat/tests/mappers/test_mapper_opendap_mywave.py index 9b77d0cee..1e12a9aa5 100644 --- a/nansat/tests/mappers/test_mapper_opendap_mywave.py +++ b/nansat/tests/mappers/test_mapper_opendap_mywave.py @@ -11,4 +11,4 @@ def setUp(self): def test_get_date(self): res = Mapper.get_date(self.src) self.assertIsInstance(res, str) - self.assertEqual(res, '2017-10-29T18:00Z') + self.assertEqual(res, '2017-10-29T18:00:00Z')