Skip to content

Commit d3559ef

Browse files
committed
Merge pull request #1625 from ajdawson/fix-regularise-warning
Prevent warning about regularise when using new loader.
2 parents 4c9eee6 + 7636cc5 commit d3559ef

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/iris/fileformats/grib/__init__.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,27 +890,31 @@ def load_cubes(filenames, callback=None, auto_regularise=True):
890890
If *True*, any cube defined on a reduced grid will be interpolated
891891
to an equivalent regular grid. If *False*, any cube defined on a
892892
reduced grid will be loaded on the raw reduced grid with no shape
893-
information. The default behaviour is to interpolate cubes on a
894-
reduced grid to an equivalent regular grid.
893+
information. If `iris.FUTURE.strict_grib_load` is `True` then this
894+
keyword has no effect, raw grids are always used. If the older GRIB
895+
loader is in use then the default behaviour is to interpolate cubes
896+
on a reduced grid to an equivalent regular grid.
895897
896898
.. deprecated:: 1.8. Please use strict_grib_load and regrid instead.
897899
898900
899901
900902
"""
901-
if auto_regularise is not None:
902-
warnings.warn('the`auto_regularise` kwarg is deprecated and '
903-
'will be removed in a future release. Resampling '
904-
'quasi-regular grids on load will no longer be '
905-
'available. Resampling should be done on the '
906-
'loaded cube instead using Cube.regrid.')
907-
908903
if iris.FUTURE.strict_grib_load:
909904
grib_loader = iris.fileformats.rules.Loader(
910905
_GribMessage.messages_from_filename,
911906
{},
912907
iris.fileformats.grib._load_convert.convert, None)
913908
else:
909+
if auto_regularise is not None:
910+
# The old loader supports the auto_regularise keyword, but in
911+
# deprecation mode, so warning if it is found.
912+
warnings.warn('the`auto_regularise` kwarg is deprecated and '
913+
'will be removed in a future release. Resampling '
914+
'quasi-regular grids on load will no longer be '
915+
'available. Resampling should be done on the '
916+
'loaded cube instead using Cube.regrid.')
917+
914918
grib_loader = iris.fileformats.rules.Loader(
915919
grib_generator, {'auto_regularise': auto_regularise},
916920
iris.fileformats.grib.load_rules.convert,

0 commit comments

Comments
 (0)