Skip to content
Merged
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions lib/iris/tests/integration/netcdf/test_dataless.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,18 @@ def test_mixture_saveload(self):
self._strip_saveload_additions(cube)
assert read_dataless == dataless
assert read_dataful == dataful

def test_nodata_size(self):
# Check that a file saved with a large dataless cube does *not* occupy a large
# amount of diskspace.
ny, nx = 10000, 10000
data_dims = (ny, nx)
dataless_cube = Cube(shape=data_dims)

iris.save(dataless_cube, self.test_path)

data_size_bytes = ny * nx # bytes, since dtype is "u1" (approx 100Mb)
filesize_bytes = self.test_path.stat().st_size
# Check that the file size < 1/10 variable array size
# The 0.1 is a bit arbitrary, but it makes the point!
assert filesize_bytes < 0.1 * data_size_bytes