Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
71e6863
Add release highlights and pin rc version (#3898)
bjlittle Oct 2, 2020
3b9a0bd
reorder release highlights (#3899)
bjlittle Oct 2, 2020
1b59ffe
Add whatsnew announcement (#3900)
bjlittle Oct 2, 2020
a9c1e79
Fix spelling (#3903)
tkknight Oct 5, 2020
6d36021
Fix unit label handling (#3902)
znicholls Oct 7, 2020
c797fc8
Release Docs Improvements (#3895)
trexfeathers Oct 12, 2020
2e6aa01
Relax setup.py setup requirements (#3909)
bjlittle Oct 15, 2020
5da592f
Updated CF saver version in User Guide and docstring (#3925)
jonseddon Nov 24, 2020
0ff0dca
Migrate to cirrus-ci (#3928)
bjlittle Nov 25, 2020
28572d7
ignore url for doc link check (#3929)
bjlittle Nov 25, 2020
8d5dee0
whatsnew for coord default units (#3924)
rcomer Nov 25, 2020
c9d0dad
Cube._summary_coord_extra: efficiency and bugfix (#3922)
rcomer Nov 25, 2020
723a2f4
Add Documentation Title Case Capitalization (#3940)
bjlittle Dec 22, 2020
6e6fe03
CI requirements drop pip packages (#3939)
bjlittle Dec 23, 2020
83d1b72
update links (#3942)
rcomer Dec 30, 2020
5c8edc1
Add support for 1-d weights in collapse. (#3943)
pp-mo Jan 8, 2021
805a4fe
Remove warning for convert_units on lazy data (#3951)
rcomer Jan 20, 2021
e689ef4
drop stickler references in docs (#3953)
bjlittle Jan 25, 2021
62dcb17
update docs for travis-ci to cirrus-ci (#3954)
bjlittle Jan 25, 2021
9c6d778
docs for nox (#3955)
bjlittle Jan 25, 2021
78de3c6
Resolve test coverage (#3947)
bjlittle Jan 25, 2021
ca642ee
pin v3.0.0 version and whatnew date (#3956)
bjlittle Jan 25, 2021
8222f65
update github ci checks image (#3957)
bjlittle Jan 25, 2021
f468da3
Promote unknown units to dimensionless in aux factories (#3965)
bjlittle Jan 27, 2021
2557426
Release branch prepare for v3.0.2 (#4044)
bjlittle Mar 2, 2021
4885e12
um_stash_source attribute improved handling (#4035)
jonseddon Mar 2, 2021
e537afa
Support for py38 and Cartopy 0.19 (#4130)
rcomer May 13, 2021
05cd289
Intersection bounds fix (replacement PR) (#4059)
rcomer May 13, 2021
38bfb6c
bootstrap ci for 3.0.x (#4154)
bjlittle May 25, 2021
09018b0
Tweak to speed up dask wrapping of netcdf variables (#4135)
pp-mo May 26, 2021
7a1f585
Fb fix cube coord arithmetic (#4159)
bjlittle May 27, 2021
beb19b5
Pp daskfix (#4141)
pp-mo May 27, 2021
bdb7c9e
add release date to v3.0.2 whatsnew (#4160)
bjlittle May 27, 2021
274057b
update readme logo img src and href (#4006) (#4216)
bjlittle Jul 1, 2021
51fbe69
In cube.intersection, find split cells using a tolerant equality chec…
lbdreyer Jul 6, 2021
82dcba7
Update 3.0.3.rst
bjlittle Jul 7, 2021
8fc1b0e
Wide cubestr fix 3v0vx v2 (#4233)
pp-mo Jul 8, 2021
1505995
Fix some typos in the cube maths docs (#4248)
lbdreyer Jul 21, 2021
c61d5e5
(More of) Wide cubestr fix 3v0vx v2 (#4238)
pp-mo Jul 22, 2021
dd91f04
unpin cftime (#4222)
bjlittle Jul 22, 2021
1af2060
Test wrangling vs v3.0.x (#4249)
rcomer Jul 22, 2021
45e7a1c
mergeback v3.0.x release feature branch
bjlittle Aug 6, 2021
e7cb050
Fix mergeback PR #4035
bjlittle Aug 8, 2021
611a575
Fix mergeback PR #4035 tests
bjlittle Aug 9, 2021
9fa5cb6
Update mergeback nox conda-lock files
bjlittle Aug 9, 2021
2f71fa0
mergeback v3.0.x with nox lock update
bjlittle Aug 9, 2021
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
4 changes: 2 additions & 2 deletions docs/src/userguide/cube_maths.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Let's extend this example slightly, by taking a slice from the middle
air_temperature / (K) (longitude: 49; time: 240)

Compared to our original time-series, the *air_temp_T_slice* cube has one
less dimension *and* it's shape if different. However, this doesn't prevent
less dimension *and* its shape is different. However, this doesn't prevent
us from performing cube arithmetic with it, thanks to the extended cube
broadcasting behaviour::

Expand Down Expand Up @@ -237,7 +237,7 @@ by a cube with unit ``'1'`` will preserve units, so the cube ``temperature``
will be given the same units as are in ``pot_temperature``. It should be
noted that some combinations of units, particularly those involving power
operations, will not result in a valid unit and will cause the calculation
to fail. For example, a cube ``a`` had units ``'m'`` then ``a ** 0.5``
to fail. For example, if a cube ``a`` had units ``'m'`` then ``a ** 0.5``
would result in an error since the square root of a meter has no meaningful
unit (if ``a`` had units ``'m2'`` then ``a ** 0.5`` would result in a cube
with units ``'m'``).
Expand Down
3 changes: 1 addition & 2 deletions docs/src/whatsnew/3.0.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ This document explains the changes made to Iris for this release
factory, and the associated derived coordinate will be missing. (:pull:`3965`)


.. dropdown:: :opticon:`report` Release Highlights
.. dropdown:: :opticon:`report` v3.0.0 Release Highlights
:container: + shadow
:title: text-primary text-center font-weight-bold
:body: bg-light
:animate: fade-in
:open:

The highlights for this major release of Iris include:

Expand Down
571 changes: 571 additions & 0 deletions docs/src/whatsnew/3.0.2.rst

Large diffs are not rendered by default.

586 changes: 586 additions & 0 deletions docs/src/whatsnew/3.0.3.rst

Large diffs are not rendered by default.

620 changes: 620 additions & 0 deletions docs/src/whatsnew/3.0.4.rst

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/src/whatsnew/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Iris versions.
:maxdepth: 1

latest.rst
3.0.4.rst
3.0.3.rst
3.0.2.rst
3.0.1.rst
3.0.rst
2.4.rst
Expand Down
4 changes: 3 additions & 1 deletion lib/iris/_lazy_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def as_lazy_data(data, chunks=None, asarray=False):
if isinstance(data, ma.core.MaskedConstant):
data = ma.masked_array(data.data, mask=data.mask)
if not is_lazy_data(data):
data = da.from_array(data, chunks=chunks, asarray=asarray)
data = da.from_array(
data, chunks=chunks, asarray=asarray, meta=np.ndarray
)
return data


Expand Down
37 changes: 14 additions & 23 deletions lib/iris/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,28 +403,15 @@ def __binary_operator__(self, other, mode_constant):
# Note: this method includes bounds handling code, but it only runs
# within Coord type instances, as only these allow bounds to be set.

if isinstance(other, _DimensionalMetadata) or not isinstance(
other, (int, float, np.number)
):

def typename(obj):
if isinstance(obj, Coord):
result = "Coord"
else:
# We don't really expect this, but do something anyway.
result = self.__class__.__name__
return result

emsg = "{selftype} {operator} {othertype}".format(
selftype=typename(self),
operator=self._MODE_SYMBOL[mode_constant],
othertype=typename(other),
if isinstance(other, _DimensionalMetadata):
emsg = (
f"{self.__class__.__name__} "
f"{self._MODE_SYMBOL[mode_constant]} "
f"{other.__class__.__name__}"
)
raise iris.exceptions.NotYetImplementedError(emsg)

else:
# 'Other' is an array type : adjust points, and bounds if any.
result = NotImplemented
if isinstance(other, (int, float, np.number)):

def op(values):
if mode_constant == self._MODE_ADD:
Expand All @@ -441,8 +428,14 @@ def op(values):

new_values = op(self._values_dm.core_data())
result = self.copy(new_values)

if self.has_bounds():
result.bounds = op(self._bounds_dm.core_data())
else:
# must return NotImplemented to ensure invocation of any
# associated reflected operator on the "other" operand
# see https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types
result = NotImplemented

return result

Expand All @@ -461,8 +454,7 @@ def __div__(self, other):
def __truediv__(self, other):
return self.__binary_operator__(other, self._MODE_DIV)

def __radd__(self, other):
return self + other
__radd__ = __add__

def __rsub__(self, other):
return (-self) + other
Expand All @@ -473,8 +465,7 @@ def __rdiv__(self, other):
def __rtruediv__(self, other):
return self.__binary_operator__(other, self._MODE_RDIV)

def __rmul__(self, other):
return self * other
__rmul__ = __mul__

def __neg__(self):
values = -self._core_values()
Expand Down
62 changes: 38 additions & 24 deletions lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -3193,24 +3193,26 @@ def _intersect_modulus(
# and call the new bounds = the new points + the difference.
pre_wrap_delta = np.diff(coord.bounds[inside_indices])
post_wrap_delta = np.diff(bounds[inside_indices])
close_enough = np.allclose(pre_wrap_delta, post_wrap_delta)
if not close_enough:
split_cell_indices, _ = np.where(
pre_wrap_delta != post_wrap_delta
)

# Recalculate the extended minimum.
split_cell_indices, _ = np.where(
~np.isclose(pre_wrap_delta, post_wrap_delta)
)
if split_cell_indices.size:
indices = inside_indices[split_cell_indices]
cells = bounds[indices]
cells_delta = np.diff(coord.bounds[indices])

# Watch out for ascending/descending bounds
if cells_delta[0, 0] > 0:
cells[:, 0] = cells[:, 1] - cells_delta[:, 0]
minimum = np.min(cells[:, 0])
else:
cells[:, 1] = cells[:, 0] + cells_delta[:, 0]
minimum = np.min(cells[:, 1])
if maximum % modulus not in cells:
# Recalculate the extended minimum only if the output bounds
# do not span the requested (minimum, maximum) range. If
# they do span that range, this adjustment would give unexpected
# results (see #3391).
cells_delta = np.diff(coord.bounds[indices])

# Watch out for ascending/descending bounds.
if cells_delta[0, 0] > 0:
cells[:, 0] = cells[:, 1] - cells_delta[:, 0]
minimum = np.min(cells[:, 0])
else:
cells[:, 1] = cells[:, 0] + cells_delta[:, 0]
minimum = np.min(cells[:, 1])

points = wrap_lons(coord.points, minimum, modulus)

Expand Down Expand Up @@ -3764,37 +3766,49 @@ def __ne__(self, other):
def __hash__(self):
return hash(id(self))

def __add__(self, other):
return iris.analysis.maths.add(self, other)
__add__ = iris.analysis.maths.add

def __iadd__(self, other):
return iris.analysis.maths.add(self, other, in_place=True)

__radd__ = __add__

def __sub__(self, other):
return iris.analysis.maths.subtract(self, other)
__sub__ = iris.analysis.maths.subtract

def __isub__(self, other):
return iris.analysis.maths.subtract(self, other, in_place=True)

def __rsub__(self, other):
return (-self) + other

__mul__ = iris.analysis.maths.multiply
__rmul__ = iris.analysis.maths.multiply

def __imul__(self, other):
return iris.analysis.maths.multiply(self, other, in_place=True)

__rmul__ = __mul__

__div__ = iris.analysis.maths.divide

def __idiv__(self, other):
return iris.analysis.maths.divide(self, other, in_place=True)

__truediv__ = iris.analysis.maths.divide
def __rdiv__(self, other):
data = 1 / self.core_data()
reciprocal = self.copy(data=data)
return iris.analysis.maths.multiply(reciprocal, other)

def __itruediv__(self, other):
return iris.analysis.maths.divide(self, other, in_place=True)
__truediv__ = __div__

__itruediv__ = __idiv__

__rtruediv__ = __rdiv__

__pow__ = iris.analysis.maths.exponentiate

def __neg__(self):
return self.copy(data=-self.core_data())

# END OPERATOR OVERLOADS

def collapsed(self, coords, aggregator, **kwargs):
Expand Down
20 changes: 17 additions & 3 deletions lib/iris/fileformats/_nc_load_rules/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@
from functools import wraps
import warnings

from iris.config import get_logger
import iris.fileformats.cf
import iris.fileformats.pp as pp

from . import helpers as hh

# Configure the logger.
logger = get_logger(__name__, fmt="[%(funcName)s]")


def _default_rulenamesfunc(func_name):
# A simple default function to deduce the rules-name from an action-name.
Expand Down Expand Up @@ -385,13 +389,23 @@ def action_ukmo_stash(engine):
attr_name = "ukmo__um_stash_source"
attr_value = getattr(var, attr_name, None)
if attr_value is None:
attr_altname = "um_stash_source" # legacy form
attr_value = getattr(var, attr_altname, None)
attr_name = "um_stash_source" # legacy form
attr_value = getattr(var, attr_name, None)
if attr_value is None:
rule_name += "(NOT-TRIGGERED)"
else:
# No helper routine : just do it
engine.cube.attributes["STASH"] = pp.STASH.from_msi(attr_value)
try:
stash_code = pp.STASH.from_msi(attr_value)
except (TypeError, ValueError):
engine.cube.attributes[attr_name] = attr_value
msg = (
"Unable to set attribute STASH as not a valid MSI "
f'string "mXXsXXiXXX", got "{attr_value}"'
)
logger.debug(msg)
else:
engine.cube.attributes["STASH"] = stash_code

return rule_name

Expand Down
8 changes: 4 additions & 4 deletions lib/iris/fileformats/name_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def _generate_cubes(
coord_units = _parse_units("FL")
if coord.name == "time":
coord_units = time_unit
pts = time_unit.date2num(coord.values)
pts = np.float_(time_unit.date2num(coord.values))

if coord.dimension is not None:
if coord.name == "longitude":
Expand All @@ -505,7 +505,7 @@ def _generate_cubes(
):
dt = coord.values - field_headings["Av or Int period"]
bnds = time_unit.date2num(np.vstack((dt, coord.values)).T)
icoord.bounds = bnds
icoord.bounds = np.float_(bnds)
else:
icoord.guess_bounds()
cube.add_dim_coord(icoord, coord.dimension)
Expand All @@ -522,7 +522,7 @@ def _generate_cubes(
):
dt = coord.values - field_headings["Av or Int period"]
bnds = time_unit.date2num(np.vstack((dt, coord.values)).T)
icoord.bounds = bnds[i, :]
icoord.bounds = np.float_(bnds[i, :])
cube.add_aux_coord(icoord)

# Headings/column headings which are encoded elsewhere.
Expand Down Expand Up @@ -1250,7 +1250,7 @@ def load_NAMEIII_trajectory(filename):

long_name = units = None
if isinstance(values[0], datetime.datetime):
values = time_unit.date2num(values)
values = np.float_(time_unit.date2num(values))
units = time_unit
if name == "Time":
name = "time"
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/fileformats/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ def write(
dtype(i.e. 'i2', 'short', 'u4') or a dict of packing parameters as
described below. This provides support for netCDF data packing as
described in
http://www.unidata.ucar.edu/software/netcdf/documentation/NUG/best_practices.html#bp_Packed-Data-Values
https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/best_practices.html#bp_Packed-Data-Values
If this argument is a type (or type string), appropriate values of
scale_factor and add_offset will be automatically calculated based
on `cube.data` and possible masking. For more control, pass a dict
Expand Down Expand Up @@ -2579,7 +2579,7 @@ def save(
(i.e. 'i2', 'short', 'u4') or a dict of packing parameters as described
below or an iterable of such types, strings, or dicts.
This provides support for netCDF data packing as described in
http://www.unidata.ucar.edu/software/netcdf/documentation/NUG/best_practices.html#bp_Packed-Data-Values
https://www.unidata.ucar.edu/software/netcdf/documentation/NUG/best_practices.html#bp_Packed-Data-Values
If this argument is a type (or type string), appropriate values of
scale_factor and add_offset will be automatically calculated based
on `cube.data` and possible masking. For more control, pass a dict with
Expand Down
Loading