# Interpolation using lookup table

**URL:** <https://pybamm.discourse.group/t/interpolation-using-lookup-table/414>\
**Category:** General\
**Created:** [14 November 2025 10:22 UTC](https://pybamm.discourse.group/t/interpolation-using-lookup-table/414 "2025-11-14T10:22:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex.0249](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@alex.0249](https://pybamm.discourse.group/u/alex.0249)\
**Post date:** [14 November 2025 10:22 UTC](https://pybamm.discourse.group/t/interpolation-using-lookup-table/414/1 "2025-11-14T10:22:51Z")

</div>

Hi,

I am trying to develop an function parameter that uses a lookup table of x,y,z to interpolate so that for any x,y value it can output a single z value. However, I get the error: 65 x1, x2 = x  
66 if y.ndim != 2:

—\> 67 raise ValueError(“y should be two-dimensional if len(x)=2”)  
68 if x1.shape[0] != y.shape[0]:  
69 raise ValueError(  
70 “len(x1) should equal y=shape[1], "  
71 f"but x1.shape={x1.shape} and y.shape={y.shape}”  
72 )

ValueError: y should be two-dimensional if len(x)=2

for the interpolant:

`D_charge = pybamm.Interpolant(`  
`(i_area_char, conc_xno_char),`  
`D_char,`  
`(i_area, conc_xno)`  
`)`

Why has this happened and would anyone have any suggestions to fix?

Thanks!
