v2.0 (14 Feb 2018)¶
This document explains the changes made to Iris for this release (View all changes.)
Features¶
Dask Integration
The use of Biggus to provide support for virtual arrays and lazy evaluation within Iris has been replaced with Dask.
In addition the concept of lazy data, already used for the
Cube data component, has now been extended to the
data arrays of a Coord and an
AuxCoordFactory.
This is a major feature enhancement, allowing Iris to leverage dask’s rich functionality and community knowledge.
In particular, Dask’s threaded, multiprocessing or distributed schedulers can be used in order to best utilise available compute and memory resource. For further details, see Real and Lazy Data.
Changes to the
iris.cube.Cube:The new
core_data()method returns the real or lazyCubedata.The new in-place arithmetic operators
__iadd__,__idiv__,__imul__,__isub__, and__itruediv__have been added to supportCubeoperations+=,/=,*=, and-=. Note that, for divison __future__.division is always in effect.
Changes to the
iris.coords.Coord:The new
bounds_dtypeproperty (read-only) provides thedtypeof the coordinate bounds, if they exist.The new
core_points()andcore_bounds()methods return the real or lazyCoordpointsandboundsdata, respectively.The new
has_lazy_points()andhas_lazy_bounds()boolean methods return whether the coordinate has lazypointsand lazyboundsdata, respectively.The new
lazy_points()andlazy_bounds()methods return lazy representations of the coordinatepointsandboundsdata, respectively.
The iris.FUTURE has Arrived!¶
Throughout version 1 of Iris a set of toggles in
iris.FUTURE were maintained. These toggles allowed certain “future”
behaviour to be enabled. Since the future has now arrived in Iris 2,
all existing toggles in iris.FUTURE now default to True.
iris.Future.cell_datetime_objects
Use of this FUTURE toggle is now deprecated.
iris.coords.Cellobjects in time coordinates now contain datetime objects by default and not numbers. For example:>>> cube = iris.load_cube(iris.sample_data_path('air_temp.pp')) >>> print(cube.coord('time').cell(0).point) 1998-12-01 00:00:00 This change particularly impacts constraining datasets on time. All time constraints must now be constructed with datetime objects or :class:`~iris.time.PartialDateTime` objects. See userguide section 2.2.1 for more details on producing time constraints.
iris.Future.netcdf_promote
Use of this FUTURE toggle is now deprecated.
Removed deprecated behaviour that does not automatically promote NetCDF variables to cubes. This change means that NetCDF variables that define reference surfaces for dimensionless vertical coordinates will always be promoted and loaded as independent cubes.
iris.Future.netcdf_no_unlimited
Use of this FUTURE toggle is now deprecated.
Removed deprecated behaviour that automatically set the length of the outer netCDF variable to ‘UNLIMITED’ on save. This change means that no cube dimension coordinates will be automatically saved as netCDF variables with ‘UNLIMITED’ length.
You can manually specify cube dimension coordinates to save with ‘UNLIMITED’ length. For example:
>>> iris.save(my_cube, 'my_result_file.nc', unlimited_dimensions=['latitude'])
iris.Future.clip_latitudes
Use of this FUTURE toggle is now deprecated.
The
iris.coords.Coord.guess_bounds()now limits the guessed bounds to [-90, 90] for latitudes by default. The ability to turn this behaviour off is now deprecated.
Bugs Fixed¶
Indexing or slicing an
AuxCoordcoordinate will return a coordinate withpointsandboundsdata that are new copied arrays, rather than views onto those of the original parent coordinate.Indexing or slicing a cell measure will return a new cell measure with
datathat is a new copied array, rather than a view onto the original parent cell measure.Performing an in-place arithmetic
add(),divide(),multiply(), orsubtract()operation on aCubewithintegerorbooleandata with afloatresult will raise anArithmeticErrorexception.Lazy data now refers to absolute paths rather than preserving the form that was passed to iris.load functions. This means that it is possible to use relative paths at load, change working directory, and still expect to be able to load any un-loaded/lazy data. (#2325)
The order in which files are passed to iris.load functions is now the order in which they are processed. (#2325)
Loading from netCDF files with
iris.load()will load a cube for each scalar variable, a variable that does not reference a netCDF dimension, unless that scalar variable is identified as a CF scalar coordinate, referenced from another data variable via the ‘coordinates’ attribute. Previously such data variables were ignored during load.
Incompatible Changes¶
The
lazy_data()method no longer accepts any arguments. Setting lazy data should now be done withcube.data.
Significant Changes in Calculated Results
Due to the replacement of Biggus with Dask, as described above, the results of certain types of calculation may have significantly different values from those obtained in earlier versions. This is of a much greater order than the usual small changes in floating point results : it applies especially to any data with masked points, or of long integer types.
Due to concerns regarding maintainability and API consistency the
iris.cube.Cube.share_dataflag introduced in v1.13 has been removed. Intra-cube data sharing is a oft-requested feature that we will be targeting in a future Iris release.Using
convert_units()on a cube with unknown units will now result in aUnitConversionErrorbeing raised.iris.fileformats.pp_ruleshas been renamed toiris.fileformats.pp_load_rulesfor consistency with the newiris.fileformats.pp_save_rules.Fill values are no longer taken from the cube’s data attribute when it is a masked array.
When saving a cube or list of cubes in NetCDF format, a fill value or list of fill values can be specified via a new fill_value argument. If a list is supplied, each fill value will be applied to each cube in turn. If a fill_value argument is not specified, the default fill value for the file format and the cube’s data type will be used.
When saving to PP, the “standard” BMDI of -1e30 is now always applied in
PPFieldgeneration. To save PP data with an alternative BMDI, useiris.fileformats.pp.save_pairs_from_cube()to generatePPFields, and modify these before saving them to file.A ‘fill_value’ key can no longer be specified as part of the packing argument to iris.save when saving in netCDF format. Instead, a fill value or list of fill values should be specified as a separate fill_value argument if required.
If the packing argument to iris.save is a dictionary, an error is raised if it contains any keys other than ‘dtype’, ‘scale_factor’ and ‘add_offset’.
The deprecated
iris.fileformats.gribwas removed. All Iris GRIB functionality is now delivered throughiris-grib.In Iris v1 it was possible to configure Iris to log at import time through iris.config.LOGGING. This capability has been removed in Iris v2.
When coordinates have no well defined plot axis,
iris.plotandiris.quickplotroutines now use the order of the cube’s dimensions to determine the coordinates to plot as the x and y axis of a plot.The cf_units dependency version has been updated to v1.2.0, which prints shorter unit strings. For example, the unit
meter-second^-1is now printed asm.s-1.
Deprecation¶
All deprecated functionality that was announced for removal in Iris 2.0 has been removed. In particular:
The deprecated keyword arguments
coordandnamehave been removed from theiris.cube.Cubeconstructor.The deprecated methods
iris.cube.Cube.add_history,iris.cube.Cube.assert_validandiris.cube.Cube.regriddedhave been removed fromiris.cube.Cube.The deprecated module
iris.fileformats.pp_packinghas been removed.The deprecated module
iris.proxyhas been removed.The deprecated configuration variable
SAMPLE_DATA_DIRhas been removed fromiris.configin favour of user installation of theiris-sample-datapackage.The deprecated module
iris.unithas been removed in favour ofcf_units.The
BitwiseIntclass has been removed fromiris.fileformats.pp.Removed deprecated functions
reset_load_rules,add_save_rules,reset_save_rulesandas_pairsfromiris.fileformats.pp.The deprecated module
iris.analysis.interpolatehas been removed, along with the following deprecated classes and functions:iris.analysis.interpolate.lineariris.analysis.interpolate.nearest_neighbour_data_valueiris.analysis.interpolate.regridiris.analysis.interpolate.regrid_to_max_resolutioniris.analysis.interpolate.extract_nearest_neighbouriris.analysis.interpolate.nearest_neighbour_indicesiris.analysis.interpolate.Linear1dExtrapolator
Removed deprecated module
iris.experimental.fieldsfile. Note that there is no direct replacement for:meth:iris.experimental.fieldsfile.load, which specifically performed fast loading from _either_ PP or FF files. Instead, please use the :meth:iris.fileformats.um.structured_um_loading context manager, and within that context call :meth:iris.load, or the format-specific :meth:iris.fileformats.pp.load_cubes or :meth:iris.fileformats.um.load_cubes.Removed deprecated module
iris.fileformats.ff. Please use facilities iniris.fileformats.uminstead.- Removed deprecated and unused kwarg
ignorefrom the following functions:
- Removed deprecated and unused kwarg
Deprecated functions
iris.util.broadcast_weights,iris.util.ensure_arrayandiris.util.timershave been removed fromiris.util.The following classes and functions have been removed from
iris.fileformats.rules:iris.fileformat.rules.calculate_forecast_periodiris.fileformat.rules.logiris.fileformat.rules.CMAttributeiris.fileformat.rules.CMCustomAttributeiris.fileformat.rules.CoordAndDimsiris.fileformat.rules.DebugStringiris.fileformat.rules.FunctionRuleiris.fileformat.rules.ProcedureRuleiris.fileformat.rules.Ruleiris.fileformat.rules.RulesContaineriris.fileformat.rules.RuleResult
In addition the deprecated keyword argument
legacy_custom_ruleshas been removed from theiris.fileformats.rules.Loaderconstructor.
Documentation¶
A new UserGuide chapter on Real and Lazy Data has been added, and referenced from key points in the User Guide .