Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

_map_title crashes for orthographic maps with UnboundLocalError: xpt

Aperta
#122 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia individuando _map_title e riproduci il ortho contour plot minimo con un titolo non vuoto usando le impostazioni predefinite indicate. Traccia il modo in cui xpt e ypt vengono assegnati per ogni proiezione, quindi verifica che i grafici ortografici vengano renderizzati con titoli senza generare un UnboundLocalError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

This actually occurs for other plot types as well.

Version: cfplot 3.4.0; python 3.12

Observed behavior:

  • Orthographic contour plot crashes when cf-plot tries to render the map title
  • If the title is removed, the plot renders successfully

Expected behavior:

  • Orthographic contour plots should render with a title
  • At minimum, _map_title should not crash if a projection-specific title anchor has not been computed

Minimal failing scenario:

  • Projection: ortho
  • Default GUI-style settings:
    • [lat_0 = 0.0]
    • [lon_0 = 0.0
    • Render a contour plot with a non-empty title

Probable root cause:
_map_title() appears to compute xpt, ypt only for some projections, then unconditionally uses them in the non-dims branch.

From the installed 3.4.0 source, the title-anchor coordinates are assigned for cases such as:

  • npstere
  • spstere
  • lcc

but later the code does:

else:
    halign = "center"
    plotvars.mymap.text(
        xpt,
        ypt,
        title,
        ...
    )

For ortho, xpt/ypt do not appear to be initialized before this branch is reached.

Lingua principale
Python
Stelle
21
Fork
11
Merge medio
7h 11m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NCAS-CMS/cf-plot

Tutte le issue di NCAS-CMS/cf-plot

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.