-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support test data in benchmark workflows (#4402)
* Support test data in benchmark workflows * Use existing test data for now to test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Set OVERRIDE_TEST_DATA_REPOSITORY properly * Manually set version number to mirror cirrus.yml * Add licence to top of file * Specify absolute path of test data * Changes to regridding to remove unnecessary print statements * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Can't refer to environment variables in env block * Precommit checks benchmarks too * Set the env var for data location * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add some logging to noxfile for now * Do we have the test data path set right? * Rearrange imports and fix logging * More logging because iris.config.TEST_DATA_DIR was None * More logging and changed mv * Revert logging changes * Enable caching * Update to use new test data * Trim out last bit of logging * Update cache test data directory * Reprompt ci * Fix cache location * Bit of logging to reprompt CI * Remove that logging * Added type hinting * Review changes * Prevent piping hiding benchmark failures Co-authored-by: Martin Yeo <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Martin Yeo <[email protected]>
- Loading branch information
1 parent
323d2a1
commit 94c1a6a
Showing
7 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright Iris contributors | ||
# | ||
# This file is part of Iris and is released under the LGPL license. | ||
# See COPYING and COPYING.LESSER in the root of the repository for full | ||
# licensing details. | ||
""" | ||
Regridding benchmark test | ||
""" | ||
|
||
# import iris tests first so that some things can be initialised before | ||
# importing anything else | ||
from iris import tests # isort:skip | ||
|
||
import iris | ||
from iris.analysis import AreaWeighted | ||
|
||
|
||
class HorizontalChunkedRegridding: | ||
def setup(self) -> None: | ||
# Prepare a cube and a template | ||
|
||
cube_file_path = tests.get_data_path( | ||
["NetCDF", "regrid", "regrid_xyt.nc"] | ||
) | ||
self.cube = iris.load_cube(cube_file_path) | ||
|
||
template_file_path = tests.get_data_path( | ||
["NetCDF", "regrid", "regrid_template_global_latlon.nc"] | ||
) | ||
self.template_cube = iris.load_cube(template_file_path) | ||
|
||
# Chunked data makes the regridder run repeatedly | ||
self.cube.data = self.cube.lazy_data().rechunk((1, -1, -1)) | ||
|
||
def time_regrid_area_w(self) -> None: | ||
# Regrid the cube onto the template. | ||
out = self.cube.regrid(self.template_cube, AreaWeighted()) | ||
# Realise the data | ||
out.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters