Skip to content

Commit 7552ff4

Browse files
committed
dev
1 parent c9984eb commit 7552ff4

File tree

9 files changed

+15
-131
lines changed

9 files changed

+15
-131
lines changed

cf/aggregate.py

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ def __init__(
735735
return
736736

737737
# Set this domain ancillary's identity
738-
# identity = (ref_identity, term)
739-
# identity = self.domain_ancillary_has_identity_and_data(
740738
identity = self.get_identity(anc, (ref_identity, term))
741739
if identity is None:
742740
return
@@ -913,7 +911,7 @@ def __init__(
913911
}
914912
)
915913

916-
# For each cell measure's canonical units, sort the
914+
# For each domain topology's canonical axis, sort the
917915
# information by axis identities.
918916
for units, value in info_topology.items():
919917
self.domain_topology[canonical_axis] = {
@@ -968,7 +966,7 @@ def __init__(
968966
}
969967
)
970968

971-
# For each cell connectivity's canonical axisx, sort the
969+
# For each cell connectivity's canonical axis, sort the
972970
# information by cell type.
973971
for axis, value in info_connectivity.items():
974972
value.sort(key=itemgetter("connectivity"))
@@ -4454,33 +4452,6 @@ def _ok_coordinate_arrays(
44544452
)
44554453

44564454
return False
4457-
# else:
4458-
# ------------------------------------------------------------
4459-
# The aggregating axis does not have a dimension coordinate,
4460-
# but it does have at least one 1-d auxiliary coordinate.
4461-
# ------------------------------------------------------------
4462-
# Check for duplicate auxiliary coordinate values
4463-
# for i, identity in enumerate(meta[0].axis[axis]["ids"]):
4464-
# set_of_1d_aux_coord_values = set()
4465-
# number_of_1d_aux_coord_values = 0
4466-
# for m in meta:
4467-
# aux = m.axis[axis]["keys"][i]
4468-
# # Note: '.data.compute()' is faster than '.array'
4469-
# array = m.field.constructs[aux].data.compute()
4470-
# set_of_1d_aux_coord_values.update(array.tolist())
4471-
# number_of_1d_aux_coord_values += array.size
4472-
# if (
4473-
# len(set_of_1d_aux_coord_values)
4474-
# != number_of_1d_aux_coord_values
4475-
# ):
4476-
# if info:
4477-
# meta[0].message = (
4478-
# f"no {identity!r} dimension coordinates and "
4479-
# f"{identity!r} auxiliary coordinates have "
4480-
# "duplicate values"
4481-
# )
4482-
#
4483-
# return False
44844455

44854456
# ----------------------------------------------------------------
44864457
# Still here? Then the aggregating axis does not overlap between

