Skip to content

Commit

Permalink
Replace interp1d with numpy.interp (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
alifbe authored Jun 10, 2024
1 parent f840ec3 commit 814c869
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/subscript/welltest_dpds/welltest_dpds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import numpy as np
import pandas as pd
from resdata.summary import Summary
from scipy.interpolate import interp1d

from subscript import __version__

Expand Down Expand Up @@ -419,19 +418,7 @@ def genobs_vec(filen, vec, time):
dframe = pd.read_csv(filen, sep="\t")
obs_time = dframe["dTime"][1:None].dropna().to_numpy(dtype=float)

gen_data = np.zeros(len(obs_time))

interp = interp1d(time, vec)

for idx, timepoint in enumerate(obs_time):
if timepoint < time[0]:
gen_data[idx] = vec[0]
elif timepoint > time[-1]:
gen_data[idx] = vec[-1]
else:
gen_data[idx] = interp(timepoint)

return gen_data
return np.interp(obs_time, time, vec)


def main():
Expand Down

0 comments on commit 814c869

Please sign in to comment.