AttributeError: 'GridHolder' object has no attribute 'bilinear' during make_bry.py with pyinterp

Hello CROCO Community,

I am running into an error while attempting to generate boundary files (make_bry.py) using the Python preprocessing tools (pytools_X) for a Bay of Bengal setup.

The script crashes during the horizontal interpolation of sea surface height (ssh) from GLORYS data, specifically throwing an AttributeError related to the pyinterp backend.

Environment Details:

  • Python Version: 3.11

  • Input Data: GLORYS Mercator data

  • Boundary being processed: South

Error Traceback:

Plaintext

  Interpolate ssh
Traceback (most recent call last):
  File "make_bry.py", line 54, in <module>
    main()
  File "make_bry.py", line 50, in main
    croco.create_bry()
  File "Modules/croco_class.py", line 289, in create_bry
    self.bry = create_bry(self.config)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "Modules/ibc_tools.py", line 368, in create_bry
    crocovars, extrapolators = compute_ibc_core(
                               ^^^^^^^^^^^^^^^^^
  File "Modules/ibc_tools.py", line 488, in compute_ibc_core
    zeta, extrapolator_zeta = interp_horiz(
                              ^^^^^^^^^^^^^
  File "Modules/interp_tools.py", line 102, in interp_horiz
    tmpvar = val_interpolator.bilinear(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/pyinterp/backends/xarray.py", line 318, in __getattr__
    return getattr(self._instance, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'GridHolder' object has no attribute 'bilinear'

Relevant Code Block (interp_tools.py around line 102):

Python

# Perform pyinterp bicubic interpolation on CROCO grid
val_interpolator = pyxr.Grid2D(data_array)
tmpvar = val_interpolator.bilinear(
    coords=dict(lon=crocogrd.lon.ravel(), lat=crocogrd.lat.ravel()),
    num_threads=1,
).reshape(crocogrd.lon.shape)

Questions:

  1. Is this a known incompatibility between recent versions of the pyinterp library (which seem to have deprecated or renamed .bilinear()) and the current pytools_X code?

  2. What is the recommended or stable version of pyinterp required for CROCO Python preprocessing?

  3. Should I manually patch interp_tools.py to use .bivariate() instead of .bilinear(), Or is there a standard environment file I should use to downgrade conflicting packages?

Any guidance or workarounds would be greatly appreciated!

Thank you, Asish

Asish,
what problem have you faced? Is it for good ? .py
I will see that problem.
in simple language. OK.
Best regards,

Whenever I try to run make_bry.py, I get the following error:


AttributeError: 'GridHolder' object has no attribute 'bilinear'

As a workaround, I modified the code from:


tmpvar = val_interpolator.bilinear(...)

to:


tmpvar = val_interpolator.bivariate(...)

This allows the script to run, but I am not confident that the interpolation is being performed correctly. I am also unsure why the original error is being raised. Could this be due to a deprecated package, a version mismatch, or a change in the underlying library API?

I would appreciate any guidance on whether bivariate() is an appropriate replacement for bilinear() and how I can verify that the interpolation results are correct.

ok make_bry.py have problem. I will check it ok. don’t worry . there also bry from gcm. that also?
Thanks.

Hello @AsishKsasidharan , it seems the pb you describes can be related to CROCO_PYTOOLS - update of pyinterp feb 2026

Which version of pyinterp and croco_pytools are you using ?

2 Likes

I am currently using CROCO_PYTOOLS Release 2.0.0. Since the issue persisted, I also tested Release 2.0.4, but encountered the same error.

I tried both the bicubic() and bilinear() interpolation methods, and both resulted in the same issue. Following the recommendation to use an earlier version of pyinterp where the previous bicubic() behavior is still available (e.g., pyinterp <= 2025.11.0), I downgraded accordingly. However, this did not resolve the problem, and the same error persisted.

As a workaround, I switched to bivariate(), which allowed the code to run successfully. However, I am uncertain whether the interpolation is being performed correctly and whether the resulting fields are scientifically reliable.