iMOD Forum

Error using imod.prepare.laplace_interpolate in imod-python

Kristina Gumgowski, modified 3 Years ago.

Error using imod.prepare.laplace_interpolate in imod-python

Youngling Posts: 13 Join Date: 3/18/21 Recent Posts
Hiii,

I am trying to use the laplace-interpolation function but run into the following error. I am sorry for this long message, I guessed all of it is relevant though. My input is the follwing, the grid resolution is 100 m:

idf_laplace = im.prepare.laplace_interpolate(xr_idf, xr_mask, close= 1, mxiter= 5, iter1=50, relax=0.98)

Did anyone have a similar problem before? Did I use the wrong values for the paramters "close", "mxiter", "iter1" and "relax" ? Or is maybe my idf not suited for this kind of interpolation?

Kind regards,
Kristina

Traceback (most recent call last):
  File "C:/Users/Kristina/PycharmProjects/imod-2/main.py", line 24, in <module>
    idf_laplace = im.prepare.laplace_interpolate(xr_idf, xr_mask, close= 1, mxiter= 5, iter1= 50, relax=0.98)
  File "C:\Users\Kristina\anaconda3\envs\imod-2\lib\site-packages\imod\prepare\spatial.py", line 165, in laplace_interpolate
    converged = solver.solve(
  File "C:\Users\Kristina\anaconda3\envs\imod-2\lib\site-packages\imod\prepare\pcg.py", line 153, in solve
    hnew, res, bigh, bigr, indices_bigh, indices_bigr = calculate_heads(
  File "C:\Users\Kristina\anaconda3\envs\imod-2\lib\site-packages\numba\core\dispatcher.py", line 420, in _compile_for_args
    error_rewrite(e, 'typing')
  File "C:\Users\Kristina\anaconda3\envs\imod-2\lib\site-packages\numba\core\dispatcher.py", line 361, in error_rewrite
    raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function setitem>) found for signature:
 
 >>> setitem(readonly array(float64, 1d, C), int64, float64)
 
There are 16 candidate implementations:
     - Of which 14 did not match due to:
     Overload of function 'setitem': File: <numerous>: Line N/A.
       With argument(s): '(readonly array(float64, 1d, C), int64, float64)':
      No match.
     - Of which 2 did not match due to:
     Overload in function 'SetItemBuffer.generic': File: numba\core\typing\arraydecl.py: Line 171.
       With argument(s): '(readonly array(float64, 1d, C), int64, float64)':
      Rejected as the implementation raised a specific error:
        TypeError: Cannot modify value of type readonly array(float64, 1d, C)
  raised from C:\Users\Kristina\anaconda3\envs\imod-2\lib\site-packages\numba\core\typing\arraydecl.py:177

During: typing of setitem at C:\Users\Kristina\anaconda3\envs\imod-2\lib\site-packages\imod\prepare\pcg.py (648)

File "..\..\..\..\anaconda3\envs\imod-2\lib\site-packages\imod\prepare\pcg.py", line 648:
def calculate_heads(ibound, nlay, nrow, ncol, nrc, alpha, p, bigh, bigr, hnew, res, v):
    <source elided>
                    kh = k
                hnew[n] = hnew[n] + hchgn
                ^
Huite Bootsma, modified 3 Years ago.

RE: Error using imod.prepare.laplace_interpolate in imod-python

Youngling Posts: 3 Join Date: 5/28/21 Recent Posts
Hi Kristina,

This seems like a bug to me, so I've copied your description to the imod-python issues board:
https://gitlab.com/deltares/imod/imod-python/-/issues/179

I'll write some further replies there, for easier bookkeeping.

It's an open board but it does require a gitlab account to reply. (That should be easier than making an account for this forum however, ^^)