Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scipy.misc.derivative is deprecated #1644

Closed
kandersolar opened this issue Jan 24, 2023 · 3 comments · Fixed by #1674
Closed

scipy.misc.derivative is deprecated #1644

kandersolar opened this issue Jan 24, 2023 · 3 comments · Fixed by #1674
Milestone

Comments

@kandersolar
Copy link
Member

scipy v1.10.0 (released Jan 3, 2023) has deprecated scipy.misc.derivative, a function used by pvlib.ivtools.sdm.pvsyst_temperature_coeff. The deprecation notice mentions some alternatives (although I'm not confident a new dependency is warranted in our case):

pvlib/ivtools/sdm.py:1347: DeprecationWarning: scipy.misc.derivative is deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. You may consider using findiff: https://github.com/maroba/findiff or numdifftools: https://github.com/pbrod/numdifftools

Noticed in this CI run: https://github.com/pvlib/pvlib-python/actions/runs/3992734328/jobs/6848836375#step:9:130

@cwhanse
Copy link
Member

cwhanse commented Jan 24, 2023

I noticed that too, in other work. scipy is not going to provide any numeric differentiation tools. If we keep the pvsyst_temperature_coeff function (I vote yes), and are considering a new dependency, I vote against either autograd or its successor, JAX; they are awkward since they wrap numpy. My preference would be to code our own calculation using a finite difference formula.

@mikofski
Copy link
Member

Maybe check statsmodels I seem to recall that it has a simple derivative function, but I can't find it quickly now so maybe I was mistaken?

@adriesse
Copy link
Member

adriesse commented Jan 26, 2023

+1 for explicit finite difference calculation. I would go so far as to say such a simple calculation should not have been outsourced to a general-purpose function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants