Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpin Matplotlib and proj #3762

Merged
merged 20 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
da2977e
unpin proj, move cartopy pin forward
stephenworsley Jul 24, 2020
cb299e7
Explicit resolution of coastlines in tests - see SciTools/cartopy#1105.
trexfeathers Aug 24, 2020
81d7843
Removed gdal optional requirement.
trexfeathers Aug 24, 2020
efda068
New target image for test_plot_custom_aggregation due to auto-sizing …
trexfeathers Aug 25, 2020
961e3a2
New acceptable images for various tests due to minor changes in Matpl…
trexfeathers Aug 25, 2020
4050012
New target images for test plots affected by the gridline spacing cha…
trexfeathers Aug 25, 2020
41b3b2a
New acceptable images to allow for minute colormap range changes in M…
trexfeathers Aug 25, 2020
27ea2f2
Improvement to quickplot time axis labelling and accompanying graphic…
trexfeathers Aug 26, 2020
75dfe94
Made quickplot time axis label sensitive to MPL version (see matplotl…
trexfeathers Aug 26, 2020
ef3c9db
More target images following from 41b3b2a3e9c7cc1cef55a5a8ec614088cda…
trexfeathers Aug 27, 2020
27b0602
More target images following from 27ea2f2185e64e974e7a7953b0cae801229…
trexfeathers Aug 27, 2020
27688ca
Mirroring _draw_2d_from_points() use of mpl date2num in _draw_2d_from…
trexfeathers Aug 27, 2020
45781b5
Re-instated all valid image targets for TestPlotCoordinatesGiven.test…
trexfeathers Aug 27, 2020
484a611
New target image for TestSimple.test_bounds following change to plot …
trexfeathers Aug 27, 2020
0c3eece
modify raster tests to handle new gdal behaviour
stephenworsley Sep 1, 2020
3f30dde
modify raster tests to handle new gdal naming behaviour
stephenworsley Sep 1, 2020
d07d227
modify tests to reflect new PROJ behaviour
stephenworsley Sep 1, 2020
5d30af6
modify parts of test_project to use Transverse Mercator
stephenworsley Sep 2, 2020
b95c86b
revert test_project to use Robinson, add warning to docstring
stephenworsley Sep 2, 2020
81ccbe1
keep results consistent
stephenworsley Sep 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/iris/analysis/cartography.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,12 @@ def project(cube, target_proj, nx=None, ny=None):
on the statistics of the data e.g. the mean and standard deviation
will not be preserved.

.. warning::

If the target projection is non-rectangular, e.g. Robinson, the target
grid may include points outside the boundary of the projection. The
latitude/longitude of such points may be unpredictable.

pp-mo marked this conversation as resolved.
Show resolved Hide resolved
"""
try:
lon_coord, lat_coord = _get_lon_lat_coords(cube)
Expand Down
5 changes: 5 additions & 0 deletions lib/iris/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ def _draw_2d_from_bounds(draw_method_name, cube, *args, **kwargs):
values = np.arange(data.shape[data_dim] + 1) - 0.5
else:
values = coord.contiguous_bounds()
values = _fixup_dates(coord, values)
if values.dtype == np.dtype(object) and isinstance(
values[0], datetime.datetime
):
values = mpl_dates.date2num(values)
trexfeathers marked this conversation as resolved.
Show resolved Hide resolved

plot_arrays.append(values)

Expand Down
8 changes: 8 additions & 0 deletions lib/iris/quickplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""

import cf_units
from matplotlib import __version__ as mpl_version
import matplotlib.pyplot as plt

import iris.config
Expand Down Expand Up @@ -46,6 +47,13 @@ def _title(cube_or_coord, with_units):

if _use_symbol(units):
units = units.symbol
if units.is_time_reference():
# iris.plot uses matplotlib.dates.date2num, which is fixed to the below unit.
if mpl_version >= "3.3":
days_since = "1970-01-01"
else:
days_since = "0001-01-01"
units = "days since {}".format(days_since)
trexfeathers marked this conversation as resolved.
Show resolved Hide resolved
title += " / {}".format(units)

return title
Expand Down
10 changes: 4 additions & 6 deletions lib/iris/tests/experimental/test_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def _check_tiff_export(self, masked, inverted=False):
339,
33550,
33922,
42113,
# Don't add a check entry for this, as coding changed between gdal
# version 1 and 2.
# tif_header_entries[42113] = (u'1e+20',)
pp-mo marked this conversation as resolved.
Show resolved Hide resolved
]
tif_header_entries = {
256: (160,),
Expand Down Expand Up @@ -130,12 +134,6 @@ def _check_tiff_export(self, masked, inverted=False):
# Mask some of the data + expect a slightly different header...
cube.data = np.ma.masked_where(cube.data <= 380, cube.data)

# There is an additional key..
tif_header_keys += [42113]
# Don't add a check entry for this, as coding changed between gdal
# version 1 and 2, *and* between Python2 and Python3.
# tif_header_entries[42113] = (u'1e+20',)

if inverted:
# Check with the latitude coordinate (and the corresponding
# cube.data) inverted.
Expand Down
6 changes: 3 additions & 3 deletions lib/iris/tests/integration/plot/test_plot_2d_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def test_2d_coord_bounds_platecarree(self):
cube = simple_cube_w_2d_coords()[0, 0]
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=180))
qplt.pcolormesh(cube)
ax.coastlines(color="red")
ax.coastlines(resolution="110m", color="red")
self.check_graphic()

def test_2d_coord_bounds_northpolarstereo(self):
cube = simple_cube_w_2d_coords()[0, 0]
ax = plt.axes(projection=ccrs.NorthPolarStereo())
qplt.pcolormesh(cube)
ax.coastlines(color="red")
ax.coastlines(resolution="110m", color="red")
self.check_graphic()


Expand All @@ -71,7 +71,7 @@ def test_2d_coords_contour(self):
cube.add_aux_coord(co_x, (0, 1))
ax = plt.axes(projection=ccrs.PlateCarree())
qplt.contourf(cube)
ax.coastlines(color="red")
ax.coastlines(resolution="110m", color="red")
ax.gridlines(draw_labels=True)
ax.set_extent((0, 180, 0, 90))
self.check_graphic()
Expand Down
6 changes: 3 additions & 3 deletions lib/iris/tests/integration/plot/test_vector_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_2d_plain_latlon(self):
self.plot(
"latlon_2d", u_cube, v_cube, coords=("longitude", "latitude")
)
ax.coastlines(color="red")
ax.coastlines(resolution="110m", color="red")
ax.set_global()
self.check_graphic()

Expand All @@ -132,7 +132,7 @@ def test_2d_plain_latlon_on_polar_map(self):
self.plot(
"latlon_2d_polar", u_cube, v_cube, coords=("longitude", "latitude")
)
ax.coastlines(color="red")
ax.coastlines(resolution="110m", color="red")
self.check_graphic()

def test_2d_rotated_latlon(self):
Expand All @@ -142,7 +142,7 @@ def test_2d_rotated_latlon(self):
self.plot(
"2d_rotated", u_cube, v_cube, coords=("longitude", "latitude")
)
ax.coastlines(color="red")
ax.coastlines(resolution="110m", color="red")
ax.set_global()
self.check_graphic()

Expand Down
Loading