Reputation: 1
I'm looking to employ an interpolation program for a project I am working on. I am running into an issue where I get a message saying "There are 3 point arrays, but values has 1 dimensions". I am not sure I quite understand what this message means and how to fix the problem. Has anyone ever run into this issue? If so, how did you fix it? Thank you for the help in advance. Below is my current code.
# parsing array into different columns
TD_x_coordinates = [0.07471, 0.07244, 0.06797, 0.06144, 0.05303, 0.04302, 0.03170, 0.01941, 0.00654, -0.00654, -0.01941, -0.03170, -0.04302, -0.05303, -0.06144]
TD_y_coordinates = [0.00654, 0.01941, 0.03170, 0.04302, 0.05303, 0.06144, 0.06797, 0.07244, 0.07471, 0.07471, 0.07244, 0.06797, 0.06144, 0.05303, 0.04302]
TD_z_coordinates = [0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25]
TD_temperatures = [283.35688, 284.50166, 285.67291, 286.80615, 287.85108, 288.75182, 289.46763, 289.96409, 290.21392, 290.21254, 289.95449, 289.45986, 288.74365, 287.83610, 286.79140]
# importing RegularGridInterpolator from scipy packgage
from scipy.interpolate import RegularGridInterpolator
# creating interpolation function based on previous steps
interpolation_function = RegularGridInterpolator((TD_x_coordinates, TD_y_coordinates, TD_z_coordinates), TD_temperatures)
Upvotes: 0
Views: 2158
Reputation: 115
In the RegularGridInterpolator
from Scipy
the values that should be given to be interpolated should be in a grid format as mentioned here.
Essencialy if your data points has dimensions:
x.shape = (m1,);
y.shape = (m2,);
z.shape = (m3,);
#Your data should be structured as:
data.shape = (m1,m2,m3)
Upvotes: 1