cf/data/array/subsampledarray.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ def to_dask_array(self, chunks="auto"):
141141
# function of the tie point indices which haven't yet
142142
# been accessed. Therefore, the chunks for the
143143
# compressed dimensons need to be redefined later.
144-
# chunks = self.subarray_shapes(chunks)
145144
chunks = normalize_chunks(
146145
self.subarray_shapes(chunks),
147146
shape=self.shape,

cf/data/dask_regrid.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ def regrid(
108108
non-regrid axes become the leading dimensions.
109109
110110
*Parameter example:*
111-
``[0, 3, 2, 1]``
111+
If the regrid axes are in positions 2 and 1 for 4-d
112+
data: ``[0, 3, 2, 1]``
112113
113114
*Parameter example:*
114-
``[1, 2, 0]``
115+
If the regrid axes are in positions 0 and 3 for 4-d
116+
data: ``[1, 2, 0, 3]``
117+
118+
*Parameter example:*
119+
If the regrid axis is in position 0 for 3-d data: ``[1,
120+
2, 0]``
115121
116122
ref_src_mask: `numpy.ndarray` or `None`
117123
If a `numpy.ndarray` with shape *src_shape* then this is
@@ -292,7 +298,7 @@ def regrid(
292298
pass
293299
elif n_src_axes == 1 and n_dst_axes == 2:
294300
# The regridding operation increased the number of data axes
295-
# by 1
301+
# by 1 => modify 'axis_order' to contain the new axis.
296302
#
297303
# E.g. UGRID -> regular lat-lon could change 'axis_order' from
298304
# [0,2,1] to [0,3,1,2]
@@ -303,7 +309,7 @@ def regrid(
303309
axis_order[-1:] = range(raxis, raxis + n_dst_axes)
304310
elif n_src_axes == 2 and n_dst_axes == 1:
305311
# The regridding operation decreased the number of data axes
306-
# by 1
312+
# by 1 => modify 'axis_order' to remove the removed axis.
307313
#
308314
# E.g. regular lat-lon -> UGRID could change 'axis_order' from
309315
# [0,2,4,5,1,3] to [0,2,3,4,1], or [0,2,4,5,3,1] to

cf/data/data.py

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,7 +3757,8 @@ def _regrid(
37573757
]
37583758
dx = dx.rechunk(chunks)
37593759

3760-
# Define the regridded chunksizes
3760+
# Define the regridded chunksizes (allowing for the regridded
3761+
# data to have more/fewer axes).
37613762
regridded_chunks = [] # The 'chunks' parameter to `map_blocks`
37623763
drop_axis = [] # The 'drop_axis' parameter to `map_blocks`
37633764
new_axis = [] # The 'new_axis' parameter to `map_blocks`
@@ -5243,37 +5244,6 @@ def mask(self):
52435244

52445245
return mask_data_obj
52455246

5246-
# def vindex(self, *indices):
5247-
# """Vectorized indexing with broadcasting.
5248-
#
5249-
# This is equivalent to numpy’s advanced indexing, using arrays
5250-
# that are broadcast against each other. This allows for
5251-
# pointwise indexing.
5252-
#
5253-
# .. versionadded:: UGRIDVER
5254-
#
5255-
# .. seealso:: `__getitem__`
5256-
#
5257-
# **Examples**
5258-
#
5259-
# >>> d = cf.Data([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
5260-
# >>> print(d.vindex([0, 1, 2], [0, 1, 2]).array)
5261-
# [1 5 9]
5262-
# >>> print(d.vindex(0, [0, 0, 1]).array)
5263-
# [1 1 2]
5264-
#
5265-
# """
5266-
# new = self.copy(array=False)
5267-
# dx = self.to_dask_array()
5268-
# dx = dx.vindex[indices]
5269-
# new._set_dask(dx)
5270-
#
5271-
# if self.nc_hdf5_chunksizes() and new.shape != self.shape:
5272-
# # Delete hdf5 chunksizes when the shape has changed.
5273-
# new.nc_clear_hdf5_chunksizes()
5274-
#
5275-
# return new
5276-
52775247
@_inplace_enabled(default=False)
52785248
def arctan(self, inplace=False):
52795249
"""Take the trigonometric inverse tangent of the data element-
@@ -5322,47 +5292,6 @@ def arctan(self, inplace=False):
53225292

53235293
return d
53245294

5325-
# AT2
5326-
#
5327-
# @classmethod
5328-
# def arctan2(cls, y, x):
5329-
# '''Take the "two-argument" trigonometric inverse tangent
5330-
# element-wise for `y`/`x`.
5331-
#
5332-
# Explicitly this returns, for all corresponding elements, the angle
5333-
# between the positive `x` axis and the line to the point (`x`, `y`),
5334-
# where the signs of both `x` and `y` are taken into account to
5335-
# determine the quadrant. Such knowledge of the signs of `x` and `y`
5336-
# are lost when the quotient is input to the standard "one-argument"
5337-
# `arctan` function, such that use of `arctan` leaves the quadrant
5338-
# ambiguous. `arctan2` may therefore be preferred.
5339-
#
5340-
# Units are ignored in the calculation. The result has units of radians.
5341-
#
5342-
# .. versionadded:: 3.2.0
5343-
#
5344-
# .. seealso:: `arctan`, `tan`
5345-
#
5346-
# :Parameters:
5347-
#
5348-
# y: `Data`
5349-
# The data array to provide the numerator elements, corresponding
5350-
# to the `y` coordinates in the `arctan2` definition.
5351-
#
5352-
# x: `Data`
5353-
# The data array to provide the denominator elements,
5354-
# corresponding to the `x` coordinates in the `arctan2`
5355-
# definition.
5356-
#
5357-
# :Returns:
5358-
#
5359-
# `Data`
5360-
#
5361-
# **Examples**
5362-
#
5363-
# '''
5364-
# return cls(np.arctan2(y, x), units=_units_radians)
5365-
53665295
@_inplace_enabled(default=False)
53675296
def arctanh(self, inplace=False):
53685297
"""Take the inverse hyperbolic tangent of the data element-wise.

cf/field.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,15 +3766,6 @@ def weights(
37663766
for key, w in comp.items():
37673767
comp[key] = Weights.scale(w, scale)
37683768

3769-
# Don't do this - too much lazy doom!
3770-
# for w in comp.values():
3771-
# mn = w.min()
3772-
# if mn <= 0:
3773-
# raise ValueError(
3774-
# "All weights must be positive. "
3775-
# f"Got a weight of {mn}"
3776-
# )
3777-
37783769
if components or methods:
37793770
# --------------------------------------------------------
37803771
# Return a dictionary of component weights, which may be
@@ -13442,7 +13433,6 @@ def regrids(
1344213433
check_coordinates=check_coordinates,
1344313434
min_weight=min_weight,
1344413435
weights_file=weights_file,
13445-
verbose=verbose,
1344613436
inplace=inplace,
1344713437
)
1344813438

cf/regrid/regrid.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def regrid(
131131
weights_file=None,
132132
return_esmpy_regrid_operator=False,
133133
inplace=False,
134-
verbose=None,
135134
):
136135
"""Regrid a field to a new spherical or Cartesian grid.
137136
@@ -259,10 +258,6 @@ def regrid(
259258
260259
.. versionadded:: 3.15.2
261260
262-
{{verbose: `int` or `str` or `None`, optional}}
263-
264-
.. versionadded:: UGRIDVER
265-
266261
:Returns:
267262
268263
`Field` or `None` or `RegridOperator` or `esmpy.Regrid`

cf/test/create_test_files.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
faulthandler.enable() # to debug seg faults and timeouts
99

10-
import netCDF4
11-
1210
import cfdm
11+
import netCDF4
1312

1413
VN = cfdm.CF()
1514

cf/test/create_test_files_2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import datetime
22
import faulthandler
3-
import os
43
import unittest
54

65
import numpy as np

cf/test/test_regrid_mesh.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import atexit
21
import datetime
32
import faulthandler
43
import os
5-
import tempfile
64
import unittest
75

86
faulthandler.enable() # to debug seg faults and timeouts
@@ -11,7 +9,6 @@
119

1210
import cf
1311

14-
1512
# ESMF renamed its Python module to `esmpy` at ESMF version 8.4.0. Allow
1613
# either for now for backwards compatibility.
1714
esmpy_imported = False
@@ -65,7 +62,6 @@ def esmpy_regrid(coord_sys, method, src, dst, **kwargs):
6562
dst,
6663
method,
6764
return_esmpy_regrid_operator=True,
68-
verbose=-1,
6965
**kwargs
7066
)
7167

0 commit comments

Comments
 (0)