Commit f879b53c authored by Jeff Piollé's avatar Jeff Piollé

Merge branch 'hide_xarray' of https://git.cersat.fr/cerbere/cerbere into hide_xarray

parents 7245a99b c9779eb1
......@@ -774,9 +774,10 @@ class Dataset(ABC):
storage type.
"""
if isinstance(self.dataset, Dataset):
kwargs['expand'] = expand
kwargs['expand_dims'] = expand_dims
return self.dataset.get_values(
fieldname, index=index, as_masked_array=as_masked_array,
expand=expand, expand_dims=expand_dims, **kwargs
fieldname, index=index, as_masked_array=as_masked_array, **kwargs
)
# ignore indices not applicable to the field
......@@ -798,9 +799,6 @@ class Dataset(ABC):
# expand over requested dimensions
if expand and expand_dims is not None:
# retrieve the dimensions to expand over
expand_dims = self._feature_geodimnames
fdims = self.get_field_dimnames(fieldname)
for dim in expand_dims[::-1]:
if dim in fdims:
......
......@@ -427,6 +427,25 @@ class Feature(Dataset):
for fieldname, field in child_fields.items():
self.add_field(field)
def get_values(self, fieldname, **kwargs):
"""
Args:
expand (bool): expand the geocoordinate values to the full data
grid. This is only for lat, lon and times in the cases for
instance of cylindrical grids (where lat, lon are provided as
vectors) or average/climatological products (where time is
given as a single value for the whole grid). This returns a lat,
lon or times value for each grid pixel.
For more details on the other arguments, refer to:
:func:`cerbere.dataset.Dataset.get_values`
"""
if 'expand_dims' not in kwargs:
kwargs['expand_dims'] = self._feature_geodimnames
return super(Feature, self).get_values(
fieldname, **kwargs
)
def get_times(self, **kwargs):
"""Return the times of a feature.
......
......@@ -117,24 +117,6 @@ class Grid(Feature):
else:
return ('y', 'x',)
def get_values(self, fieldname, **kwargs):
"""
Args:
expand (bool): expand the geocoordinate values to the full data
grid. This is only for lat, lon and times in the cases for
instance of cylindrical grids (where lat, lon are provided as
vectors) or average/climatological products (where time is
given as a single value for the whole grid). This returns a lat,
lon or times value for each grid pixel.
For more details on the other arguments, refer to:
:func:`cerbere.dataset.Dataset.get_values`
"""
if 'expand_dims' not in kwargs:
kwargs['expand_dims'] = self._feature_geodimnames
return super(Grid, self).get_values(
fieldname, **kwargs
)
# def save(self, output, attrs=None, infer_cf_attrs=False, **kwargs):
......
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