matplotlib / matplotlib/basemap
llcrnrlon vs llcrnrx [-180, 180 vs 0, 360]
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 817
- Fork
- 395
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I was playing with the projections and it took me a while to understand what's going on... I need the 'rotpole' projection to convert some locations and plot some graphs. I have all the information: lon_0 = 10, o_lon_p = 10, o_lat_p = 10, but I don't have the real lat/lon, I have the rotated one so I'm forced to use llcrnrx, llcrnry....
I have a climate model that gives me the output in this rotated pole projection with rotated left lon = -19.5, rotated right lon = 21, rotated bottom lat = -25, rotated top lat = 20.5.
First take:
import mpl_toolkits.basemap as mb
kwargs = {
'projection': 'rotpole',
'llcrnrx': -19.5,
'llcrnry': -25,
'urcrnrx': 21,
'urcrnry': 20.5,
'o_lon_p': 10,
'o_lat_p': 32.5,
'lat_0': 10
}
m = mb.Basemap(**kwargs)
Now m.drawcoastlines() will give me a huge map that goes backwards on X axis... After a full day of investigation... I saw that m.llcrnrx' takes the value of360-19.5 = 340.5andm.urcrnrx = 21` so this clearly dosn't work...

Is this behaviour wanted? I mean, when building m = mb.Basemap(...) using llcrnrlon, llcrnrlat... you can safely pass negative values to llcrnrlon but when using llcrnrx you're forced to use (0, 360)...
Working version is:
import mpl_toolkits.basemap as mb
kwargs = {
'projection': 'rotpole',
'llcrnrx': 0,
'llcrnry': -25,
'urcrnrx': 21,
'urcrnry': 40.5,
'o_lon_p': 10,
'o_lat_p': 32.5,
'lat_0': -9.5
}
m = mb.Basemap(**kwargs)
So now I'm forced to do:
# x, y taken from climate model
xoffset = 19.5
lon, lat = m([x + xoffset], [y], inverse=True)
Even more confusing is the fact that you can use negative values in convert as in m(-1, 0, inverse=True) and you get the correct negative real longitude value...
Edit: using version 1.0.7; fixed 'urcrnry' misspell
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Direzione di ricerca
Inizia riproducendo gli esempi forniti del costruttore Basemap e della conversione inversa con le coordinate del polo ruotato segnalate. Esamina come il punto di ingresso di Basemap gestisce gli intervalli llcrnrx e urcrnrx, quindi determina il comportamento previsto delle coordinate e aggiungi la copertura per il caso di longitudine ruotata negativa. L’attività è completata quando l’intervallo di coordinate documentato e l’orientamento risultante della mappa sono coerenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100