-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cache Dask arrays created from
NetCDFDataProxy
s to speed up loading…
… files with multiple variables (#6252) * Cache Dask arrays to speed up loading files with multiple variables * Add benchmark for files with many cubes * Add whatsnew * Add test * Add license header * Use a global to set the cache size * Update whatsnew
- Loading branch information
1 parent
8f5cb02
commit 472db73
Showing
4 changed files
with
80 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright Iris contributors | ||
# | ||
# This file is part of Iris and is released under the BSD license. | ||
# See LICENSE in the root of the repository for full licensing details. | ||
"""Test function :func:`iris._lazy data.LRUCache`.""" | ||
|
||
from iris._lazy_data import LRUCache | ||
|
||
|
||
def test_lrucache(): | ||
cache = LRUCache(2) | ||
|
||
cache["a"] = 1 | ||
|
||
assert "a" in cache | ||
assert cache["a"] == 1 | ||
|
||
cache["b"] = 2 | ||
cache["c"] = 3 | ||
|
||
assert "a" not in cache | ||
assert "b" in cache | ||
assert "c" in cache | ||
|
||
assert str(cache) == "<LRUCache maxsize=2 cache={'b': 2, 'c': 3} >" |