Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have Travis test with iris-grib, remove problem tests #3469

Merged
merged 6 commits into from
Oct 22, 2019

Conversation

stephenworsley
Copy link
Contributor

As per #3447, this allows Travis to test all grib tests except the ones currently failing/erroring.

@@ -49,6 +50,7 @@ def test_gdt1(self):
cube = load_cube(path)
self.assertCMLApproxData(cube)

@skip('iris-grib is currently causing errors')
Copy link
Contributor Author

@stephenworsley stephenworsley Oct 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is related to (and possibly solved by) this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this with the latest version of iris-grib and I can confirm that the error does not occur with the current iris-grib master branch.

@stephenworsley stephenworsley added this to the v3.0.0 milestone Oct 16, 2019
@@ -64,6 +65,7 @@ def test_load_time_processed(self):
"time_bound.grib2")))
self.assertCML(cubes, ("grib_load", "time_bound_grib2.cml"))

@skip('iris-grib is currently causing errors')
def test_load_3_layer(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done a bit of experimenting with this test. The error seems to be thrown when trying to realise one of the cubes in cubes. We get the error:
ValueError: cannot reshape array of size 103680 into shape (360,600)
Its worth noting that while cubes[1] has shape (360, 600) (where 360*600 = 12960), cubes[2] has shape (360,288) (where 360*288 = 103680).

It suggests that perhaps the cubes are at some point interfering with each other.
I tried changing the order of the cubelist to
cubes = iris.cube.CubeList([cubes[2], cubes[0], cubes[1]])
and I got the error:
RuntimeError: Invalid GRIB message: /home/travis/build/stephenworsley/iris/iris-test-data/test_data/GRIB/3_layer_viz/3_layer.grib2 @ 671744
Traceback can be found here.
I'm still not sure if this is an Iris or Iris-grib issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, if the CubeList isn't reordered then the test simply fails without errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I reordered the Cubelist as:
cubes = iris.cube.CubeList([cubes[0], cubes[2], cubes[1]])
I got the error:
gribapi.errors.PrematureEndOfFileError: End of resource reached when reading message

The traceback can be found here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that if all the data is realised first, the test succeeds. The data must, however, be realised in the correct order:

cubes[0].data
cubes[1].data
cubes[2].data

where the data in cubes is realised the step before it is reordered.
If cubes[1].data is realised first, it will cause an error (similarly for cubes[2]).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This problem seems to be related to the package python-eccodes. I can replicate this problem when I create a python 3 environment with conda install python-eccodes but not with conda install eccodes. I have had dificulty trying to have travis install eccodes though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for some reason, the most recent version of python-ecodes is 0.9.3 rather than 2.12.3 . When the travis file specifies python-eccodes=0.9.3 then this test no longer errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, this issue is discussed here: conda-forge/python-eccodes-feedstock#49
It looks like in future, a python interface will be added to eccodes so that it will replace python-eccodes and solve this version problem: conda-forge/staged-recipes#9731

@@ -60,7 +60,7 @@ def _mock_gribapi_fetch(message, key):
if key in message:
return message[key]
else:
raise _mock_gribapi.GribInternalError
raise _mock_gribapi.errors.GribInternalError
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gribapi has changed where GribInternalError is stored. Fixing this solves 8 of the 10 errors in the grib tests mentioned in #3447. I've decided not to handle the possibility of both cases since the updated version of iris-grib is the only one which is compatible with python3.

@@ -131,6 +133,7 @@ def test_reduced_ll(self):
("GRIB", "reduced", "reduced_ll.grib1")))
self.assertCML(cube, ("grib_load", "reduced_ll_grib1.cml"))

