Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

_map_title crashes for orthographic maps with UnboundLocalError: xpt

Đang mở
#122 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
data-visualization

Hướng nghiên cứu

Bắt đầu bằng cách xác định vị trí của _map_title và tái tạo ortho contour plot tối giản với tiêu đề không rỗng bằng các thiết lập mặc định đã nêu. Theo dõi cách xpt và ypt được gán cho từng phép chiếu, sau đó xác minh rằng các plot trực giao được render cùng tiêu đề mà không gây ra UnboundLocalError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
21
Fork
11
Merge trung bình
7 giờ 11 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NCAS-CMS/cf-plot

Tất cả issue của NCAS-CMS/cf-plot

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.