Skip to content

Commit

Permalink
Merge pull request #406 from davidhassell/dask-get-count
Browse files Browse the repository at this point in the history
dask: `Dask.get_count`, `Data.get_index`, `Data.get_list`
  • Loading branch information
davidhassell authored May 13, 2022
2 parents 192c3e2 + 54d6f70 commit 4b77346
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions cf/test/test_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4004,6 +4004,42 @@ def test_Data_get_data(self):
d = cf.Data(9)
self.assertIs(d, d.get_data())

def test_Data_get_count(self):
import cfdm

f = cfdm.read("DSG_timeSeries_contiguous.nc")[0]
f = f.data
d = cf.Data(cf.RaggedContiguousArray(source=f.source()))
self.assertIsInstance(d.get_count(), cfdm.Count)

d = cf.Data(9, "m")
with self.assertRaises(ValueError):
d.get_count()

def test_Data_get_index(self):
import cfdm

f = cfdm.read("DSG_timeSeries_indexed.nc")[0]
f = f.data
d = cf.Data(cf.RaggedIndexedArray(source=f.source()))
self.assertIsInstance(d.get_index(), cfdm.Index)

d = cf.Data(9, "m")
with self.assertRaises(ValueError):
d.get_index()

def test_Data_get_list(self):
import cfdm

f = cfdm.read("gathered.nc")[0]
f = f.data
d = cf.Data(cf.GatheredArray(source=f.source()))
self.assertIsInstance(d.get_list(), cfdm.List)

d = cf.Data(9, "m")
with self.assertRaises(ValueError):
d.get_list()


if __name__ == "__main__":
print("Run date:", datetime.datetime.now())
Expand Down

0 comments on commit 4b77346

Please sign in to comment.