Skip to content

Commit b0174d5

Browse files
authored
Merge pull request #29 from Chilipp/master
Add scipy and fix bug for projected data with plot=poly
2 parents 6a61376 + 520a451 commit b0174d5

6 files changed

Lines changed: 31 additions & 4 deletions

File tree

CHANGELOG.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
v1.3.1
2+
======
3+
4+
Added
5+
-----
6+
- ``scipy`` is now a run dependency of psy-maps (see
7+
`#27 <https://github.com/psyplot/psy-maps/issues/27>`__)
8+
9+
Fixed
10+
-----
11+
- fixed a bug when using ``plot="poly"`` for data on non-standard projections
12+
(i.e. anything that is not ``cartopy.crs.PlateCarree``). See
13+
`#29 <https://github.com/psyplot/psy-maps/pull/29>`__).
14+
115
v1.3.0
216
======
317
New GUI widgets and better projection support

ci/conda-recipe/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ requirements:
2222
- psyplot >1.2.1
2323
- psy-simple
2424
- cartopy
25+
- scipy # required for plotting with cartopy
2526

2627
test:
2728
imports:

psy_maps/plotters.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,8 +1719,7 @@ def _polycolor(self):
17191719
yb = yb[~mask]
17201720
self.logger.debug('Making plot with %i cells', arr.size)
17211721
transformed = proj.transform_points(
1722-
t.as_geodetic(), xb.ravel(), yb.ravel())[..., :2].reshape(
1723-
xb.shape + (2, ))
1722+
t, xb.ravel(), yb.ravel())[..., :2].reshape(xb.shape + (2,))
17241723
self._plot = PolyCollection(
17251724
transformed, array=arr.ravel(),
17261725
norm=self.bounds.norm, rasterized=True, cmap=cmap,
@@ -1817,8 +1816,7 @@ def update(self, value):
18171816
xb = xb[~mask]
18181817
yb = yb[~mask]
18191818
orig_shape = xb.shape
1820-
transformed = proj.transform_points(t.as_geodetic(), xb.ravel(),
1821-
yb.ravel())
1819+
transformed = proj.transform_points(t, xb.ravel(), yb.ravel())
18221820
xb = transformed[..., 0].reshape(orig_shape)
18231821
yb = transformed[..., 1].reshape(orig_shape)
18241822
# We insert nan values in the flattened edges arrays rather than

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def run_tests(self):
6666
'psyplot>=1.3.0',
6767
'psy-simple>=1.3.0',
6868
'cartopy',
69+
'scipy', # required for plotting with cartopy
6970
],
7071
project_urls={
7172
'Documentation': 'https://psyplot.readthedocs.io/projects/psy-maps',

tests/rotated-pole-test.nc

966 KB
Binary file not shown.

tests/test_plotters.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,5 +1735,18 @@ def _label_test(self, key, label_func, has_time=None):
17351735
del cls
17361736

17371737

1738+
def test_rotated_pole_poly():
1739+
"""Test function for https://github.com/psyplot/psy-maps/issues/28"""
1740+
test_file = os.path.join(bt.test_dir, "rotated-pole-test.nc")
1741+
with psy.plot.mapplot(test_file, name="t2m", plot="poly") as sp:
1742+
plotter = sp.plotters[0]
1743+
minx, maxx = plotter.ax.get_xlim()
1744+
miny, maxy = plotter.ax.get_ylim()
1745+
assert abs(minx - -30.88) < 2
1746+
assert abs(maxx - 19.95) < 2
1747+
assert abs(miny - -26.21) < 2
1748+
assert abs(maxy - 31.88) < 2
1749+
1750+
17381751
if __name__ == '__main__':
17391752
bt.RefTestProgram()

0 commit comments

Comments
 (0)