Skip to content

Commit

Permalink
Pin Dask to avoid 0.18.2 bug with masked arrays. (#3127)
Browse files Browse the repository at this point in the history
* Put orca_util routines in subpackage of iris.test.stock, to get existing iris.tests.unit.plot.test_2d_coords working.

* Disable broken misused testcode in test_gridcell_angles.

* Ditch test_gridcell_angles, none of it is functional.

* Further style fixes.

* Skip tests using iris-test-data, for Travis TEST_MINIMAL phases.

* Codestyle fix (though this code obsolete anyway).

* Fix unused imports.

* Made-up test cube replaces use of iris-test-data.

* Renamed keyword; improved docstring.

* Change 'co' to 'coord' for clarity.

* Review changes.
  • Loading branch information
pp-mo authored and lbdreyer committed Aug 14, 2018
1 parent e3e82e4 commit b041c50
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 417 deletions.
6 changes: 3 additions & 3 deletions lib/iris/analysis/_grid_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _angle(p, q, r):
if old_style:
mid_lons = np.deg2rad(q[0])

pr = _3d_xyz_from_latlon(r[0], r[1]) - _3d_xyz_from_latlon(p[0], p[1])
pr = _3d_xyz_from_latlon(r[0], r[1]) - _3d_xyz_from_latlon(p[0], p[1])
pr_norm = np.sqrt(np.sum(pr**2, axis=0))
pr_top = pr[1] * np.cos(mid_lons) - pr[0] * np.sin(mid_lons)

Expand Down Expand Up @@ -124,7 +124,7 @@ def _angle(p, q, r):
lmb_hatvec_y,
lmb_hatvec_z)])

pr = _3d_xyz_from_latlon(r[0], r[1]) - _3d_xyz_from_latlon(p[0], p[1])
pr = _3d_xyz_from_latlon(r[0], r[1]) - _3d_xyz_from_latlon(p[0], p[1])

# Dot products to form true-northward / true-eastward projections.
pr_cmpt_e = np.sum(pr * lmb_hatvec, axis=0)
Expand All @@ -141,7 +141,7 @@ def _angle(p, q, r):
rtol = 1.e-3
check = np.allclose(mag_rot, mag_orig, rtol=rtol)
if not check:
print (mag_rot, mag_orig)
print(mag_rot, mag_orig)
assert np.allclose(mag_rot, mag_orig, rtol=rtol)

return psi
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ def is_contiguous(self, rtol=1e-05, atol=1e-08):
rtol=rtol, atol=atol)
elif self.ndim == 2:
contiguous, _, _ = _discontiguity_in_2d_bounds(self.bounds,
abs_tol=atol)
abs_tol=atol)
else:
contiguous = False
return contiguous
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def _draw_2d_from_bounds(draw_method_name, cube, *args, **kwargs):
plot_defn = _get_plot_defn(cube, mode, ndims=2)

twodim_contig_atol = kwargs.pop('two_dim_coord_contiguity_atol',
1e-4)
1e-4)
for coord in plot_defn.coords:
if hasattr(coord, 'has_bounds'):
if coord.ndim == 2 and coord.has_bounds():
Expand Down
3 changes: 2 additions & 1 deletion lib/iris/tests/stock.py → lib/iris/tests/stock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
from iris.coords import DimCoord, AuxCoord
import iris.tests as tests
from iris.coord_systems import GeogCS, RotatedGeogCS

from ._stock_2d_latlons import (sample_2d_latlons,
make_bounds_discontiguous_at_point)

def lat_lon_cube():
"""
Expand Down
Loading

0 comments on commit b041c50

Please sign in to comment.