Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
- id: no-commit-to-branch

- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First stable black version 🥳🥂

hooks:
- id: black
pass_filenames: false
Expand All @@ -50,7 +50,7 @@ repos:
args: [--filter-files]

- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
rev: v1.12.1
hooks:
- id: blacken-docs
types: [file, rst]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setup(self):
# Should generate 10 distinct contours, regardless of dim size.
dim_size = int(ARTIFICIAL_DIM_SIZE / 5)
repeat_number = int(dim_size / 10)
repeat_range = range(int((dim_size ** 2) / repeat_number))
repeat_range = range(int((dim_size**2) / repeat_number))
data = np.repeat(repeat_range, repeat_number)
data = data.reshape((dim_size,) * 2)

Expand Down
4 changes: 2 additions & 2 deletions docs/gallery_code/meteorology/plot_wind_barbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main():

# To illustrate the full range of barbs, scale the wind speed up to pretend
# that a storm is passing over
magnitude = (uwind ** 2 + vwind ** 2) ** 0.5
magnitude = (uwind**2 + vwind**2) ** 0.5
magnitude.convert_units("knot")
max_speed = magnitude.collapsed(
("latitude", "longitude"), iris.analysis.MAX
Expand All @@ -41,7 +41,7 @@ def main():
vwind = vwind / max_speed * max_desired

# Create a cube containing the wind speed
windspeed = (uwind ** 2 + vwind ** 2) ** 0.5
windspeed = (uwind**2 + vwind**2) ** 0.5
windspeed.rename("windspeed")
windspeed.convert_units("knot")

Expand Down
2 changes: 1 addition & 1 deletion docs/gallery_code/meteorology/plot_wind_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main():
vwind = iris.load_cube(infile, "y_wind")

# Create a cube containing the wind speed.
windspeed = (uwind ** 2 + vwind ** 2) ** 0.5
windspeed = (uwind**2 + vwind**2) ** 0.5
windspeed.rename("windspeed")

# Plot the wind speed as a contour plot.
Expand Down
9 changes: 4 additions & 5 deletions docs/src/whatsnew/dev.rst → docs/src/whatsnew/3.2.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.. include:: ../common_links.inc

|iris_version| |build_date| [unreleased]
****************************************
v3.2 (31 Jan 2022) [unreleased]
*******************************

This document explains the changes made to Iris for this release
(:doc:`View all changes <index>`.)


.. dropdown:: :opticon:`report` |iris_version| Release Highlights
.. dropdown:: :opticon:`report` v3.2.0 Release Highlights
:container: + shadow
:title: text-primary text-center font-weight-bold
:body: bg-light
Expand All @@ -18,8 +18,7 @@ This document explains the changes made to Iris for this release

* We've added experimental support for
:ref:`Meshes <ugrid>`, which can now be loaded and
attached to a cube. Mesh support is based on the based on `CF-UGRID`_
model.
attached to a cube. Mesh support is based on the `CF-UGRID`_ model.
* We've also dropped support for ``Python 3.7``.

And finally, get in touch with us on :issue:`GitHub<new/choose>` if you have
Expand Down
112 changes: 0 additions & 112 deletions docs/src/whatsnew/dev.rst.template

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/whatsnew/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Iris versions.
.. toctree::
:maxdepth: 1

dev.rst
3.2.rst
3.1.rst
3.0.rst
2.4.rst
Expand Down
2 changes: 1 addition & 1 deletion docs/src/whatsnew/latest.rst
2 changes: 1 addition & 1 deletion lib/iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def callback(cube, field, filename):


# Iris revision.
__version__ = "3.2.dev0"
__version__ = "3.2.0rc0"

# Restrict the names imported when using "from iris import *"
__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ def _lazy_rms(array, axis, **kwargs):
# all. Thus trying to use this aggregator with weights will currently
# raise an error in dask due to the unexpected keyword `weights`,
# rather than silently returning the wrong answer.
return da.sqrt(da.mean(array ** 2, axis=axis, **kwargs))
return da.sqrt(da.mean(array**2, axis=axis, **kwargs))


@_build_dask_mdtol_function
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/_grid_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _angle(p, q, r):
mid_lons = np.deg2rad(q[0])

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_norm = np.sqrt(np.sum(pr**2, axis=0))
pr_top = pr[1] * np.cos(mid_lons) - pr[0] * np.sin(mid_lons)

index = pr_norm == 0
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/_scipy_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def compute_interp_weights(self, xi, method=None):
xi_shape, method, indices, norm_distances, out_of_bounds = prepared

# Allocate arrays for describing the sparse matrix.
n_src_values_per_result_value = 2 ** ndim
n_src_values_per_result_value = 2**ndim
n_result_values = len(indices[0])
n_non_zero = n_result_values * n_src_values_per_result_value
weights = np.ones(n_non_zero, dtype=norm_distances[0].dtype)
Expand Down
12 changes: 4 additions & 8 deletions lib/iris/analysis/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,10 @@ def curl(i_cube, j_cube, k_cube=None):
# (d/dtheta (i_cube * sin(lat)) - d_j_cube_dphi)
# phi_cmpt = 1/r * ( d/dr (r * j_cube) - d_k_cube_dtheta)
# theta_cmpt = 1/r * ( 1/cos(lat) * d_k_cube_dphi - d/dr (r * i_cube)
if (
y_coord.name()
not in [
"latitude",
"grid_latitude",
]
or x_coord.name() not in ["longitude", "grid_longitude"]
):
if y_coord.name() not in [
"latitude",
"grid_latitude",
] or x_coord.name() not in ["longitude", "grid_longitude"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

raise ValueError(
"Expecting latitude as the y coord and "
"longitude as the x coord for spherical curl."
Expand Down
6 changes: 3 additions & 3 deletions lib/iris/analysis/cartography.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def _quadrant_area(radian_lat_bounds, radian_lon_bounds, radius_of_earth):
raise ValueError("Bounds must be [n,2] array")

# fill in a new array of areas
radius_sqr = radius_of_earth ** 2
radius_sqr = radius_of_earth**2
radian_lat_64 = radian_lat_bounds.astype(np.float64)
radian_lon_64 = radian_lon_bounds.astype(np.float64)

Expand Down Expand Up @@ -1010,8 +1010,8 @@ def _transform_distance_vectors_tolerance_mask(
# Squared magnitudes should be equal to one within acceptable tolerance.
# A value of atol=2e-3 is used, which corresponds to a change in magnitude
# of approximately 0.1%.
sqmag_1_0 = u_one_t ** 2 + v_zero_t ** 2
sqmag_0_1 = u_zero_t ** 2 + v_one_t ** 2
sqmag_1_0 = u_one_t**2 + v_zero_t**2
sqmag_0_1 = u_zero_t**2 + v_one_t**2
mask = np.logical_not(
np.logical_and(
np.isclose(sqmag_1_0, ones, atol=2e-3),
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def power(data, out=None):
return _math_op_common(
cube,
power,
cube.units ** exponent,
cube.units**exponent,
new_dtype=new_dtype,
in_place=in_place,
)
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/analysis/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def _ones_like(cube):
covar = (s1 * s2).collapsed(
corr_coords, iris.analysis.SUM, weights=weights_1, mdtol=mdtol
)
var_1 = (s1 ** 2).collapsed(
var_1 = (s1**2).collapsed(
corr_coords, iris.analysis.SUM, weights=weights_1
)
var_2 = (s2 ** 2).collapsed(
var_2 = (s2**2).collapsed(
corr_coords, iris.analysis.SUM, weights=weights_2
)

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 @@ -2738,9 +2738,9 @@ def _create_cf_data_variable(
cmin, cmax = _co_realise_lazy_arrays([cmin, cmax])
n = dtype.itemsize * 8
if masked:
scale_factor = (cmax - cmin) / (2 ** n - 2)
scale_factor = (cmax - cmin) / (2**n - 2)
else:
scale_factor = (cmax - cmin) / (2 ** n - 1)
scale_factor = (cmax - cmin) / (2**n - 1)
if dtype.kind == "u":
add_offset = cmin
elif dtype.kind == "i":
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/fileformats/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def _calculate_str_value_from_value(self):

def _calculate_value_from_str_value(self):
self._value = np.sum(
[10 ** i * val for i, val in enumerate(self._strvalue)]
[10**i * val for i, val in enumerate(self._strvalue)]
)

def __len__(self):
Expand All @@ -418,7 +418,7 @@ def __getitem__(self, key):
# if the key returns a list of values, then combine them together
# to an integer
if isinstance(val, list):
val = sum([10 ** i * val for i, val in enumerate(val)])
val = sum([10**i * val for i, val in enumerate(val)])

return val

Expand Down
6 changes: 3 additions & 3 deletions lib/iris/tests/integration/test_netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def setUp(self):
levels.units = "centimeters"
levels.positive = "down"
levels.axis = "Z"
levels[:] = np.linspace(0, 10 ** 5, 3)
levels[:] = np.linspace(0, 10**5, 3)

volcello.id = "volcello"
volcello.out_name = "volcello"
Expand Down Expand Up @@ -507,9 +507,9 @@ def _get_scale_factor_add_offset(cube, datatype):
else:
masked = False
if masked:
scale_factor = (cmax - cmin) / (2 ** n - 2)
scale_factor = (cmax - cmin) / (2**n - 2)
else:
scale_factor = (cmax - cmin) / (2 ** n - 1)
scale_factor = (cmax - cmin) / (2**n - 1)
if dt.kind == "u":
add_offset = cmin
elif dt.kind == "i":
Expand Down
Loading