NCAS-CMS / NCAS-CMS/cf-plot

Distortion and weird artefacts using polar stereographic projection

Open
#55 0 comments 0 reactions 1 assignee View on GitHub

@sadielbartholomew is already working on this.

Since Jul 11, 2024.

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

Description

A user has notified us that contour plots using the south polar stereographic projection (proj="spstere") are distorted in that they are not showing the data correctly, for example in shape and with weird line artefacts appearing in the data displayed across the plots, too - see the example below. They have evidenced that using Python 2 and our final Python 2 version of cf-plot, 2.4.10, everything looks as it should, so something at least has broken either during the migration 2->3 or since then, in this respect.

Though I have only observed this for the south polar case, given the symmetry in the code between these, I suspect the north polar case will suffer from these issues also, but I am yet to test this.

Example

Minimal reproducer
f = cf.read("<filename in question>.nc")
g = f[0][:,0,:,:].squeeze()

cfp.con(g, lines=False)  # see A output

cfp.mapset(proj='spstere', boundinglat=-60)
cfp.con(g, lines=False)  # see B output

cfp.mapset(proj='spstere')
cfp.con(g, lines=False)  # see C output
A, looks as it should

cfplot_a003

B, some flecks on the data

cfplot_a002

C, flecks as above plus line artefacts

cfplot_a001

User images

Some further plots with code similar to the above showing the distortion in shape (note these aren't directly comparable i.e. showing the exact same thing, since the Python 2 case is - going from the title of the plot - from a seasonal mean of the same data):

Working case (Python 2, cf-plot 2.4.10 and cf-python 2.3.2)

b_era

Broken case (Python 3, cf-plot 3.3.0 and cf-python 3.13.1)

a_era

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.