Skip to content

Commit

Permalink
Update scipy.integrate.simps import (#3704)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehogan authored Jul 2, 2024
1 parent baa3400 commit bc25f87
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion esmvaltool/diag_scripts/emergent_constraints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy
import seaborn as sns
import yaml
from packaging.version import Version
from scipy import integrate
from scipy.stats import linregress
if Version(scipy.version.version) < Version('1.14.0'):
from scipy.integrate import simps as simpson
else:
from scipy.integrate import simpson

from esmvaltool.diag_scripts.shared import (
ProvenanceLogger,
Expand Down Expand Up @@ -1673,7 +1679,7 @@ def cdf(data, pdf):
"""
idx_range = range(1, len(data) + 1)
cum_dens = [integrate.simps(pdf[:idx], data[:idx]) for idx in idx_range]
cum_dens = [simpson(pdf[:idx], x=data[:idx]) for idx in idx_range]
return np.array(cum_dens)


Expand Down

0 comments on commit bc25f87

Please sign in to comment.