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
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ install:
# Conda-forge versioning is out of order (0.9.* is later than 2.12.*).
- >
if [[ "${TEST_MINIMAL}" != true ]]; then
conda install --quiet -n ${ENV_NAME} python-eccodes=0.9.3;
conda install --quiet -n ${ENV_NAME} python-eccodes">=0.9.1, <2";
conda install --quiet -n ${ENV_NAME} --no-deps iris-grib;
fi

Expand Down Expand Up @@ -162,13 +162,18 @@ script:
fi

# Split the organisation out of the slug. See https://stackoverflow.com/a/5257398/741316 for description.
- export ORG=(${TRAVIS_REPO_SLUG//\// })
# NOTE: a *separate* "export" command appears to be necessary here : A command of the
# form "export ORG=.." failed to define ORG for the following command (?!)
- >
ORG=$(echo ${TRAVIS_REPO_SLUG} | cut -d/ -f1);
export ORG

- echo "Travis job context ORG=${ORG}; TRAVIS_EVENT_TYPE=${TRAVIS_EVENT_TYPE}; PUSH_BUILT_DOCS=${PUSH_BUILT_DOCS}"

# When we merge a change to SciTools/iris, we can push docs to github pages.
# At present, only the Python 3.7 "doctest" job does this.
# Results appear at https://scitools-docs.github.io/iris/<<branchname>>/index.html
- >
if [[ "${ORG}" == 'SciTools' && "${TRAVIS_EVENT_TYPE}" == 'push' && "${PUSH_BUILT_DOCS}" == 'true' ]]; then
- if [[ "${ORG}" == 'SciTools' && "${TRAVIS_EVENT_TYPE}" == 'push' && "${PUSH_BUILT_DOCS}" == 'true' ]]; then
cd ${INSTALL_DIR};
pip install doctr;
doctr deploy --deploy-repo SciTools-docs/iris --built-docs docs/iris/build/html
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fixed a bug where the attributes of cell measures in netcdf-CF files were discarded on
loading. They now appear on the CellMeasure in the loaded cube.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* Added support for the `black <https://black.readthedocs.io/en/stable/>`_ code formatter.
This is now automatically checked on GitHub PRs, replacing the older, unittest-based
"iris.tests.test_coding_standards.TestCodeFormat".
Black provides automatic code format correction for most IDEs.
See the new developer guide section on this :
https://scitools-docs.github.io/iris/master/developers_guide/code_format.html.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* CF Ancillary Variables are now loaded from and saved to netcdf-CF files.

42 changes: 21 additions & 21 deletions lib/iris/experimental/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,24 @@ def _regrid_area_weighted_array(
grid.

"""
# Determine which grid bounds are within src extent.
y_within_bounds = _within_bounds(
src_y_bounds, grid_y_bounds, grid_y_decreasing
)
x_within_bounds = _within_bounds(
src_x_bounds, grid_x_bounds, grid_x_decreasing
)

# Cache which src_bounds are within grid bounds
cached_x_bounds = []
cached_x_indices = []
for (x_0, x_1) in grid_x_bounds:
if grid_x_decreasing:
x_0, x_1 = x_1, x_0
x_bounds, x_indices = _cropped_bounds(src_x_bounds, x_0, x_1)
cached_x_bounds.append(x_bounds)
cached_x_indices.append(x_indices)

# Create empty data array to match the new grid.
# Note that dtype is not preserved and that the array is
# masked to allow for regions that do not overlap.
Expand All @@ -497,24 +515,6 @@ def _regrid_area_weighted_array(
# Assign to mask to explode it, allowing indexed assignment.
new_data.mask = False

# Determine which grid bounds are within src extent.
y_within_bounds = _within_bounds(
src_y_bounds, grid_y_bounds, grid_y_decreasing
)
x_within_bounds = _within_bounds(
src_x_bounds, grid_x_bounds, grid_x_decreasing
)

# Cache which src_bounds are within grid bounds
cached_x_bounds = []
cached_x_indices = []
for (x_0, x_1) in grid_x_bounds:
if grid_x_decreasing:
x_0, x_1 = x_1, x_0
x_bounds, x_indices = _cropped_bounds(src_x_bounds, x_0, x_1)
cached_x_bounds.append(x_bounds)
cached_x_indices.append(x_indices)

# Axes of data over which the weighted mean is calculated.
axes = []
if y_dim is not None:
Expand Down Expand Up @@ -565,15 +565,15 @@ def _regrid_area_weighted_array(
raise RuntimeError(
"Cannot handle split bounds " "in both x and y."
)
# Calculate weights based on areas of cropped bounds.
weights = area_func(y_bounds, x_bounds)

if x_dim is not None:
indices[x_dim] = x_indices
if y_dim is not None:
indices[y_dim] = y_indices
data = src_data[tuple(indices)]

# Calculate weights based on areas of cropped bounds.
weights = area_func(y_bounds, x_bounds)

# Transpose weights to match dim ordering in data.
weights_shape_y = weights.shape[0]
weights_shape_x = weights.shape[1]
Expand Down
Loading