-
Notifications
You must be signed in to change notification settings - Fork 300
Reinstate as_lazy_data
#2421
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
Reinstate as_lazy_data
#2421
Changes from all commits
3c8cf68
cc9a9a7
a0ddf14
f358756
b61d19e
d5d374a
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 |
|---|---|---|
|
|
@@ -1003,7 +1003,6 @@ fc_extras | |
| import warnings | ||
|
|
||
| import cf_units | ||
| import dask.array as da | ||
| import netCDF4 | ||
| import numpy as np | ||
| import numpy.ma as ma | ||
|
|
@@ -1018,6 +1017,7 @@ fc_extras | |
| import iris.exceptions | ||
| import iris.std_names | ||
| import iris.util | ||
| from iris._lazy_data import as_lazy_data | ||
|
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. Does it matter what order these are in? I just noticed that in some of the other files the private iris modules are imported first.
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. Ah, I put this here because I'd seen examples where the private modules were imported last 😉 |
||
|
|
||
|
|
||
| # | ||
|
|
@@ -1630,7 +1630,7 @@ fc_extras | |
| proxy = iris.fileformats.netcdf.NetCDFDataProxy( | ||
| cf_var.shape, dtype, engine.filename, | ||
| cf_var.cf_name, fill_value) | ||
| return da.from_array(proxy, chunks=proxy.shape) | ||
| return as_lazy_data(proxy, chunks=proxy.shape) | ||
|
|
||
| # Get any coordinate point data. | ||
| if isinstance(cf_coord_var, cf.CFLabelVariable): | ||
|
|
@@ -1701,7 +1701,7 @@ fc_extras | |
| proxy = iris.fileformats.netcdf.NetCDFDataProxy( | ||
| cf_var.shape, dtype, engine.filename, | ||
| cf_var.cf_name, fill_value) | ||
| return da.from_array(proxy, chunks=proxy.shape) | ||
| return as_lazy_data(proxy, chunks=proxy.shape) | ||
|
|
||
| data = cf_var_as_array(cf_cm_attr) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,11 +24,11 @@ | |
| # importing anything else | ||
| import iris.tests as tests | ||
|
|
||
| import dask.array as da | ||
| import numpy as np | ||
|
|
||
| import iris | ||
| import iris.tests.stock as istk | ||
| from iris._lazy_data import as_lazy_data | ||
|
|
||
| from iris.analysis.trajectory import (Trajectory, | ||
| interpolate as traj_interpolate) | ||
|
|
@@ -233,7 +233,7 @@ class TestLazyData(tests.IrisTest): | |
| def test_hybrid_height(self): | ||
| cube = istk.simple_4d_with_hybrid_height() | ||
| # Put a biggus array on the cube so we can test deferred loading. | ||
| cube.data = da.from_array(cube.data, chunks=cube.data.shape) | ||
| cube.data = as_lazy_data(cube.data) | ||
|
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'm interested why you have removed teh chunking here, and in other tests is there a reason to use the 'magic chunking number' in these cases?
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. Primarily this has been done for consistency, but there are also performance improvements to be had for setting the chunk size to the magic chunk size. |
||
|
|
||
| traj = (('grid_latitude', [20.5, 21.5, 22.5, 23.5]), | ||
| ('grid_longitude', [31, 32, 33, 34])) | ||
|
|
||
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.
I do wonder whether the references to biggus here and on line 43 are necessary. I want to be able to read this code without needing to also know the history of Iris lazy data handling.
Not that this is a blocker to this PR.
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.
Yeah, I guess this is a temporary note for us to describe the background to choosing this number in particular...