Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation coverage #130

Merged
merged 9 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cf/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ def _create_hash_and_first_values(meta, axes, donotchecknonaggregatingaxes,
last_values.append(last)

if coord.has_bounds():
if coord.isdimension:
if coord.construct_type == 'dimension_coordinate':
# Get the hash of the dimension coordinate
# bounds data array and its first and last
# cell values
Expand Down
22 changes: 5 additions & 17 deletions cf/auxiliarycoordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AuxiliaryCoordinate(mixin.Coordinate,
The auxiliary coordinate construct consists of a data array of the
coordinate values which spans a subset of the domain axis
constructs, an optional array of cell bounds recording the extents
of each cell (stored in a `cf.Bounds` object), and properties to
of each cell (stored in a `Bounds` object), and properties to
describe the coordinates. An array of cell bounds spans the same
domain axes as its coordinate array, with the addition of an extra
dimension whose size is that of the number of vertices of each
Expand All @@ -38,6 +38,10 @@ class AuxiliaryCoordinate(mixin.Coordinate,
`nc_set_variable`, `nc_get_variable`, `nc_del_variable` and
`nc_has_variable` methods.

The netCDF variable group structure may be accessed with the
`nc_set_variable`, `nc_get_variable`, `nc_variable_groups`,
`nc_clear_variable_groups` and `nc_set_variable_groups` methods.

'''
def __repr__(self):
'''Called by the `repr` built-in function.
Expand All @@ -47,20 +51,4 @@ def __repr__(self):
'''
return super().__repr__().replace('<', '<CF ', 1)

@property
def isauxiliary(self):
'''True, denoting that the variable is a aucilliary coordinate object.

.. seealso::`isdimension`, `isdomainancillary`,
`isfieldancillary`, `ismeasure`

**Examples:**

>>> c = cf.AuxiliaryCoordinate()
>>> c.isauxiliary
True

'''
return True

# --- End: class
15 changes: 0 additions & 15 deletions cf/cellmeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@ def __repr__(self):
# ----------------------------------------------------------------
# Attributes
# ----------------------------------------------------------------
@property
def ismeasure(self):
'''Always True.

.. seealso:: `isauxiliary`, `isdimension`

**Examples:**

>>> c = cf.CellMeasure()
>>> c.ismeasure
True

'''
return True

@property
def measure(self):
'''TODO
Expand Down
50 changes: 29 additions & 21 deletions cf/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11042,21 +11042,36 @@ def halo(self, size, axes=None, tripolar=None,

@_inplace_enabled(default=False)
def filled(self, fill_value=None, inplace=False):
'''TODO
'''Replace masked elements with the fill value.

.. versionadded:: 3.4.0

:Parameters:

fill_value: scalar, optional
TODO
The fill value. By default the fill returned by
`get_fill_value` is used, or if this is not set then the
netCDF default fill value for the data type is used (as
defined by `netCDF.fillvals`).

{{inplace: `bool`, optional}}

:Returns:

`Data` or `None`
TODO
The filled data, or `None` if the operation was in-place.

**Examples:**

TODO
>>> d = {{package}}.Data([[1, 2, 3]])
>>> print(d.filled().array)
[[1 2 3]]
>>> d[0, 0] = cfdm.masked
>>> print(d.filled().array)
[-9223372036854775806 2 3]
>>> d.set_fill_value(-99)
>>> print(d.filled().array)
[[-99 2 3]]

'''
d = _inplace_enabled_define_and_cleanup(self)
Expand All @@ -11070,7 +11085,10 @@ def filled(self, fill_value=None, inplace=False):
fill_value = default_netCDF_fillvals().get('S1', None)

if fill_value is None: # should not be None by this stage
raise ValueError("TODO {}".format(d.dtype.str))
raise ValueError(
"Can't determine fill value for "
"data type {!r}".format(d.dtype.str)
)
# --- End: if

hardmask = d.hardmask
Expand Down Expand Up @@ -14436,9 +14454,7 @@ def variance(
# ----------------------------------------------------------------
@property
def Data(self):
'''The data array object as an object identity.

Deprecated at version 3.0.0. Use attribute 'data' instead.
'''Deprecated at version 3.0.0, use attribute `data` instead.

'''
_DEPRECATION_ERROR_ATTRIBUTE(
Expand All @@ -14447,28 +14463,23 @@ def Data(self):

@property
def dtvarray(self):
'''A numpy array view the data array converted to date-time objects.
'''Deprecated at version 3.0.0.

Deprecated at version 3.0.0.
'''
_DEPRECATION_ERROR_ATTRIBUTE(self, 'dtvarray') # pragma: no cover

def files(self):
'''Return the names of files containing parts of the data array.

Deprecated at version 3.4.0. Use method 'get_filenames' instead.
'''Deprecated at version 3.4.0, use method `get_filenames` instead.

'''
_DEPRECATION_ERROR_METHOD(
self, 'files', "Use method 'get_filenames' instead.",
self, 'files', "Use method `get_filenames` instead.",
version='3.4.0'
) # pragma: no cover

@property
def unsafe_array(self):
'''A numpy array of the data.

Deprecated at version 3.0.0. Use 'array' attribute instead.
'''Deprecated at version 3.0.0, use `array` attribute instead.

'''
_DEPRECATION_ERROR_ATTRIBUTE(
Expand All @@ -14477,10 +14488,7 @@ def unsafe_array(self):
) # pragma: no cover

def expand_dims(self, position=0, i=False):
'''Expand the shape of the data array in place.

Deprecated at version 3.0.0. Use method 'insert_dimension'
instead.
'''Deprecated at version 3.0.0, use method `insert_dimension` instead.

'''
_DEPRECATION_ERROR_METHOD(
Expand Down
24 changes: 6 additions & 18 deletions cf/dimensioncoordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DimensionCoordinate(mixin.Coordinate,
The dimension coordinate construct consists of a data array of the
coordinate values which spans a subset of the domain axis
constructs, an optional array of cell bounds recording the extents
of each cell (stored in a `cf.Bounds` object), and properties to
of each cell (stored in a `Bounds` object), and properties to
describe the coordinates. An array of cell bounds spans the same
domain axes as its coordinate array, with the addition of an extra
dimension whose size is that of the number of vertices of each
Expand All @@ -56,6 +56,10 @@ class DimensionCoordinate(mixin.Coordinate,
`nc_set_variable`, `nc_get_variable`, `nc_del_variable` and
`nc_has_variable` methods.

The netCDF variable group structure may be accessed with the
`nc_set_variable`, `nc_get_variable`, `nc_variable_groups`,
`nc_clear_variable_groups` and `nc_set_variable_groups` methods.

'''
def __repr__(self):
'''Called by the `repr` built-in function.
Expand Down Expand Up @@ -231,22 +235,6 @@ def increasing(self):
'''
return self.direction()

@property
def isdimension(self):
'''True, denoting that the variable is a dimension coordinate object.

.. seealso::`isauxiliary`, `isdomainancillary`, `isfieldancillary`,
`ismeasure`

**Examples:**

>>> c = cf.DimensionCoordinate()
>>> c.isdimension
True

'''
return True

# @property
# def lower_bounds(self):
# '''The lower dimension coordinate bounds in a `cf.Data` object.
Expand Down Expand Up @@ -853,7 +841,7 @@ def roll(self, axis, shift, inplace=False, i=False):
# ----------------------------------------------------------------
@property
def role(self):
'''Deprecated at version 3.0.0. Use attribute 'construct_type'
'''Deprecated at version 3.0.0, use `construct_type` attribute
instead.

'''
Expand Down
16 changes: 0 additions & 16 deletions cf/domainancillary.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,4 @@ def __repr__(self):
'''
return super().__repr__().replace('<', '<CF ', 1)

@property
def isdomainancillary(self):
'''True, denoting that the variable is a domain ancillary object.

.. versionadded:: 2.0

**Examples:**

>>>f = cf.DomainAncillary()
>>> f.isdomainancillary
True

'''
return True


# --- End: class
7 changes: 5 additions & 2 deletions cf/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -11844,7 +11844,10 @@ def _group_weights(weights, iaxis, index):
# --------------------------------------------------------
# Sort the list of collapsed fields
# --------------------------------------------------------
if coord is not None and coord.isdimension:
if (
coord is not None
and coord.construct_type == 'dimension_coordinate'
):
fl.sort(
key=lambda g: g.dimension_coordinates.filter_by_axis(
'exact', axis).value().datum(0),
Expand Down Expand Up @@ -12438,7 +12441,7 @@ def indices(self, *mode, **kwargs):
elif (item is not None
and isinstance(value, Query)
and value.operator in ('wi', 'wo')
and item.isdimension
and item.construct_type == 'dimension_coordinate'
and self.iscyclic(axis)):
# self.iscyclic(sorted_axes)):
# ------------------------------------------------
Expand Down
15 changes: 0 additions & 15 deletions cf/fieldancillary.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,5 @@ def __repr__(self):
'''
return super().__repr__().replace('<', '<CF ', 1)

@property
def isfieldancillary(self):
'''True, denoting that the variable is a field ancillary object.

.. versionadded:: 2.0

**Examples:**

>>> f = cf.FieldAncillary()
>>> f.isfieldancillary
True

'''
return True


# --- End: class
16 changes: 4 additions & 12 deletions cf/mixin/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,39 +1125,31 @@ def match(self, *identities, **kwargs):
# Deprecated attributes and methods
# ----------------------------------------------------------------
def setprop(self, *args, **kwargs):
'''Delete a CF property.

Deprecated at version 3.0.0. Use method 'set_property' instead.
'''Deprecated at version 3.0.0, use method `set_property` instead.

'''
_DEPRECATION_ERROR_METHOD(
self, 'setprop', "Use method 'set_property' instead"
) # pragma: no cover

def delprop(self, prop):
'''Delete a CF property.

Deprecated at version 3.0.0. Use method 'del_property' instead.
'''Deprecated at version 3.0.0, use method `del_property` instead.

'''
_DEPRECATION_ERROR_METHOD(
self, 'delprop', "Use method 'del_property' instead"
) # pragma: no cover

def hasprop(self, prop):
'''Whether a property has been set.

Deprecated at version 3.0.0. Use method 'has_property' instead.
'''Deprecated at version 3.0.0, use method `has_property` instead.

'''
_DEPRECATION_ERROR_METHOD(
self, 'hasprop', "Use method 'has_property' instead"
) # pragma: no cover

def getprop(self, prop):
'''Get a property.

Deprecated at version 3.0.0. Use method 'get_property' instead.
'''Deprecated at version 3.0.0, use method `get_property` instead.

'''
_DEPRECATION_ERROR_METHOD(
Expand Down
Loading