Skip to content

FIX: restrict scipy to >=1.17 and update Legendre code#436

Merged
carleyjmartin merged 1 commit into
developfrom
fix/scipy-restriction
Mar 17, 2026
Merged

FIX: restrict scipy to >=1.17 and update Legendre code#436
carleyjmartin merged 1 commit into
developfrom
fix/scipy-restriction

Conversation

@carleyjmartin
Copy link
Copy Markdown
Collaborator

Scope

This PR updates the pyDARN code to use the new version of the scipy.special Legendre function 'assoc_legendre_p_all' instead of the old deprecated 'lpmn' function that was replaced in version 1.15.0, but was broken for a while and is now fixed in the latest 1.17 version of scipy.
The outputs for the new legendre functions are very different, so to reduce the changes in the code I have reworked the new output to be as similar to the old one as possible.

I tested the new code with scipy 1.15-1.16.3 but I got the issue we had before, so we would need to restrict up to 1.17 for this to work.

With the new code change, it doesn't make sense to keep the old code and if/else it as we still need to have a <1.15 >=1.17 statement anyway, where <1.15 is now 2.5+ years old anyway.

issue: to close #434

Approval

Number of approvals: 2 for testing please

Test

matplotlib version: 3.10.8
python version: 3.11
Note testers: please indicate what version of matplotlib you are using

import pydarn
import matplotlib.pyplot as plt

date_file = '/home/carleyjm/data/map/20251001.n.map'
map_data,_ = pydarn.read_map(date_file)

plt.figure(figsize=(10,10))
pydarn.Maps.plot_mapdata(map_data, record=3, contour_fill = True, color_vectors=False, coastline=True)
plt.show()

Comparison between old code and scipy 1.14.0 and new code and 1.17.0:
OLD:
scipy1-14

NEW:
scipy1-17

image

@alexchartier
Copy link
Copy Markdown
Collaborator

Looks good to me

@carleyjmartin carleyjmartin merged commit e461037 into develop Mar 17, 2026
2 checks passed
@carleyjmartin carleyjmartin deleted the fix/scipy-restriction branch March 17, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FIX fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG/TODO: Scipy v1.17.0

3 participants