Skip to content
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

dask: Data.compressed_array #400

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions cf/test/test_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2883,9 +2883,6 @@ def test_Data_where(self):
self.assertTrue((e.array == a).all())

def test_Data__init__compression(self):
if self.test_only and inspect.stack()[0][3] not in self.test_only:
return

import cfdm

# Ragged
Expand Down Expand Up @@ -3931,6 +3928,23 @@ def test_Data_rtol(self):
cf.rtol(0.001)
self.assertEqual(d._rtol, 0.001)

def test_Data_compressed_array(self):
import cfdm

f = cfdm.read("DSG_timeSeries_contiguous.nc")[0]
f = f.data
d = cf.Data(cf.RaggedContiguousArray(source=f.source()))
self.assertTrue((d.compressed_array == f.compressed_array).all())

d = cf.Data([1, 2, 3], "m")
with self.assertRaises(Exception):
d.compressed_array

# TODO: when cfdm>1.9.0.3 is released (i.e. a release that
# includes https://github.com/NCAS-CMS/cfdm/pull/184),
# we can replace the loose "(Exception)" with the tight
# "(ValueError)"

def test_Data_inspect(self):
d = cf.Data([9], "m")

Expand Down