-
Notifications
You must be signed in to change notification settings - Fork 300
Get working with iris-grib-with-eccodes; Python 3 included. #2887
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # (C) British Crown Copyright 2013 - 2016, Met Office | ||
| # (C) British Crown Copyright 2013 - 2017, Met Office | ||
| # | ||
| # This file is part of Iris. | ||
| # | ||
|
|
@@ -72,21 +72,19 @@ def check_common(self, name_cube, grib_cube): | |
| def test_name2_field(self): | ||
| filepath = tests.get_data_path(('NAME', 'NAMEII_field.txt')) | ||
| name_cubes = iris.load(filepath) | ||
| # Check gribapi version, because we currently have a known load/save | ||
| # problem with gribapi 1v14 (at least). | ||
| gribapi_ver = gribapi.grib_get_api_version() | ||
| gribapi_fully_supported_version = \ | ||
| (StrictVersion(gribapi.grib_get_api_version()) < | ||
| StrictVersion('1.13')) | ||
|
|
||
| # There is a known load/save problem with numerous | ||
| # gribapi/eccodes versions and | ||
| # zero only data, where min == max. | ||
| # This may be a problem with data scaling. | ||
| for i, name_cube in enumerate(name_cubes): | ||
| if not gribapi_fully_supported_version: | ||
| data = name_cube.data | ||
| if np.min(data) == np.max(data): | ||
| msg = ('NAMEII cube #{}, "{}" has empty data : ' | ||
| 'SKIPPING test for this cube, as save/load will ' | ||
| 'not currently work with gribabi > 1v12.') | ||
| warnings.warn(msg.format(i, name_cube.name())) | ||
| continue | ||
| data = name_cube.data | ||
| if np.min(data) == np.max(data): | ||
| msg = ('NAMEII cube #{}, "{}" has empty data : ' | ||
| 'SKIPPING test for this cube, as save/load will ' | ||
| 'not currently work.') | ||
| warnings.warn(msg.format(i, name_cube.name())) | ||
| continue | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I know it 's not your change but... ) We have more sophisticated means for skipping tests...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this isn't skipping a test, it's skipping one of the cubes tested within a single testcase. |
||
|
|
||
| with self.temp_filename('.grib2') as temp_filename: | ||
| iris.save(name_cube, temp_filename) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # (C) British Crown Copyright 2010 - 2016, Met Office | ||
| # (C) British Crown Copyright 2010 - 2017, Met Office | ||
| # | ||
| # This file is part of Iris. | ||
| # | ||
|
|
@@ -34,6 +34,7 @@ | |
|
|
||
| if tests.GRIB_AVAILABLE: | ||
| import gribapi | ||
| from iris_grib._load_convert import _MDI as MDI | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a private API, we obviously we shouldn't be relying on this, but happy enough for now. |
||
|
|
||
|
|
||
| @tests.skip_data | ||
|
|
@@ -50,10 +51,10 @@ def test_latlon_forecast_plev(self): | |
| iris.save(cubes, temp_file_path) | ||
| expect_diffs = {'totalLength': (4837, 4832), | ||
| 'productionStatusOfProcessedData': (0, 255), | ||
| 'scaleFactorOfRadiusOfSphericalEarth': (4294967295, | ||
| 'scaleFactorOfRadiusOfSphericalEarth': (MDI, | ||
| 0), | ||
| 'shapeOfTheEarth': (0, 1), | ||
| 'scaledValueOfRadiusOfSphericalEarth': (4294967295, | ||
| 'scaledValueOfRadiusOfSphericalEarth': (MDI, | ||
| 6367470), | ||
| 'typeOfGeneratingProcess': (0, 255), | ||
| 'generatingProcessIdentifier': (128, 255), | ||
|
|
@@ -70,10 +71,10 @@ def test_rotated_latlon(self): | |
| iris.save(cubes, temp_file_path) | ||
| expect_diffs = {'totalLength': (648196, 648191), | ||
| 'productionStatusOfProcessedData': (0, 255), | ||
| 'scaleFactorOfRadiusOfSphericalEarth': (4294967295, | ||
| 'scaleFactorOfRadiusOfSphericalEarth': (MDI, | ||
| 0), | ||
| 'shapeOfTheEarth': (0, 1), | ||
| 'scaledValueOfRadiusOfSphericalEarth': (4294967295, | ||
| 'scaledValueOfRadiusOfSphericalEarth': (MDI, | ||
| 6367470), | ||
| 'longitudeOfLastGridPoint': (392109982, 32106370), | ||
| 'latitudeOfLastGridPoint': (19419996, 19419285), | ||
|
|
@@ -91,10 +92,10 @@ def test_time_mean(self): | |
| cubes = iris.load(source_grib) | ||
| expect_diffs = {'totalLength': (21232, 21227), | ||
| 'productionStatusOfProcessedData': (0, 255), | ||
| 'scaleFactorOfRadiusOfSphericalEarth': (4294967295, | ||
| 'scaleFactorOfRadiusOfSphericalEarth': (MDI, | ||
| 0), | ||
| 'shapeOfTheEarth': (0, 1), | ||
| 'scaledValueOfRadiusOfSphericalEarth': (4294967295, | ||
| 'scaledValueOfRadiusOfSphericalEarth': (MDI, | ||
| 6367470), | ||
| 'longitudeOfLastGridPoint': (356249908, 356249809), | ||
| 'latitudeOfLastGridPoint': (-89999938, -89999944), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