File tree 3 files changed +8
-1
lines changed
3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ Bug fixes
45
45
- :py:func:`~xray.open_dataset` and :py:func:`~xray.open_mfdataset` support
46
46
supplying chunks as a single integer.
47
47
- Fixed a bug in serializing scalar datetime variable to netCDF.
48
+ - Fixed a bug that could occur in serialization of 0-dimensional integer arrays.
48
49
49
50
v0.5.1 (15 June 2015)
50
51
---------------------
Original file line number Diff line number Diff line change @@ -574,7 +574,7 @@ def maybe_encode_dtype(var):
574
574
dtype = np .dtype (encoding .pop ('dtype' ))
575
575
if dtype != var .dtype and dtype .kind != 'O' :
576
576
if np .issubdtype (dtype , int ):
577
- data = ops .around (data )
577
+ data = ops .around (data )[...]
578
578
if dtype == 'S1' and data .dtype != 'S1' :
579
579
data = string_to_char (np .asarray (data , 'S' ))
580
580
dims = dims + ('string%s' % data .shape [- 1 ],)
Original file line number Diff line number Diff line change @@ -456,6 +456,12 @@ def test_invalid_coordinates(self):
456
456
actual = conventions .decode_cf (original )
457
457
self .assertDatasetIdentical (original , actual )
458
458
459
+ def test_0d_int32_encoding (self ):
460
+ original = Variable ((), np .int32 (0 ), encoding = {'dtype' : 'int64' })
461
+ expected = Variable ((), np .int64 (0 ))
462
+ actual = conventions .maybe_encode_dtype (original )
463
+ self .assertDatasetIdentical (expected , actual )
464
+
459
465
460
466
class CFEncodedInMemoryStore (InMemoryDataStore ):
461
467
def store (self , variables , attributes ):
You can’t perform that action at this time.
0 commit comments