From 9d998e3e1cb9b5bf797b1cd099eb1cc598bf4eca Mon Sep 17 00:00:00 2001 From: marqh Date: Wed, 22 May 2019 12:46:12 +0000 Subject: [PATCH 1/5] metadata translations may 2019 --- lib/iris/fileformats/um_cf_map.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/iris/fileformats/um_cf_map.py b/lib/iris/fileformats/um_cf_map.py index cc568d7ccf..3fafa4df80 100644 --- a/lib/iris/fileformats/um_cf_map.py +++ b/lib/iris/fileformats/um_cf_map.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2013 - 2018, Met Office +# (C) British Crown Copyright 2013 - 2019, Met Office # # This file is part of Iris. # @@ -16,11 +16,11 @@ # along with Iris. If not, see . # # DO NOT EDIT: AUTO-GENERATED -# Created on 01 June 2018 13:06 from +# Created on 22 May 2019 12:05 from # http://www.metarelate.net/metOcean -# at commit c07efb7ba0442332cbd5514c9d661c4f84a635c6 +# at commit a3649e942198f014f0258d926678dbbff616feae -# https://github.com/metarelate/metOcean/commit/c07efb7ba0442332cbd5514c9d661c4f84a635c6 +# https://github.com/metarelate/metOcean/commit/a3649e942198f014f0258d926678dbbff616feae """ Provides UM/CF phenomenon translations. @@ -720,7 +720,7 @@ 'm01s16i202': CFName('geopotential_height', None, 'm'), 'm01s16i203': CFName('air_temperature', None, 'K'), 'm01s16i204': CFName('relative_humidity', None, '%'), - 'm01s16i205': CFName(None, 'wet_bulb_potential_temperature', 'K'), + 'm01s16i205': CFName('wet_bulb_potential_temperature', None, 'K'), 'm01s16i222': CFName('air_pressure_at_sea_level', None, 'Pa'), 'm01s16i224': CFName(None, 'square_of_height', 'm2'), 'm01s16i255': CFName('geopotential_height', None, 'm'), From 282832e20d90786b9b86eb164cf0606b7b8ce75a Mon Sep 17 00:00:00 2001 From: marqh Date: Wed, 22 May 2019 14:48:51 +0000 Subject: [PATCH 2/5] header for iris-grib --- tools/gen_translations.py | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/tools/gen_translations.py b/tools/gen_translations.py index 5a710c5220..3d4c53e13e 100644 --- a/tools/gen_translations.py +++ b/tools/gen_translations.py @@ -71,7 +71,37 @@ CFName = namedtuple('CFName', 'standard_name long_name units') """ -HEADER_GRIB = """ +HEADER_GRIB = """# (C) British Crown Copyright 2013 - {year}, Met Office +# +# This file is part of {name}. +# +# {name} is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# {name} is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with {name}. If not, see . +# +# DO NOT EDIT: AUTO-GENERATED +# Created on {datestamp} from +# http://www.metarelate.net/metOcean +# at commit {git_sha} +# https://github.com/metarelate/metOcean/commit/{git_sha} +{doc_string} + +from __future__ import (absolute_import, division, print_function) +from six.moves import (filter, input, map, range, zip) # noqa + +from collections import namedtuple + + +CFName = namedtuple('CFName', 'standard_name long_name units') DimensionCoordinate = namedtuple('DimensionCoordinate', 'standard_name units points') @@ -189,10 +219,9 @@ def build_grib_cf_map(fuseki, now, git_sha, base_dir): # Create the file to contain GRIB/CF translations. with open(filename, 'w') as fh: - fh.write(HEADER.format(year=YEAR, doc_string=DOC_STRING_GRIB, + fh.write(HEADER_GRIB.format(year=YEAR, doc_string=DOC_STRING_GRIB, datestamp=now, git_sha=git_sha, - name='Iris')) - fh.write(HEADER_GRIB) + name='iris-grib')) fh.write('\n') # Encode the relevant GRIB to CF translations. From f3793a80ac534d35990db9eb4ee179935a1f95ca Mon Sep 17 00:00:00 2001 From: marqh Date: Thu, 23 May 2019 16:13:42 +0000 Subject: [PATCH 3/5] revert header change (review) excepting name update --- tools/gen_translations.py | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/tools/gen_translations.py b/tools/gen_translations.py index 3d4c53e13e..2ea12de2a0 100644 --- a/tools/gen_translations.py +++ b/tools/gen_translations.py @@ -71,37 +71,7 @@ CFName = namedtuple('CFName', 'standard_name long_name units') """ -HEADER_GRIB = """# (C) British Crown Copyright 2013 - {year}, Met Office -# -# This file is part of {name}. -# -# {name} is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the -# Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# {name} is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with {name}. If not, see . -# -# DO NOT EDIT: AUTO-GENERATED -# Created on {datestamp} from -# http://www.metarelate.net/metOcean -# at commit {git_sha} -# https://github.com/metarelate/metOcean/commit/{git_sha} -{doc_string} - -from __future__ import (absolute_import, division, print_function) -from six.moves import (filter, input, map, range, zip) # noqa - -from collections import namedtuple - - -CFName = namedtuple('CFName', 'standard_name long_name units') +HEADER_GRIB = """ DimensionCoordinate = namedtuple('DimensionCoordinate', 'standard_name units points') @@ -219,9 +189,10 @@ def build_grib_cf_map(fuseki, now, git_sha, base_dir): # Create the file to contain GRIB/CF translations. with open(filename, 'w') as fh: - fh.write(HEADER_GRIB.format(year=YEAR, doc_string=DOC_STRING_GRIB, + fh.write(HEADER.format(year=YEAR, doc_string=DOC_STRING_GRIB, datestamp=now, git_sha=git_sha, name='iris-grib')) + fh.write(HEADER_GRIB) fh.write('\n') # Encode the relevant GRIB to CF translations. From c6a36ce81a11d67ddd4f86cb89b4be873b9d26d6 Mon Sep 17 00:00:00 2001 From: marqh Date: Thu, 23 May 2019 16:44:23 +0000 Subject: [PATCH 4/5] protect online registries from emergent metarelate bug --- tools/gen_translations.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/gen_translations.py b/tools/gen_translations.py index 2ea12de2a0..cd884171f9 100644 --- a/tools/gen_translations.py +++ b/tools/gen_translations.py @@ -221,6 +221,9 @@ def build_grib_cf_map(fuseki, now, git_sha, base_dir): def main(): + # Protect metarelate resource from 1.0 emergent bug + if not float(metarelate.__version__) >= 1.1: + raise ValueError("Please ensure that Metarelate Version is >= 1.1") now = datetime.utcnow().strftime('%d %B %Y %H:%m') git_sha = requests.get('http://www.metarelate.net/metOcean/latest_sha').text gen_path = os.path.abspath(sys.modules['__main__'].__file__) From e18b3a668a232267cd3e9af2ae8967a3618f5963 Mon Sep 17 00:00:00 2001 From: markh Date: Mon, 3 Jun 2019 09:05:05 +0000 Subject: [PATCH 5/5] review follow up --- tools/gen_translations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/gen_translations.py b/tools/gen_translations.py index cd884171f9..8df264d8ab 100644 --- a/tools/gen_translations.py +++ b/tools/gen_translations.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2014 - 2017, Met Office +# (C) British Crown Copyright 2014 - 2019, Met Office # # This file is part of Iris. # @@ -28,6 +28,7 @@ import requests import sys +import metarelate from metarelate.fuseki import FusekiServer from translator import (FORMAT_URIS, FieldcodeCFMappings, StashCFNameMappings,