@skip('iris-grib is currently causing failures')
def test_reduced_gg(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This failure seems to have been introduced by the latest verion of iris-grib. The points of one of the dimensions is reading [0.] rather than [~2.] .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed by the changes suggested in SciTools/iris-grib#150

@@ -280,6 +282,7 @@ def test_regular(self):
cube = load_cube(path)
self.assertCMLApproxData(cube)

@skip('iris-grib is currently causing failures')
def test_reduced(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This failure seems to have been introduced by the latest verion of iris-grib. The points of one of the dimensions is reading [0.] rather than [~2.] .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When loading this file I got the warning:

UserWarning: Unable to create instance of HybridPressureFactory.
The source data contains no field(s) for 'ref_surface_pressure'.

Possibly related to this commit: SciTools/iris-grib@9f26e7a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually related to this issue: SciTools/iris-grib#150
When the suggested changes are applied this test passes again.

@@ -44,6 +45,7 @@ class TestLoadSave(tests.TestGribMessage):
def setUp(self):
self.skip_keys = []

@skip('iris-grib is currently causing failures')
def test_latlon_forecast_plev(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the following three tests are failing due to a change introduced by this commit. It may be appropriate to change the expected_diffs.

@lbdreyer
Copy link
Member

@stephenworsley in the past, when we have skipped tests in Iris we have created a skip decorator in iris.tests.init that we then use on each test.

The benefit of this approach is that we only need to write the message once (in the decorator), and it easier to find other skipped tests that are of the same "type"

@lbdreyer
Copy link
Member

Thanks @stephenworsley !

I have made a new issue to cover the work of moving the tests and ensuring that they are passing (See #3476)

@lbdreyer lbdreyer merged commit ce8e97e into SciTools:master Oct 22, 2019
trexfeathers pushed a commit to trexfeathers/iris that referenced this pull request Jan 13, 2020
* Have Travis test with iris-grib, remove problem tests

* mock GribInternalError correctly

* Update license headers

* account for changes in handling of grib message defaults

* Test against the latest version of python-eccodes

* Moved irir-grib skip to iris.tests
trexfeathers pushed a commit to trexfeathers/iris that referenced this pull request Jan 13, 2020
* Have Travis test with iris-grib, remove problem tests

* mock GribInternalError correctly

* Update license headers

* account for changes in handling of grib message defaults

* Test against the latest version of python-eccodes

* Moved irir-grib skip to iris.tests
pp-mo pushed a commit to pp-mo/iris that referenced this pull request Jan 14, 2020
* Have Travis test with iris-grib, remove problem tests

* mock GribInternalError correctly

* Update license headers

* account for changes in handling of grib message defaults

* Test against the latest version of python-eccodes

* Moved irir-grib skip to iris.tests
trexfeathers added a commit that referenced this pull request Jan 16, 2020
* Bump version to 2.4.0rc0.

* unpin mpl (#3468)

* Merge pull request #3301 from bayliffe/fastpercentilemethod_mask_test

Analysis percentile method - update applicability test for fast_percentile_method

* Have Travis test with iris-grib, remove problem tests (#3469)

* Have Travis test with iris-grib, remove problem tests

* mock GribInternalError correctly

* Update license headers

* account for changes in handling of grib message defaults

* Test against the latest version of python-eccodes

* Moved irir-grib skip to iris.tests

* Merge pull request #2608 from cpelley/PICKLEABLE_FORMATS

TEST: Extends #2569 to unpickle

* _regrid_area_weighted_array: Move axes creation over which weights are calculated to before loop (#3519)

* Purge iris.experimental.regrid np<1.7 support (#3539)

* Add NameConstraint with relaxed name loading (#3463)

* _regrid_area_weighted_array:  move indices variable nearer to use (#3564)

* _regrid_area_weighted_array: Tweak variable order to near other use in code (#3571)

* Fix problems with export and echo command. (#3577)

* Pushdocs fix2 (#3580)

* Revert to single-line command for doctr invocation.

* Added script comment, partly to force Github respin.

* Bracketed six.moves and __future__ imports.

* Fixes required due to the release of iris-grib v0.15.0 (#3582)

* Fix python-eccodes pin in travis (#3593)

* PI-2472: Optimise the area weighted regridding routine (#3598)

* PI-2472: Tweak area weighting regrid move xdim and ydim axes (#3594)

* _regrid_area_weighted_array: Set axis order to y_dim, x_dim last dimensions

* _regrid_area_weighted_array: Extra tests for axes ordering

* PI-2472: Tweak area weighting regrid enforce xdim ydim (#3595)

* _regrid_area_weighted_array: Set axis order to y_dim, x_dim last dimensions

* _regrid_area_weighted_array: Extra tests for axes ordering

* _regrid_area_weighted_array: Ensure x_dim and y_dim

* PI-2472: Tweak area weighting regrid move averaging out of loop (#3596)

* _regrid_area_weighted_array: Refactor weights and move averaging outside loop

* Pin pillow to make graphics tests work again. (#3630)

* PI-2472: Area weighted regridding (#3623)

* The Area-weights routine is refactored into the "__prepare" and "__perform" structure, in-line with our other regridding methods.
* The area-weights are now computed in the "__prepare", so are calculated once.
* The information required for checking the regridding weights and target grid info are now cached on the "regridder" object.
* This is inline with the general use already described in the documentation.

* pep8 conformance.

* pep8 compliance.

* Allow some 'key=None' args in Geostationary creation. (#3628)

LGTM

* Allow some 'key=None' args in Geostationary creation.

* Integration test loading netcdf geostationary without offset properties.

* pep8 conformance.

* pep8 conformance.

* pep8 conformance.

* test_NameConstraint get mock from iris.tests.

* Remove use of super() in _constraints.py for Py2 compatibility.

* Updated license headers.

* Updated iris-grib reference in extensions.txt.

* Py2 support for iris-grib in Travis.

* Updates for auto docs for Iris 2.4 release.

* What's new entry to unpinning mpl.

* Edited Py2 support for iris-grib in Travis.

* Renamed whatsnew contributions folder for v2.4.

* Hacked tests.integration.test_grib2 to avoid import error from iris-grib version < 0.15.

* Only test grib with python 3.

* Compiled v2.4 whatsnew.

Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Bill Little <[email protected]>
Co-authored-by: stephenworsley <[email protected]>
Co-authored-by: abooton <[email protected]>
Co-authored-by: lbdreyer <[email protected]>
Co-authored-by: Emma Hogan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants