Commit c4212abe authored by PIOLLE's avatar PIOLLE
Browse files

aligned dims and sizes methods with xarray

parent 0703bc46
...@@ -331,13 +331,21 @@ class Field(object): ...@@ -331,13 +331,21 @@ class Field(object):
self._array.encoding = attrs self._array.encoding = attrs
@property @property
def dims(self) -> Tuple[str, int]: def sizes(self) -> Mapping[Hashable, int]:
"""A tuple of the field dimensions name and size""" """A tuple of the field dimensions name and size"""
if self.dataset is None: if self.dataset is None:
return tuple(self._array.dims) return self._array.sizes
else: else:
return self.dataset.get_field_sizes(self.name) return self.dataset.get_field_sizes(self.name)
@property
def dims(self) -> Tuple[str]:
"""A tuple of the field dimensions name and size"""
if self.dataset is None:
return self._array.dims
else:
return self.dataset.get_field_dims(self.name)
@dims.setter @dims.setter
def dims(self, dims): def dims(self, dims):
if self.dataset is None: if self.dataset is None:
......
...@@ -91,12 +91,15 @@ encoding: ...@@ -91,12 +91,15 @@ encoding:
lat: lat:
dtype: float32 dtype: float32
_FillValue: 1.e+20
least_significant_digit: 3 least_significant_digit: 3
lon: lon:
dtype: float32 dtype: float32
_FillValue: 1.e+20
least_significant_digit: 3 least_significant_digit: 3
time: time:
dtype: int32 dtype: float64
_FillValue: 1.e+20
units: 'seconds since 1981-01-01 00:00:00.000000Z' units: 'seconds since 1981-01-01 00:00:00.000000Z'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment