Skip to content

Commit

Permalink
[FB] [PI-3478] Lenient cube arithmetic (SciTools#3774)
Browse files Browse the repository at this point in the history
* initial cube arithmetic

* support in-place cube resolve

* fix non in-place broadcasting

* remove temporary resolve scenario test

* lenient/strict support for attributes dicts with numpy arrays

* lenient/strict treatment of scalar coordinates

* strict points/bounds matching

* lenient/strict prepare local dim/aux/scalar coordinates

* support extended broadcasting

* always raise exception on points/bounds mismatch

* ignore scalar points/bounds mismatches, lenient only

* remove todos

* tidy logger debugs

* qualify src/tgt cube references in debug

* Numpy rounding fix (SciTools#3758)

ensure rounding is numpy like (maintains type)

* avoid unittest.mock.sentinel copy issue

* fast load np.int32

* fix cube maths doctest

* fix iris.common.resolve logging configuration

* fix prepare points/bounds + extra metadata cml

* support mapping reversal based on free dims

* var_name fix for lenient equality

* add support for DimCoordMetadata

* fix circular flag + support CoordMetadata and DimCoordMetadata exchange

* fix circular issue for concatenate DimCoord->AuxCoord demotion

* fix concatenate._CubeSignature sorted

* minor tweaks

* keep lenient_client private in maths

* tidy maths

* tidy iris.analysis.maths.IFunc

* refactor IFunc test

* polish in-place support

* tidy metadata_resolve

Co-authored-by: stephenworsley <[email protected]>
  • Loading branch information
bjlittle and stephenworsley committed Aug 13, 2020
1 parent 8392152 commit 599fa11
Show file tree
Hide file tree
Showing 71 changed files with 2,761 additions and 358 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ignore =
E402,
# E501: line too long
E501,
# E731: do not assign a lambda expression, use a def
E731,
# W503: line break before binary operator
W503,
# W504: line break after binary operator
Expand Down
4 changes: 4 additions & 0 deletions docs/iris/src/userguide/cube_maths.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ but with the data representing their difference:
Scalar coordinates:
forecast_reference_time: 1859-09-01 06:00:00
height: 1.5 m
Attributes:
Conventions: CF-1.5
Model scenario: E1
source: Data from Met Office Unified Model 6.05


.. note::
Expand Down
7 changes: 5 additions & 2 deletions lib/iris/_concatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ def __init__(self, cube):
axes = dict(T=0, Z=1, Y=2, X=3)

# Coordinate sort function - by guessed coordinate axis, then
# by coordinate metadata, then by dimensions, in ascending order.
# by coordinate name, then by dimensions, in ascending order.
def key_func(coord):
return (
axes.get(guess_coord_axis(coord), len(axes) + 1),
coord.metadata,
coord.name(),
cube.coord_dims(coord),
)

Expand Down Expand Up @@ -990,6 +990,9 @@ def _build_aux_coordinates(self):
points, bounds=bnds, **kwargs
)
except ValueError:
# Ensure to remove the "circular" kwarg, which may be
# present in the defn of a DimCoord being demoted.
_ = kwargs.pop("circular", None)
coord = iris.coords.AuxCoord(
points, bounds=bnds, **kwargs
)
Expand Down
Loading

0 comments on commit 599fa11

Please sign in to comment.