[Bug]: Basemap drawgreatcircle generating gaps in Mercator projection
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- matplotlib, numpy, python
- Ambito
- data-visualization
Direzione di ricerca
Inizia in init.py, attorno alla logica di path-cut di drawgreatcircle vicino al calcolo di max_dist, quindi esegui la riproduzione in Python con la proiezione di Mercator. Analizza perché la soglia di distanza attuale crea delle interruzioni alle alte latitudini; il lavoro è completato quando i due percorsi di cerchio massimo vengono renderizzati continuamente senza introdurre connessioni wraparound errate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug summary
I see an issue where drawgreatcircle() produces paths with gaps in with the Mercator projection.
I can see from web searches that others have seen the same issue and suggestions point to gathering the path using computations with other projections.
Code for reproduction
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# setup mercator map projection.
m = Basemap(llcrnrlon=-180.,llcrnrlat=-65.,\
urcrnrlon=180.,urcrnrlat=85.,\
projection='merc',\
lat_0=40.,lon_0=-20.,lat_ts=20.)
m.drawcoastlines()
m.fillcontinents()
# AMS
amslat = np.float64(52.309)
amslon = np.float64(4.764)
# Seattle
sealat = np.float64(47.449)
sealon = np.float64(-122.309)
# Helsinki
hellat = np.float64(60.320)
hellon = np.float64(24.956)
m.drawgreatcircle(amslon,amslat,sealon,sealat,linewidth=2,color='b')
m.drawgreatcircle(sealon,sealat,hellon,hellat,linewidth=2,color='b')
# draw parallels
m.drawparallels(np.arange(-60,65,20))
# draw meridians
m.drawmeridians(np.arange(-180,180,30))
plt.show()
Actual outcome
Expected outcome
Additional information
I don't understand the basemap calculations and how projections enter into it but I can recover the correct output if I change the test for cuts in the source code by making max_dist much larger...
diff -c __init*py.orig **init*py
*** __init__.py.orig Mon Aug 26 08:40:10 2024
--- __init__.py Mon Aug 26 09:28:34 2024
***************
*** 2901,2907 ****
p = _p[0].get_path()
# since we know the difference between any two points, we can use this to find wrap arounds on the plot
! max_dist = 1000*del_s*2
# calculate distances and compare with max allowable distance
dists = np.abs(np.diff(p.vertices[:,0]))
--- 2901,2907 ----
p = _p[0].get_path()
# since we know the difference between any two points, we can use this to find wrap arounds on the plot
! max_dist = 1000*del_s*5
# calculate distances and compare with max allowable distance
dists = np.abs(np.diff(p.vertices[:,0]))
This is what I did to generate the output in the expected result box.
It would be helpful if the defaults did allow great circle paths into high lattitudes.
Operating system
Windows 10
Matplotlib Version
3.8.4
Matplotlib Backend
3.8.4
Python version
3.12.2
Jupyter version
No response
Installation
conda
- Lingua principale
- Python
- Stelle
- 817
- Fork
- 395
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di matplotlib/basemap
-
small bug in drawmapscaleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
matplotlib/basemap#368 ·
-
Add numpy 2.5 compatibilityAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
matplotlib/basemap#655 ·
-
Python 3.14 wheelsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
matplotlib/basemap#652 · 2 commenti · 5 reazioni ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
matplotlib/basemap#649 · 2 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
matplotlib/basemap#646 ·
Tutte le issue di matplotlib/basemap
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-2 giorni Idoneità per principianti 70/100
-
FingerprintSplitter raises ZeroDivisionError when int(frac_train * len(dataset)) floors to zeroAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 7 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
lmstudio-ai/mlx-engine#376 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pyiron/bagofholding#166 ·