Skip to content

Commit 2ca3e2c

Browse files
committed
allow no-arg init
1 parent ee57d6e commit 2ca3e2c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cf/regrid/regridoperator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class RegridOperator(mixin_Container, Container):
2121

2222
def __init__(
2323
self,
24-
weights,
25-
row,
26-
col,
24+
weights=None,
25+
row=None,
26+
col=None,
2727
coord_sys=None,
2828
method=None,
2929
src_shape=None,
@@ -117,6 +117,10 @@ def __init__(
117117
118118
"""
119119
super().__init__()
120+
121+
if weights is None or row is None or col is None:
122+
# This to allow a no-arg init!
123+
return
120124

121125
self._set_component("weights", weights, copy=False)
122126
self._set_component("row", row, copy=False)
@@ -137,6 +141,7 @@ def __init__(
137141
self._set_component("dst", dst, copy=False)
138142

139143
def __repr__(self):
144+
"""x.__repr__() <==> repr(x)"""
140145
return (
141146
f"<CF {self.__class__.__name__}: {self.coord_sys} {self.method}>"
142147
)

0 commit comments

Comments
 (0)