NCAS-CMS / NCAS-CMS/cf-plot

Country borders out of scope for polar projections w/ `axes=False`

Open
#77 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
21
Forks
11
Avg merge
7h 11m
Merged PRs (30d)
1

Description

When doing (at least) contour plotting with the projection set with mapset to either of the polar stereographic cases, "npstere" or "spstere", and axes=False set to turn off x and y axes plotting, the country borders go out-of-scope of the circular plotting area for the data appearing to be square with the same height/width as the circle diameter (see example images below), so ultimately they are unaligned with the data. Note this issue does not affect other projections (as tested), only these polar ones.

May be related to #55, which also concerns incorrect plot output with the polar stereographic projections, but doesn't look immediately similar in terms of user-facing/plot outcome issue.

MRE with environment

import cfplot as cfp
import cf

cf.environment()

f = cf.read(f"{PATH}/ggap.nc")[0]

cfp.gopen(file="mre-1.png")
cfp.mapset(proj="npstere")  # or set with "spstere" instead
cfp.con(
    f.subspace(pressure=850),
    axes=False,
)
cfp.gclose()
Outputs from MRE

With the axes=False line in, the issue occurs:

npstere

mre-1

spstere

mre-2

Working cases, for comparison

Whereas without axes=False, everything is OK:

mre-1works
mre-2works

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided minimal reproduction with cfp.mapset(proj="npstere" or "spstere") and cfp.con(..., axes=False), then compare it with axes enabled. Trace the polar projection setup and country-border rendering to identify why the borders use bounds outside the circular plotting area. Done means both polar cases align borders with the data circle while other projections remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.