File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
lib/iris/tests/integration/netcdf Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -85,3 +85,18 @@ def test_mixture_saveload(self):
8585 self ._strip_saveload_additions (cube )
8686 assert read_dataless == dataless
8787 assert read_dataful == dataful
88+
89+ def test_nodata_size (self ):
90+ # Check that a file saved with a large dataless cube does *not* occupy a large
91+ # amount of diskspace.
92+ ny , nx = 10000 , 10000
93+ data_dims = (ny , nx )
94+ dataless_cube = Cube (shape = data_dims )
95+
96+ iris .save (dataless_cube , self .test_path )
97+
98+ data_size_bytes = ny * nx # bytes, since dtype is "u1" (approx 100Mb)
99+ filesize_bytes = self .test_path .stat ().st_size
100+ # Check that the file size < 1/10 variable array size
101+ # The 0.1 is a bit arbitrary, but it makes the point!
102+ assert filesize_bytes < 0.1 * data_size_bytes
You can’t perform that action at this time.
0 commit comments