Open DougBurke opened 1 year ago
Aha: we have, for BinaryOpModel
:
def regrid(self, *args, **kwargs):
for part in self.parts:
# ArithmeticConstantModel does not support regrid by design
if not hasattr(part, 'regrid'):
continue
# The full model expression must be used
return part.__class__.regrid(self, *args, **kwargs)
raise ModelErr('Neither component supports regrid method')
Unfortunately, if one of the parts is also a BinaryOpModel
- such as the case of Const1D() * Const1D() * Const1D()
, which has
>>> mdl.parts
(<BinaryOpModel model instance '(const1d + const1d)'>, <Const1D model instance 'const1d'>)
then part.__class__
is BinnaryOpModel
, which leads to the recursion. This was added by Dan in #919 based on exploratory work I'd done. So I need to do some thinking.
With CIAO 4.15 we have
Where is this recursion coming from? I have also see a similar issue when dealing with the
integrate
flag (when trying to get it to be supported for *OpModel classes).If I try with python 3.11 / latest main I get the following:
I can get a slightly-different error if I try the less-well-used division operator
but note that I can say:
Hmm, it's not due to
ArithmeticConstantModel
- which is used to represent numeric terms like1
in the above, since this also fails