@@ -196,6 +196,11 @@ def test_roundtrip_timedelta_data(self):
196
196
with self .roundtrip (expected ) as actual :
197
197
self .assertDatasetIdentical (expected , actual )
198
198
199
+ def test_roundtrip_float64_data (self ):
200
+ expected = Dataset ({'x' : ('y' , np .array ([1.0 , 2.0 , np .pi ], dtype = 'float64' ))})
201
+ with self .roundtrip (expected ) as actual :
202
+ self .assertDatasetIdentical (expected , actual )
203
+
199
204
def test_roundtrip_example_1_netcdf (self ):
200
205
expected = open_example_dataset ('example_1.nc' )
201
206
with self .roundtrip (expected ) as actual :
@@ -266,7 +271,7 @@ def test_roundtrip_strings_with_fill_value(self):
266
271
# netCDF4 can't keep track of an empty _FillValue for VLEN
267
272
# variables
268
273
expected ['x' ][- 1 ] = ''
269
- elif (type (self ) is NetCDF3ViaNetCDF4DataTest
274
+ elif (isinstance (self , ( NetCDF3ViaNetCDF4DataTest , NetCDF4ClassicViaNetCDF4DataTest ))
270
275
or (has_netCDF4 and type (self ) is GenericNetCDFDataTest )):
271
276
# netCDF4 can't keep track of an empty _FillValue for nc3, either:
272
277
# https://github.com/Unidata/netcdf4-python/issues/273
@@ -651,6 +656,24 @@ def roundtrip(self, data, **kwargs):
651
656
yield ds
652
657
653
658
659
+ @requires_netCDF4
660
+ class NetCDF4ClassicViaNetCDF4DataTest (CFEncodedDataTest , Only32BitTypes , TestCase ):
661
+ @contextlib .contextmanager
662
+ def create_store (self ):
663
+ with create_tmp_file () as tmp_file :
664
+ with backends .NetCDF4DataStore (tmp_file , mode = 'w' ,
665
+ format = 'NETCDF4_CLASSIC' ) as store :
666
+ yield store
667
+
668
+ @contextlib .contextmanager
669
+ def roundtrip (self , data , ** kwargs ):
670
+ with create_tmp_file () as tmp_file :
671
+ data .to_netcdf (tmp_file , format = 'NETCDF4_CLASSIC' ,
672
+ engine = 'netcdf4' )
673
+ with open_dataset (tmp_file , engine = 'netcdf4' , ** kwargs ) as ds :
674
+ yield ds
675
+
676
+
654
677
@requires_scipy_or_netCDF4
655
678
class GenericNetCDFDataTest (CFEncodedDataTest , Only32BitTypes , TestCase ):
656
679
# verify that we can read and write netCDF3 files as long as we have scipy
0 commit comments