Skip to content

Commit a0cf155

Browse files
committed
Further fixes and tweaks.
1 parent 3d6430a commit a0cf155

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

docs/userdocs/user_guide/common_operations.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,17 @@ Equality Testing
125125
----------------
126126
We implement equality operations ``==`` / ``!=`` for all the core data objects.
127127

128-
However, simple equality testing on :class:`@ncdata.NcData` and :class:`@ncdata.NcVariable`
129-
objects can be very costly if it requires comparing large data arrays.
128+
.. warning::
129+
The equality testing actually calls the :func:`ncdata.utils.dataset_differences` and
130+
:func:`ncdata.utils.variable_differences` utility functions.
131+
132+
This can be very costly if it needs to compare large data arrays.
130133

131-
If you need to avoid comparing large (and possibly lazy) arrays then you can use the
134+
If you need to avoid comparing large (and possibly lazy) arrays then you should use the
132135
:func:`ncdata.utils.dataset_differences` and
133-
:func:`ncdata.utils.variable_differences` utility functions.
134-
These functions also provide multiple options to enable more tolerant comparison,
135-
such as allowing variables to have a different ordering.
136+
:func:`ncdata.utils.variable_differences` utility functions directly.
137+
These enable you to use the provided tolerance options, such as ignoring differences in
138+
data content, or accepting that attributes are present in a different order.
136139

137140
See: :ref:`utils_equality`
138141

docs/userdocs/user_guide/howtos.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ You can also slice data directly, which simply acts on the dimensions in order:
413413
>>> data_region_2 == data_region
414414
True
415415

416-
See: :ref:`indexing_overview`
416+
See: :ref:`utils_indexing`
417417

418418

419419
Read data from a NetCDF file

docs/userdocs/user_guide/utilities.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ The functions :func:`~ncdata.utils.dataset_differences` and
2020
:func:`~ncdata.utils.variable_differences` produce a list of messages detailing all the
2121
ways in which two datasets are different.
2222

23-
See: :ref:`equality_checks`
24-
2523
For Example:
2624
^^^^^^^^^^^^
2725
.. testsetup::
@@ -58,13 +56,16 @@ For Example:
5856
:func:`~ncdata.utils.variable_differences` is also provided.
5957

6058
.. note::
61-
The ``==`` and ``!-`` operations on :class:`ncdata.NcData` and
62-
:class:`ncdata.NcVariable` are implemented to call these utility functions.
63-
However, lacking a keyword interface to enable any tolerance options, the operations
64-
compare absolutely everything, and so can be very performance intensive if large data
65-
arrays are present.
59+
The ``==`` and ``!=`` operations on :class:`ncdata.NcData` and
60+
:class:`ncdata.NcVariable` simply call these utility functions to see if there are
61+
any differences.
62+
63+
.. warning::
64+
As they lack a keyword interface, these operations have no tolerance options
65+
and check absolutely everything. This includes full data-array comparisons,
66+
which could be very costly in time or space if data arrays are large.
6667

67-
.. _indexing_overview:
68+
.. _utils_indexing:
6869

6970
Sub-indexing
7071
------------

lib/ncdata/utils/_compare_nc_datasets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def dataset_differences(
3838
:class:`~ncdata.NcData` objects.
3939
File paths are opened with the :mod:`netCDF4` module.
4040
41-
See: :ref:`equality_checks`
41+
See: :ref:`equality_testing`
4242
4343
Parameters
4444
----------
@@ -328,7 +328,7 @@ def variable_differences(
328328
r"""
329329
Compare variables.
330330
331-
See: :ref:`equality_checks`
331+
See: :ref:`equality_testing`
332332
333333
Parameters
334334
----------

lib/ncdata/utils/_copy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,23 @@ def ncdata_copy(ncdata: NcData) -> NcData:
3232
Notes
3333
-----
3434
This operation is now also available as an object method:
35-
:meth:`~ncdata.NcData.copy`. For example:
35+
:meth:`~ncdata.NcData.copy`.
3636
3737
Syntactically, this is generally more convenient, but the operation is identical.
38+
3839
For example:
3940
4041
.. testsetup::
4142
4243
>>> from ncdata import NcData
43-
>>> from ncdata.utils import dataset_differences, ncdata_copy
44+
>>> from ncdata.utils import ncdata_copy
4445
>>> data = NcData()
4546
4647
.. doctest::
4748
4849
>>> data1 = ncdata_copy(data)
4950
>>> data2 = data.copy()
50-
>>> dataset_differences(data1, data2) == []
51+
>>> data1 == data2
5152
True
5253
5354
"""

0 commit comments

Comments
 (0)