From 03d60a983f47c0626f466c70bc2ae1e70e87f5d5 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Tue, 6 Oct 2020 16:36:47 +0100 Subject: [PATCH 1/8] Travis test with both Iris latest-release and latest-master. (#231) * Travis test with both Iris latest-release and latest-master. * Modify test CMLs for latest Iris (Iris3.0 changes). * Grib1 load fixes. * Fix loading since units=None default for Iris3 coords * Modify test to work with latest Iris (Iris3.0 changes). * Test against latest Iris only. * Review changes. --- .travis.yml | 29 +++++++++++++++-- iris_grib/_grib1_load_rules.py | 4 +-- iris_grib/_load_convert.py | 13 +++++--- .../data_section/TestGDT30/lambert.cml | 8 ++--- .../sample_file_loads/lambert_grib1.cml | 8 ++--- .../sample_file_loads/lambert_grib2.cml | 8 ++--- .../grib1_load_rules/test_grib1_convert.py | 31 ++++++++----------- .../load_convert/test_satellite_common.py | 6 ++-- 8 files changed, 65 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5625e9ea..fabdc93c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,10 @@ dist: xenial env: matrix: - - PYTHON_VERSION=36 - - PYTHON_VERSION=37 + - PYTHON_VERSION=36 LIMIT_TO_RELEASED_IRIS=false + - PYTHON_VERSION=37 LIMIT_TO_RELEASED_IRIS=false + # - PYTHON_VERSION=36 LIMIT_TO_RELEASED_IRIS=true + # - PYTHON_VERSION=37 LIMIT_TO_RELEASED_IRIS=true install: # Download iris-test-data @@ -40,6 +42,22 @@ install: export ENV_NAME="iris-grib-dev"; export ENV_FILE="${TRAVIS_BUILD_DIR}/requirements/ci/py${PYTHON_VERSION}.yml"; + # Optionally download latest Iris from repo, + # and replace the Iris dependency with Iris' underlying dependencies. + - > + if [[ "${LIMIT_TO_RELEASED_IRIS}" == false ]]; then + IRIS_REF="https://github.com/SciTools/iris/archive/master.zip"; + export IRIS_LOCATION="${HOME}/iris"; + mkdir ${IRIS_LOCATION}; + wget -O ${IRIS_LOCATION}/iris.zip ${IRIS_REF}; + unzip -q ${IRIS_LOCATION}/iris.zip -d ${IRIS_LOCATION}; + + IRIS_ENV_FILE="${IRIS_LOCATION}/iris-master/requirements/ci/py${PYTHON_VERSION}.yml"; + sed -i "/- iris/d" ${ENV_FILE}; + echo "# IRIS DEPENDENCIES." >> ${ENV_FILE}; + sed -ne "/dependencies:/,$ p" ${IRIS_ENV_FILE} | sed "1d" >> ${ENV_FILE}; + fi; + # Create environment. - > conda env create --quiet --file=${ENV_FILE}; @@ -61,6 +79,13 @@ install: # -------------- - echo "Configuring Iris"; + # Optionally install latest Iris from downloaded source. + - > + if [[ "${LIMIT_TO_RELEASED_IRIS}" == false ]]; then + cd ${IRIS_LOCATION}/iris-master; + python setup.py --quiet install; + fi; + # Locate Iris installation. - export IRIS_DIR=$(python -c "import iris; import os.path; print(os.path.dirname(iris.__file__))") diff --git a/iris_grib/_grib1_load_rules.py b/iris_grib/_grib1_load_rules.py index 30d366558..fd537442b 100644 --- a/iris_grib/_grib1_load_rules.py +++ b/iris_grib/_grib1_load_rules.py @@ -238,9 +238,9 @@ def add_bounded_time_coords(aux_coords_and_dims, grib): if \ (grib.levelType == 'ml') and \ (hasattr(grib, 'pv')): - aux_coords_and_dims.append((AuxCoord(grib.level, standard_name='model_level_number', attributes={'positive': 'up'}), None)) + aux_coords_and_dims.append((AuxCoord(grib.level, standard_name='model_level_number', units=1, attributes={'positive': 'up'}), None)) aux_coords_and_dims.append((DimCoord(grib.pv[grib.level], long_name='level_pressure', units='Pa'), None)) - aux_coords_and_dims.append((AuxCoord(grib.pv[grib.numberOfCoordinatesValues//2 + grib.level], long_name='sigma'), None)) + aux_coords_and_dims.append((AuxCoord(grib.pv[grib.numberOfCoordinatesValues//2 + grib.level], long_name='sigma', units=1), None)) factories.append(Factory(HybridPressureFactory, [{'long_name': 'level_pressure'}, {'long_name': 'sigma'}, Reference('surface_pressure')])) if grib._originatingCentre != 'unknown': diff --git a/iris_grib/_load_convert.py b/iris_grib/_load_convert.py index 8cc62a25a..33c7e6a69 100644 --- a/iris_grib/_load_convert.py +++ b/iris_grib/_load_convert.py @@ -1545,7 +1545,7 @@ def hybrid_factories(section, metadata): # Create the model level number scalar coordinate. scaledValue = section['scaledValueOfFirstFixedSurface'] coord = DimCoord(scaledValue, standard_name='model_level_number', - attributes=dict(positive='up')) + units=1, attributes=dict(positive='up')) metadata['aux_coords_and_dims'].append((coord, None)) if typeOfFirstFixedSurface == 118: @@ -1576,7 +1576,7 @@ def hybrid_factories(section, metadata): metadata['aux_coords_and_dims'].append((coord, None)) # Create the sigma scalar coordinate. offset = NV // 2 + scaledValue - coord = AuxCoord(pv[offset], long_name='sigma') + coord = AuxCoord(pv[offset], long_name='sigma', units=1) metadata['aux_coords_and_dims'].append((coord, None)) # Create the associated factory reference. factory = Factory(factory_class, factory_args) @@ -2286,19 +2286,22 @@ def satellite_common(section, metadata): if NB > 0: # Create the satellite series coordinate. satelliteSeries = section['satelliteSeries'] - coord = AuxCoord(satelliteSeries, long_name='satellite_series') + coord = AuxCoord(satelliteSeries, long_name='satellite_series', + units=1) # Add the satellite series coordinate to the metadata aux coords. metadata['aux_coords_and_dims'].append((coord, None)) # Create the satellite number coordinate. satelliteNumber = section['satelliteNumber'] - coord = AuxCoord(satelliteNumber, long_name='satellite_number') + coord = AuxCoord(satelliteNumber, long_name='satellite_number', + units=1) # Add the satellite number coordinate to the metadata aux coords. metadata['aux_coords_and_dims'].append((coord, None)) # Create the satellite instrument type coordinate. instrumentType = section['instrumentType'] - coord = AuxCoord(instrumentType, long_name='instrument_type') + coord = AuxCoord(instrumentType, long_name='instrument_type', + units=1) # Add the instrument type coordinate to the metadata aux coords. metadata['aux_coords_and_dims'].append((coord, None)) diff --git a/iris_grib/tests/results/integration/load_convert/data_section/TestGDT30/lambert.cml b/iris_grib/tests/results/integration/load_convert/data_section/TestGDT30/lambert.cml index 215a0de88..dff111dc7 100644 --- a/iris_grib/tests/results/integration/load_convert/data_section/TestGDT30/lambert.cml +++ b/iris_grib/tests/results/integration/load_convert/data_section/TestGDT30/lambert.cml @@ -15,16 +15,16 @@ - - + - - + diff --git a/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib1.cml b/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib1.cml index 74fe0a27f..56e96e7a4 100644 --- a/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib1.cml +++ b/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib1.cml @@ -16,16 +16,16 @@ - - + - - + diff --git a/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib2.cml b/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib2.cml index dc938f0ac..813553b5d 100644 --- a/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib2.cml +++ b/iris_grib/tests/results/integration/load_convert/sample_file_loads/lambert_grib2.cml @@ -15,16 +15,16 @@ - - + - - + diff --git a/iris_grib/tests/unit/grib1_load_rules/test_grib1_convert.py b/iris_grib/tests/unit/grib1_load_rules/test_grib1_convert.py index b8e990bbc..e84b9a1a4 100644 --- a/iris_grib/tests/unit/grib1_load_rules/test_grib1_convert.py +++ b/iris_grib/tests/unit/grib1_load_rules/test_grib1_convert.py @@ -9,11 +9,10 @@ # importing anything else import iris_grib.tests as tests -import cf_units import gribapi from unittest import mock -import iris +from iris.aux_factory import HybridPressureFactory from iris.exceptions import TranslationError from iris.fileformats.rules import Reference @@ -109,27 +108,23 @@ def test_grib1_hybrid_height(self): results = grib1_convert(gw) factory, = results[0] - self.assertEqual(factory.factory_class, - iris.aux_factory.HybridPressureFactory) + self.assertEqual(factory.factory_class, HybridPressureFactory) delta, sigma, ref = factory.args self.assertEqual(delta, {'long_name': 'level_pressure'}) self.assertEqual(sigma, {'long_name': 'sigma'}) self.assertEqual(ref, Reference(name='surface_pressure')) - ml_ref = iris.coords.CoordDefn('model_level_number', None, None, - cf_units.Unit('1'), - {'positive': 'up'}, None, False) - lp_ref = iris.coords.CoordDefn(None, 'level_pressure', None, - cf_units.Unit('Pa'), - {}, None, False) - s_ref = iris.coords.CoordDefn(None, 'sigma', None, - cf_units.Unit('1'), - {}, None, False) - - aux_coord_defns = [coord._as_defn() for coord, dim in results[8]] - self.assertIn(ml_ref, aux_coord_defns) - self.assertIn(lp_ref, aux_coord_defns) - self.assertIn(s_ref, aux_coord_defns) + coords_and_dims = results[8] + coord, = [co for co, _ in coords_and_dims + if co.name() == 'model_level_number'] + self.assertEqual(coord.units, '1') + self.assertEqual(coord.attributes['positive'], 'up') + coord, = [co for co, _ in coords_and_dims + if co.name() == 'level_pressure'] + self.assertEqual(coord.units, 'Pa') + coord, = [co for co, _ in coords_and_dims + if co.name() == 'sigma'] + self.assertEqual(coord.units, '1') if __name__ == "__main__": diff --git a/iris_grib/tests/unit/load_convert/test_satellite_common.py b/iris_grib/tests/unit/load_convert/test_satellite_common.py index edcdd2e23..d2814ddcd 100644 --- a/iris_grib/tests/unit/load_convert/test_satellite_common.py +++ b/iris_grib/tests/unit/load_convert/test_satellite_common.py @@ -43,11 +43,11 @@ def _check(self, factors=1, values=111): # Check the result. expected = empty_metadata() - coord = AuxCoord(series, long_name='satellite_series') + coord = AuxCoord(series, long_name='satellite_series', units=1) expected['aux_coords_and_dims'].append((coord, None)) - coord = AuxCoord(number, long_name='satellite_number') + coord = AuxCoord(number, long_name='satellite_number', units=1) expected['aux_coords_and_dims'].append((coord, None)) - coord = AuxCoord(instrument, long_name='instrument_type') + coord = AuxCoord(instrument, long_name='instrument_type', units=1) expected['aux_coords_and_dims'].append((coord, None)) standard_name = 'sensor_band_central_radiation_wavenumber' coord = AuxCoord(values / (10.0 ** factors), From 85a5f4badba31a000029a4c3584cc250764810dc Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Mon, 12 Oct 2020 13:58:23 +0100 Subject: [PATCH 2/8] Cosmetic change : rename the travis iris-test-version options (#234) * Rename Iris test-version options, and enable all to check action. * Review changes. --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index fabdc93c7..085c87460 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ dist: xenial env: matrix: - - PYTHON_VERSION=36 LIMIT_TO_RELEASED_IRIS=false - - PYTHON_VERSION=37 LIMIT_TO_RELEASED_IRIS=false - # - PYTHON_VERSION=36 LIMIT_TO_RELEASED_IRIS=true - # - PYTHON_VERSION=37 LIMIT_TO_RELEASED_IRIS=true + - PYTHON_VERSION=36 IRIS_SOURCE=master + - PYTHON_VERSION=37 IRIS_SOURCE=master + - PYTHON_VERSION=36 IRIS_SOURCE=release + - PYTHON_VERSION=37 IRIS_SOURCE=release install: # Download iris-test-data @@ -42,10 +42,10 @@ install: export ENV_NAME="iris-grib-dev"; export ENV_FILE="${TRAVIS_BUILD_DIR}/requirements/ci/py${PYTHON_VERSION}.yml"; - # Optionally download latest Iris from repo, + # Optionally download latest Iris master, from the github repo, # and replace the Iris dependency with Iris' underlying dependencies. - > - if [[ "${LIMIT_TO_RELEASED_IRIS}" == false ]]; then + if [[ "${IRIS_SOURCE}" == "master" ]]; then IRIS_REF="https://github.com/SciTools/iris/archive/master.zip"; export IRIS_LOCATION="${HOME}/iris"; mkdir ${IRIS_LOCATION}; @@ -79,9 +79,9 @@ install: # -------------- - echo "Configuring Iris"; - # Optionally install latest Iris from downloaded source. + # Optionally install latest Iris master, from downloaded source. - > - if [[ "${LIMIT_TO_RELEASED_IRIS}" == false ]]; then + if [[ "${IRIS_SOURCE}" == "master" ]]; then cd ${IRIS_LOCATION}/iris-master; python setup.py --quiet install; fi; From 9c6bea69d931845f33c7122298c064415439d399 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Mon, 12 Oct 2020 15:22:28 +0100 Subject: [PATCH 3/8] Version 0.16 release candidate (#232) * Require Iris >=3 (just for the gdt90 changes). * Whatsnew entry for requiring Iris 3. * Set version string for release candidate. * Test against Iris 3.0.0rc0 from conda-forge/rc_iris. --- docs/ref/release_notes.rst | 8 ++++++++ iris_grib/__init__.py | 2 +- requirements/ci/py36.yml | 4 ++-- requirements/ci/py37.yml | 4 ++-- requirements/core.txt | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/ref/release_notes.rst b/docs/ref/release_notes.rst index 87feaaef0..e3f49876e 100644 --- a/docs/ref/release_notes.rst +++ b/docs/ref/release_notes.rst @@ -64,6 +64,14 @@ Bugs Fixed only the Iris coordinate system has changed. `(PR#223) `_ +Dependencies +^^^^^^^^^^^^ + +* now requires Iris version >= 3.0 + Needed for the bugfix in + `PR#223 `_ . + + What's new in iris-grib v0.15.1 ------------------------------- diff --git a/iris_grib/__init__.py b/iris_grib/__init__.py index 1f40af63a..cb927950d 100644 --- a/iris_grib/__init__.py +++ b/iris_grib/__init__.py @@ -33,7 +33,7 @@ from .message import GribMessage -__version__ = '0.15.1' +__version__ = '0.16.0rc0' __all__ = ['load_cubes', 'save_grib2', 'load_pairs_from_fields', 'save_pairs_from_cube', 'save_messages'] diff --git a/requirements/ci/py36.yml b/requirements/ci/py36.yml index 85bfcd5cf..c827c5afc 100644 --- a/requirements/ci/py36.yml +++ b/requirements/ci/py36.yml @@ -1,7 +1,7 @@ name: iris-grib-dev channels: - - conda-forge + - conda-forge/label/rc_iris dependencies: - python=3.6 @@ -10,7 +10,7 @@ dependencies: - setuptools # Core dependencies. - - iris>=2.4 + - iris=3.0.0rc0 - python-eccodes # Optional dependencies. diff --git a/requirements/ci/py37.yml b/requirements/ci/py37.yml index 65f0f0b58..9646baf7e 100644 --- a/requirements/ci/py37.yml +++ b/requirements/ci/py37.yml @@ -1,7 +1,7 @@ name: iris-grib-dev channels: - - conda-forge + - conda-forge/label/rc_iris dependencies: - python=3.7 @@ -10,7 +10,7 @@ dependencies: - setuptools # Core dependencies. - - iris>=2.4 + - iris=3.0.0rc0 - python-eccodes # Optional dependencies. diff --git a/requirements/core.txt b/requirements/core.txt index f88d210d9..8ae4936c0 100644 --- a/requirements/core.txt +++ b/requirements/core.txt @@ -1,4 +1,4 @@ # Core dependencies. -scitools-iris>=2.4 +scitools-iris>=3.0.0rc0 eccodes-python From 5a96b74dc01b4c5f692a3e3351b60adf6e4c0ca8 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Mon, 12 Oct 2020 15:49:25 +0100 Subject: [PATCH 4/8] Fix RC date in release notes (about to cut). (#235) --- docs/ref/release_notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ref/release_notes.rst b/docs/ref/release_notes.rst index e3f49876e..7a9177bf4 100644 --- a/docs/ref/release_notes.rst +++ b/docs/ref/release_notes.rst @@ -6,7 +6,7 @@ What's new in iris-grib v0.16 ----------------------------- :Release: 0.16.0 -:Date: ?? Sep 2020 +:Date: 12 Oct 2020 Features ^^^^^^^^ From 9a5859fdd3a4dd078bdbb2836b8d10cda69d2a58 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Wed, 20 Jan 2021 16:02:49 +0000 Subject: [PATCH 5/8] Add 'main' conda-forge channel, needed for docs builds. (#240) * Add 'main' conda-forge channel, needed for docs builds. * Use fixed spherical-earth-radius in GRIB1, ignoring change in gribapi default. * Codestyle fix. --- iris_grib/__init__.py | 68 +++++++++++++--------------------------- requirements/ci/py36.yml | 1 + requirements/ci/py37.yml | 1 + 3 files changed, 23 insertions(+), 47 deletions(-) diff --git a/iris_grib/__init__.py b/iris_grib/__init__.py index cb927950d..5e9093eca 100644 --- a/iris_grib/__init__.py +++ b/iris_grib/__init__.py @@ -342,56 +342,30 @@ def _compute_extra_keys(self): self.extra_keys['_forecastTimeUnit'] = self._timeunit_string() # shape of the earth - - # pre-defined sphere - if self.shapeOfTheEarth == 0: + soe_code = self.shapeOfTheEarth + # As this class is now *only* for GRIB1, 'shapeOfTheEarth' is not a + # value read from the actual file : It is really a GRIB2 param, and + # the value is merely what eccodes (gribapi) gives as the default. + # This was always = 6, until eccodes 0.19, when it changed to 0. + # See https://jira.ecmwf.int/browse/ECC-811 + # The two represent different sized spherical earths. + if soe_code not in (6, 0): + raise ValueError('Unexpected shapeOfTheEarth value =', soe_code) + + soe_code = 6 + # *FOR NOW* maintain the old behaviour (radius=6371229) in all cases, + # for backwards compatibility. + # However, this does not match the 'radiusOfTheEarth' default from the + # gribapi so is probably incorrect (see above issue ECC-811). + # So we may change this in future. + + if soe_code == 0: + # New supposedly-correct default value, matches 'radiusOfTheEarth'. geoid = coord_systems.GeogCS(semi_major_axis=6367470) - - # custom sphere - elif self.shapeOfTheEarth == 1: - geoid = coord_systems.GeogCS( - self.scaledValueOfRadiusOfSphericalEarth * - 10 ** -self.scaleFactorOfRadiusOfSphericalEarth) - - # IAU65 oblate sphere - elif self.shapeOfTheEarth == 2: - geoid = coord_systems.GeogCS(6378160, inverse_flattening=297.0) - - # custom oblate spheroid (km) - elif self.shapeOfTheEarth == 3: - geoid = coord_systems.GeogCS( - semi_major_axis=self.scaledValueOfEarthMajorAxis * - 10 ** -self.scaleFactorOfEarthMajorAxis * 1000., - semi_minor_axis=self.scaledValueOfEarthMinorAxis * - 10 ** -self.scaleFactorOfEarthMinorAxis * 1000.) - - # IAG-GRS80 oblate spheroid - elif self.shapeOfTheEarth == 4: - geoid = coord_systems.GeogCS(6378137, None, 298.257222101) - - # WGS84 - elif self.shapeOfTheEarth == 5: - geoid = \ - coord_systems.GeogCS(6378137, inverse_flattening=298.257223563) - - # pre-defined sphere - elif self.shapeOfTheEarth == 6: + elif soe_code == 6: + # Old value, does *not* match the 'radiusOfTheEarth' parameter. geoid = coord_systems.GeogCS(6371229) - # custom oblate spheroid (m) - elif self.shapeOfTheEarth == 7: - geoid = coord_systems.GeogCS( - semi_major_axis=self.scaledValueOfEarthMajorAxis * - 10 ** -self.scaleFactorOfEarthMajorAxis, - semi_minor_axis=self.scaledValueOfEarthMinorAxis * - 10 ** -self.scaleFactorOfEarthMinorAxis) - - elif self.shapeOfTheEarth == 8: - raise ValueError("unhandled shape of earth : grib earth shape = 8") - - else: - raise ValueError("undefined shape of earth") - gridType = gribapi.grib_get_string(self.grib_message, "gridType") if gridType in ["regular_ll", "regular_gg", "reduced_ll", diff --git a/requirements/ci/py36.yml b/requirements/ci/py36.yml index c827c5afc..46a059d75 100644 --- a/requirements/ci/py36.yml +++ b/requirements/ci/py36.yml @@ -2,6 +2,7 @@ name: iris-grib-dev channels: - conda-forge/label/rc_iris + - conda-forge dependencies: - python=3.6 diff --git a/requirements/ci/py37.yml b/requirements/ci/py37.yml index 9646baf7e..c723e6174 100644 --- a/requirements/ci/py37.yml +++ b/requirements/ci/py37.yml @@ -2,6 +2,7 @@ name: iris-grib-dev channels: - conda-forge/label/rc_iris + - conda-forge dependencies: - python=3.7 From e0ade8d02cad96cdd7674d2075af36f3a41a6c5a Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Wed, 27 Jan 2021 12:28:38 +0000 Subject: [PATCH 6/8] Update requirements to pick up Iris 3. (#243) --- requirements/ci/py36.yml | 3 +-- requirements/ci/py37.yml | 3 +-- requirements/core.txt | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/requirements/ci/py36.yml b/requirements/ci/py36.yml index 46a059d75..e9293f3ca 100644 --- a/requirements/ci/py36.yml +++ b/requirements/ci/py36.yml @@ -1,7 +1,6 @@ name: iris-grib-dev channels: - - conda-forge/label/rc_iris - conda-forge dependencies: @@ -11,7 +10,7 @@ dependencies: - setuptools # Core dependencies. - - iris=3.0.0rc0 + - iris>=3 - python-eccodes # Optional dependencies. diff --git a/requirements/ci/py37.yml b/requirements/ci/py37.yml index c723e6174..98c7f5c52 100644 --- a/requirements/ci/py37.yml +++ b/requirements/ci/py37.yml @@ -1,7 +1,6 @@ name: iris-grib-dev channels: - - conda-forge/label/rc_iris - conda-forge dependencies: @@ -11,7 +10,7 @@ dependencies: - setuptools # Core dependencies. - - iris=3.0.0rc0 + - iris>=3 - python-eccodes # Optional dependencies. diff --git a/requirements/core.txt b/requirements/core.txt index 8ae4936c0..21263d7a0 100644 --- a/requirements/core.txt +++ b/requirements/core.txt @@ -1,4 +1,4 @@ # Core dependencies. -scitools-iris>=3.0.0rc0 +scitools-iris>=3 eccodes-python From 93fc344125d0d69f143bd77317e31c29e909fa92 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Wed, 27 Jan 2021 15:05:47 +0000 Subject: [PATCH 7/8] Remove eccodes bug workaround added in #208. (#224) --- iris_grib/_save_rules.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/iris_grib/_save_rules.py b/iris_grib/_save_rules.py index cb331cf29..0f0e4df35 100644 --- a/iris_grib/_save_rules.py +++ b/iris_grib/_save_rules.py @@ -1490,12 +1490,6 @@ def data_section(cube, grib): gribapi.grib_set(grib, "bitmapPresent", 1) gribapi.grib_set_double(grib, "missingValue", fill_value) - # A segmentation fault is raised by `gribapi.grib_set_double_array` if it - # tries to cast large data to float64. As a temporary fix we cast the data - # upfront - # TODO: remove the `astype` command once eccodes (gribapi) has been fixed. - if data.dtype != np.float64: - data = data.astype(np.float64) gribapi.grib_set_double_array(grib, "values", data.flatten()) # todo: check packing accuracy? From df97291e431f832d865719a7c7e76eea0629be20 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Wed, 27 Jan 2021 15:42:44 +0000 Subject: [PATCH 8/8] Docstest 0v16 (#244) * Document PR#240 in release notes. * Fix version string and release-notes date. --- docs/ref/release_notes.rst | 14 ++++++++++++-- iris_grib/__init__.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/ref/release_notes.rst b/docs/ref/release_notes.rst index 7a9177bf4..dc361c142 100644 --- a/docs/ref/release_notes.rst +++ b/docs/ref/release_notes.rst @@ -1,12 +1,12 @@ Release Notes ============= -======= + What's new in iris-grib v0.16 ----------------------------- :Release: 0.16.0 -:Date: 12 Oct 2020 +:Date: 27 Jan 2021 Features ^^^^^^^^ @@ -64,6 +64,16 @@ Bugs Fixed only the Iris coordinate system has changed. `(PR#223) `_ +* `@pp-mo `_ fixed a problem where cubes were loading from GRIB 1 with a changed coordinate + system, since eccodes versions >= 1.19. This resulted from a change to eccodes, which now returns a different + 'shapeOfTheEarth' parameter : see `eccodes issue ECC-811 `_ . This resulted + in a coordinate system with a different earth radius. + For backwards compatibilty, the earth radius has now been fixed to the same value as previously. + However, pending further investigation, this value may be technically incorrect and we may + yet decide to change it in a future release. + `(PR#240) `_ + + Dependencies ^^^^^^^^^^^^ diff --git a/iris_grib/__init__.py b/iris_grib/__init__.py index 5e9093eca..24ceb845a 100644 --- a/iris_grib/__init__.py +++ b/iris_grib/__init__.py @@ -33,7 +33,7 @@ from .message import GribMessage -__version__ = '0.16.0rc0' +__version__ = '0.16.0' __all__ = ['load_cubes', 'save_grib2', 'load_pairs_from_fields', 'save_pairs_from_cube', 'save_messages']