-
Notifications
You must be signed in to change notification settings - Fork 24
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
Get xarray.testing.assert_identical to work on datasets containing ManifestArrays #161
Comments
I think this one should be reopened @TomNicholas, still some issues I'm seeing: Using the example from the docs, this is the only incantation I've found that currently passes :) I'm looking at ds = xr.tutorial.open_dataset('air_temperature', decode_times=False)
ds.to_netcdf('air.nc')
vds = open_virtual_dataset('air.nc',
indexes={},
loadable_variables=['air','time','lon','lat'],
)
xr.testing.assert_identical(ds, vds) |
Tracebacks: 1I think this Error is coming from 'air' having a 'scale_factor' attribute...(#68) ds = xr.tutorial.open_dataset('air_temperature')
ds.to_netcdf('air.nc')
vds = open_virtual_dataset('air.nc')
xr.testing.assert_identical(ds, vds) ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() 2(Doesn't work unless xr.testing.assert_identical(ds.lat, vds.lat) # TypeError: operand type(s) all returned NotImplemented from __array_ufunc__(<ufunc 'equal'>, '__call__', array([75. , 72.5, 70. , 67.5, 65. , 62.5, 60. , 57.5, 55. , 52.5, 50. ,
47.5, 45. , 42.5, 40. , 37.5, 35. , 32.5, 30. , 27.5, 25. , 22.5,
20. , 17.5, 15. ], dtype=float32), ManifestArray<shape=(25,), dtype=float32, chunks=(25,)>): 'ndarray', 'ManifestArray' 3(Differing time values, not sure why) vds = open_virtual_dataset('air.nc',
indexes={},
loadable_variables=['air','lon','lat','time'],
cftime_variables=['time'])
xr.testing.assert_identical(ds, vds) AssertionError: Left and right Dataset objects are not identical
Differing coordinates:
L * time (time) datetime64[ns] 23kB 2013-01-01T00:02:06.757437440 ... 201...
R * time (time) datetime64[ns] 23kB 2013-01-01T00:02:06.757437440 ... 201... |
@scottyhq you're misunderstanding -
There is currently no way to load the values of a (For the general idea that it might be useful to load a ManifestArray, see #124 and pydata/xarray#9281) What these assertions do at the moment is go through xr.testing.assert_identical(vds1, vds2) It's supposed to return VirtualiZarr/virtualizarr/manifests/array.py Line 149 in 179bb2a
(Note also that this |
Your example with the |
We should be able to get xarray.testing.assert_identical to work on datasets containing ManifestArrays. I'm not sure why it doesn't already work (at least for the case of no indexes).
Originally posted by @scottyhq in #143 (comment)
The text was updated successfully, but these errors were encountered: