What’s New#
v2024.09.0 (Sept 11, 2024)#
This release drops support for Python 3.9, and adds support for grouping by multiple arrays, while providing numerous performance improvements and bug fixes.
Thanks to the 33 contributors to this release: Alfonso Ladino, Andrew Scherer, Anurag Nayak, David Hoese, Deepak Cherian, Diogo Teles Sant’Anna, Dom, Elliott Sales de Andrade, Eni, Holly Mandel, Illviljan, Jack Kelly, Julius Busecke, Justus Magin, Kai Mühlbauer, Manish Kumar Gupta, Matt Savoie, Maximilian Roos, Michele Claus, Miguel Jimenez, Niclas Rieger, Pascal Bourgault, Philip Chmielowiec, Spencer Clark, Stephan Hoyer, Tao Xin, Tiago Sanona, TimothyCera-NOAA, Tom Nicholas, Tom White, Virgile Andreani, oliverhiggs and tiago
New Features#
Add
days_in_year
anddecimal_year
to theDatetimeAccessor
onxr.DataArray
. (PR9105). By Pascal Bourgault.
Performance#
Make chunk manager an option in
set_options
(PR9362). By Tom White.Support for grouping by multiple variables. This is quite new, so please check your results and report bugs. Binary operations after grouping by multiple arrays are not supported yet. (GH1056, GH9332, GH324, PR9372). By Deepak Cherian.
Allow data variable specific
constant_values
in the datasetpad
function (PR9353`). By Tiago Sanona.Speed up grouping by avoiding deep-copy of non-dimension coordinates (GH9426, PR9393) By Deepak Cherian.
Breaking changes#
Support for
python 3.9
has been dropped (PR8937)The minimum versions of some dependencies were changed
Package
Old
New
boto3
1.26
1.28
cartopy
0.21
0.22
dask-core
2023.4
2023.9
distributed
2023.4
2023.9
h5netcdf
1.1
1.2
iris
3.4
3.7
numba
0.56
0.57
numpy
1.23
1.24
pandas
2.0
2.1
scipy
1.10
1.11
typing_extensions
4.5
4.7
zarr
2.14
2.16
Bug fixes#
Fix bug with rechunking to a frequency when some periods contain no data (GH9360). By Deepak Cherian.
Fix bug causing DataTree.from_dict to be sensitive to insertion order (GH9276, PR9292). By Tom Nicholas.
Fix resampling error with monthly, quarterly, or yearly frequencies with cftime when the time bins straddle the date “0001-01-01”. For example, this can happen in certain circumstances when the time coordinate contains the date “0001-01-01”. (GH9108, PR9116) By Spencer Clark and Deepak Cherian.
Fix issue with passing parameters to ZarrStore.open_store when opening datatree in zarr format (GH9376, PR9377). By Alfonso Ladino
Fix deprecation warning that was raised when calling
np.array
on anxr.DataArray
in NumPy 2.0 (GH9312, PR9393) By Andrew Scherer.Fix support for using
pandas.DateOffset
,pandas.Timedelta
, anddatetime.timedelta
objects asresample
frequencies (GH9408, PR9413). By Oliver Higgs.
Internal Changes#
Re-enable testing
pydap
backend withnumpy>=2
(PR9391). By Miguel Jimenez .
v2024.07.0 (Jul 30, 2024)#
This release extends the API for groupby operations with various grouper objects <groupby.groupers_>, and includes improvements to the documentation and numerous bugfixes.
Thanks to the 22 contributors to this release: Alfonso Ladino, ChrisCleaner, David Hoese, Deepak Cherian, Dieter Werthmüller, Illviljan, Jessica Scheick, Joel Jaeschke, Justus Magin, K. Arthur Endsley, Kai Mühlbauer, Mark Harfouche, Martin Raspaud, Mathijs Verhaegh, Maximilian Roos, Michael Niklas, Michał Górny, Moritz Schreiber, Pontus Lurcock, Spencer Clark, Stephan Hoyer and Tom Nicholas
New Features#
Use fastpath when grouping both montonically increasing and decreasing variable in
GroupBy
(GH6220, PR7427). By Joel Jaeschke.Introduce new
groupers.UniqueGrouper
,groupers.BinGrouper
, andgroupers.TimeResampler
objects as a step towards supporting grouping by multiple variables. See the docs <groupby.groupers_> and the grouper design doc for more. (GH6610, PR8840). By Deepak Cherian.Allow rechunking to a frequency using
Dataset.chunk(time=TimeResampler("YE"))
syntax. (GH7559, PR9109) Such rechunking allows many time domain analyses to be executed in an embarrassingly parallel fashion. By Deepak Cherian.Allow per-variable specification of
`mask_and_scale
,decode_times
,decode_timedelta
use_cftime
andconcat_characters
params inopen_dataset()
(PR9218). By Mathijs Verhaegh.Allow chunking for arrays with duplicated dimension names (GH8759, PR9099). By Martin Raspaud.
Extract the source url from fsspec objects (GH9142, PR8923). By Justus Magin.
Add
DataArray.drop_attrs()
&Dataset.drop_attrs()
methods, to return an object withoutattrs
. Adeep
parameter controls whether variables’attrs
are also dropped. By Maximilian Roos. (PR8288) By Eni Awowale.Add open_groups method for unaligned datasets (GH9137, PR9243)
Breaking changes#
The
base
andloffset
parameters toDataset.resample()
andDataArray.resample()
are now removed. These parameters have been deprecated since v2023.03.0. Using theorigin
oroffset
parameters is recommended as a replacement for using thebase
parameter and using time offset arithmetic is recommended as a replacement for using theloffset
parameter. (PR9233) By Deepak Cherian.The
squeeze
kwarg togroupby
is now ignored. This has been the source of some quite confusing behaviour and has been deprecated since v2024.01.0. groupby` behavior is now always consistent with the existing.groupby(..., squeeze=False)
behavior. No errors will be raised if squeeze=False. (PR9280) By Deepak Cherian.
Bug fixes#
Fix scatter plot broadcasting unnecessarily. (GH9129, PR9206) By Jimmy Westling.
Don’t convert custom indexes to
pandas
indexes when computing a diff (PR9157) By Justus Magin.Make
testing.assert_allclose()
work with numpy 2.0 (GH9165, PR9166). By Pontus Lurcock.Allow diffing objects with array attributes on variables (GH9153, PR9169). By Justus Magin.
numpy>=2
compatibility in thenetcdf4
backend (PR9136). By Justus Magin and Kai Mühlbauer.Promote floating-point numeric datetimes before decoding (GH9179, PR9182). By Justus Magin.
Address regression introduced in PR9002 that prevented objects returned by py:meth:DataArray.convert_calendar to be indexed by a time index in certain circumstances (GH9138, PR9192). By Mark Harfouche and Spencer Clark.
Fix static typing of tolerance arguments by allowing str type (GH8892, PR9194). By Michael Niklas.
Dark themes are now properly detected for
html[data-theme=dark]
-tags (PR9200). By Dieter Werthmüller.Reductions no longer fail for
np.complex_
dtype arrays when numbagg is installed. (PR9210) By Maximilian Roos.
Documentation#
Adds intro to backend section of docs, including a flow-chart to navigate types of backends (PR9175). By Jessica Scheick.
Adds a flow-chart diagram to help users navigate help resources (D8990, PR9147). By Jessica Scheick.
Improvements to Zarr & chunking docs (PR9139, PR9140, PR9132) By Maximilian Roos.
Fix copybutton for multi line examples and double digit ipython cell numbers (PR9264). By Moritz Schreiber.
Internal Changes#
Enable typing checks of pandas (PR9213). By Michael Niklas.
v2024.06.0 (Jun 13, 2024)#
This release brings various performance optimizations and compatibility with the upcoming numpy 2.0 release.
Thanks to the 22 contributors to this release: Alfonso Ladino, David Hoese, Deepak Cherian, Eni Awowale, Ilan Gold, Jessica Scheick, Joe Hamman, Justus Magin, Kai Mühlbauer, Mark Harfouche, Mathias Hauser, Matt Savoie, Maximilian Roos, Mike Thramann, Nicolas Karasiak, Owen Littlejohns, Paul Ockenfuß, Philippe THOMY, Scott Henderson, Spencer Clark, Stephan Hoyer and Tom Nicholas
Performance#
Small optimization to the netCDF4 and h5netcdf backends (GH9058, PR9067). By Deepak Cherian.
Small optimizations to help reduce indexing speed of datasets (PR9002). By Mark Harfouche.
Performance improvement in open_datatree method for Zarr, netCDF4 and h5netcdf backends (GH8994, PR9014). By Alfonso Ladino.
Bug fixes#
Preserve conversion of timezone-aware pandas Datetime arrays to numpy object arrays (GH9026, PR9042). By Ilan Gold.
DataArrayResample.interpolate()
andDatasetResample.interpolate()
method now support arbitrary kwargs such asorder
for polynomial interpolation (GH8762). By Nicolas Karasiak.
Documentation#
Add link to CF Conventions on packed data and sentence on type determination in the I/O user guide (GH9041, PR9045). By Kai Mühlbauer.
Internal Changes#
Migrates remainder of
io.py
toxarray/core/datatree_io.py
andTreeAttrAccessMixin
intoxarray/core/common.py
(PR9011). By Owen Littlejohns and Tom Nicholas.Compatibility with numpy 2 (GH8844, PR8854, PR8946). By Justus Magin and Stephan Hoyer.
v2024.05.0 (May 12, 2024)#
This release brings support for pandas ExtensionArray objects, optimizations when reading Zarr, the ability to concatenate datasets without pandas indexes,
more compatibility fixes for the upcoming numpy 2.0, and the migration of most of the xarray-datatree project code into xarray main
!
Thanks to the 18 contributors to this release: Aimilios Tsouvelekakis, Andrey Akinshin, Deepak Cherian, Eni Awowale, Ilan Gold, Illviljan, Justus Magin, Mark Harfouche, Matt Savoie, Maximilian Roos, Noah C. Benson, Pascal Bourgault, Ray Bell, Spencer Clark, Tom Nicholas, ignamv, owenlittlejohns, and saschahofmann.
New Features#
New “random” method for converting to and from 360_day calendars (PR8603). By Pascal Bourgault.
Xarray now makes a best attempt not to coerce
pandas.api.extensions.ExtensionArray
to a numpy array by supporting 1DExtensionArray
objects internally where possible. Thus,Dataset
objects initialized with apd.Categorical
, for example, will retain the object. However, one cannot do operations that are not possible on theExtensionArray
then, such as broadcasting. (GH5287, GH8463, PR8723) By Ilan Gold.testing.assert_allclose()
/testing.assert_equal()
now accept a new argument check_dims=”transpose”, controlling whether a transposed array is considered equal. (GH5733, PR8991) By Ignacio Martinez Vazquez.Added the option to avoid automatically creating 1D pandas indexes in
Dataset.expand_dims()
, by passing the new kwarg create_index_for_new_dim=False. (PR8960) By Tom Nicholas.Avoid automatically re-creating 1D pandas indexes in
concat()
. Also added option to avoid creating 1D indexes for new dimension coordinates by passing the new kwarg create_index_for_new_dim=False. (GH8871, PR8872) By Tom Nicholas.
Breaking changes#
The PyNIO backend has been deleted (GH4491, PR7301). By Deepak Cherian.
The minimum versions of some dependencies were changed, in particular our minimum supported pandas version is now Pandas 2.
Package
Old
New
dask-core
2022.12
2023.4
distributed
2022.12
2023.4
h5py
3.7
3.8
matplotlib-base
3.6
3.7
packaging
22.0
23.1
pandas
1.5
2.0
pydap
3.3
3.4
sparse
0.13
0.14
typing_extensions
4.4
4.5
zarr
2.13
2.14
Bug fixes#
Following an upstream bug fix to
pandas.date_range()
, date ranges produced byxarray.cftime_range()
with negative frequencies will now fall fully within the bounds of the provided start and end dates (PR8999). By Spencer Clark.
Internal Changes#
Enforces failures on CI when tests raise warnings from within xarray (PR8974) By Maximilian Roos
Migrates
formatting_html
functionality forDataTree
intoxarray/core
(:pull: 8930) By Eni Awowale, Julia Signell and Tom Nicholas.Migrates
datatree_mapping
functionality intoxarray/core
(PR8948) By Matt Savoie Owen Littlejohns and Tom Nicholas.Migrates
extensions
,formatting
anddatatree_render
functionality forDataTree
intoxarray/core
. Also migratestesting
functionality intoxarray/testing/assertions
forDataTree
. (PR8967) By Owen Littlejohns and Tom Nicholas.Migrates
ops.py
functionality intoxarray/core/datatree_ops.py
(PR8976) By Matt Savoie and Tom Nicholas.Migrates
iterator
functionality intoxarray/core
(:pull: 8879) By Owen Littlejohns, Matt Savoie and Tom Nicholas.transpose
,set_dims
,stack
&unstack
now use adim
kwarg rather thandims
ordimensions
. This is the final change to make xarray methods consistent with their use ofdim
. Using the existing kwarg will raise a warning. By Maximilian Roos
v2024.03.0 (Mar 29, 2024)#
This release brings performance improvements for grouped and resampled quantile calculations, CF decoding improvements, minor optimizations to distributed Zarr writes, and compatibility fixes for Numpy 2.0 and Pandas 3.0.
Thanks to the 18 contributors to this release: Anderson Banihirwe, Christoph Hasse, Deepak Cherian, Etienne Schalk, Justus Magin, Kai Mühlbauer, Kevin Schwarzwald, Mark Harfouche, Martin, Matt Savoie, Maximilian Roos, Ray Bell, Roberto Chang, Spencer Clark, Tom Nicholas, crusaderky, owenlittlejohns, saschahofmann
New Features#
Partial writes to existing chunks with
region
orappend_dim
will now raise an error (unlesssafe_chunks=False
); previously an error would only be raised on new variables. (PR8459, GH8371, GH8882) By Maximilian Roos.Grouped and resampling quantile calculations now use the vectorized algorithm in
flox>=0.9.4
if present. By Deepak Cherian.Do not broadcast in arithmetic operations when global option
arithmetic_broadcast=False
(GH6806, PR8784). By Etienne Schalk and Deepak Cherian.Add the
.oindex
property to Explicitly Indexed Arrays for orthogonal indexing functionality. (GH8238, PR8750) By Anderson Banihirwe.Add the
.vindex
property to Explicitly Indexed Arrays for vectorized indexing functionality. (GH8238, PR8780) By Anderson Banihirwe.Expand use of
.oindex
and.vindex
properties. (:pull: 8790) By Anderson Banihirwe and Deepak Cherian.Allow creating
xr.Coordinates
objects with no indexes (PR8711) By Benoit Bovy and Tom Nicholas.Enable plotting of
datetime.dates
. (GH8866, PR8873) By Sascha Hofmann.
Breaking changes#
Don’t allow overwriting index variables with
to_zarr
region writes. (GH8589, PR8876). By Deepak Cherian.
Bug fixes#
The default
freq
parameter inxr.date_range()
andxr.cftime_range()
is set to'D'
only ifperiods
,start
, orend
areNone
(GH8770, PR8774). By Roberto Chang.Ensure that non-nanosecond precision
numpy.datetime64
andnumpy.timedelta64
values are cast to nanosecond precision values when used inDataArray.expand_dims()
and :Dataset.expand_dims()
(PR8781). By Spencer Clark.CF conform handling of _FillValue/missing_value and dtype in CFMaskCoder/CFScaleOffsetCoder (GH2304, GH5597, GH7691, PR8713, see also discussion in PR7654). By Kai Mühlbauer.
Do not cast _FillValue/missing_value in CFMaskCoder if _Unsigned is provided (GH8844, PR8852).
Adapt handling of copy keyword argument for numpy >= 2.0dev (GH8844, PR8851, PR8865). By Kai Mühlbauer.
Import trapz/trapezoid depending on numpy version (GH8844, PR8865). By Kai Mühlbauer.
Warn and return bytes undecoded in case of UnicodeDecodeError in h5netcdf-backend (GH5563, PR8874). By Kai Mühlbauer.
Fix bug incorrectly disallowing creation of a dataset with a multidimensional coordinate variable with the same name as one of its dims. (GH8884, PR8886) By Tom Nicholas.
Internal Changes#
Migrates
treenode
functionality intoxarray/core
(PR8757) By Matt Savoie and Tom Nicholas.Migrates
datatree
functionality intoxarray/core
. (:pull: 8789) By Owen Littlejohns, Matt Savoie and Tom Nicholas.
v2024.02.0 (Feb 19, 2024)#
This release brings size information to the text repr
, changes to the accepted frequency
strings, and various bug fixes.
Thanks to our 12 contributors:
Anderson Banihirwe, Deepak Cherian, Eivind Jahren, Etienne Schalk, Justus Magin, Marco Wolsza, Mathias Hauser, Matt Savoie, Maximilian Roos, Rambaud Pierrick, Tom Nicholas
New Features#
Added a simple
nbytes
representation in DataArrays and Datasetrepr
. (GH8690, PR8702). By Etienne Schalk.Allow negative frequency strings (e.g.
"-1YE"
). These strings are for example used indate_range()
, andcftime_range()
(PR8651). By Mathias Hauser.Add
NamedArray.expand_dims()
,NamedArray.permute_dims()
andNamedArray.broadcast_to()
(PR8380) By Anderson Banihirwe.Xarray now defers to flox’s heuristics to set the default method for groupby problems. This only applies to
flox>=0.9
. By Deepak Cherian.All quantile methods (e.g.
DataArray.quantile()
) now use numbagg for the calculation of nanquantiles (i.e., skipna=True) if it is installed. This is currently limited to the linear interpolation method (method=’linear’). (GH7377, PR8684) By Marco Wolsza.
Breaking changes#
infer_freq()
always returns the frequency strings as defined in pandas 2.2 (GH8612, PR8627). By Mathias Hauser.
Deprecations#
The dt.weekday_name parameter wasn’t functional on modern pandas versions and has been removed. (GH8610, PR8664) By Sam Coleman.
Bug fixes#
Fixed a regression that prevented multi-index level coordinates being serialized after resetting or dropping the multi-index (GH8628, PR8672). By Benoit Bovy.
Fix bug with broadcasting when wrapping array API-compliant classes. (GH8665, PR8669) By Tom Nicholas.
Ensure
DataArray.unstack()
works when wrapping array API-compliant classes. (GH8666, PR8668) By Tom Nicholas.Fix negative slicing of Zarr arrays without dask installed. (GH8252) By Deepak Cherian.
Preserve chunks when writing time-like variables to zarr by enabling lazy CF encoding of time-like variables (GH7132, GH8230, GH8432, PR8575). By Spencer Clark and Mattia Almansi.
Preserve chunks when writing time-like variables to zarr by enabling their lazy encoding (GH7132, GH8230, GH8432, PR8253, PR8575; see also discussion in PR8253). By Spencer Clark and Mattia Almansi.
Raise an informative error if dtype encoding of time-like variables would lead to integer overflow or unsafe conversion from floating point to integer values (GH8542, PR8575). By Spencer Clark.
Raise an error when unstacking a MultiIndex that has duplicates as this would lead to silent data loss (GH7104, PR8737). By Mathias Hauser.
Documentation#
Fix variables arg typo in Dataset.sortby() docstring (GH8663, PR8670) By Tom Vo.
Fixed documentation where the use of the depreciated pandas frequency string prevented the documentation from being built. (PR8638) By Sam Coleman.
Internal Changes#
DataArray.dt
now raises anAttributeError
rather than aTypeError
when the data isn’t datetime-like. (GH8718, PR8724) By Maximilian Roos.Move
parallelcompat
andchunk managers
modules fromxarray/core
toxarray/namedarray
. (PR8319) By Tom Nicholas and Anderson Banihirwe.Imports
datatree
repository and history into internal location. (PR8688) By Matt Savoie, Justus Magin and Tom Nicholas.Adds
open_datatree()
intoxarray/backends
(PR8697) By Matt Savoie and Tom Nicholas.Refactor
xarray.core.indexing.DaskIndexingAdapter.__getitem__()
to remove an unnecessary rewrite of the indexer key (:issue: 8377, PR8758) By Anderson Banihirwe.
v2024.01.1 (23 Jan, 2024)#
This release is to fix a bug with the rendering of the documentation, but it also includes changes to the handling of pandas frequency strings.
Breaking changes#
Following pandas,
infer_freq()
will return"YE"
, instead of"Y"
(formerly"A"
). This is to be consistent with the deprecation of the latter frequency string in pandas 2.2. This is a follow up to PR8415 (GH8612, PR8642). By Mathias Hauser.
Deprecations#
Following pandas, the frequency string
"Y"
(formerly"A"
) is deprecated in favor of"YE"
. These strings are used, for example, indate_range()
,cftime_range()
,DataArray.resample()
, andDataset.resample()
among others (GH8612, PR8629). By Mathias Hauser.
Documentation#
Pin
sphinx-book-theme
to1.0.1
to fix a rendering issue with the sidebar in the docs. (GH8619, PR8632) By Tom Nicholas.
v2024.01.0 (17 Jan, 2024)#
This release brings support for weights in correlation and covariance functions, a new DataArray.cumulative aggregation, improvements to xr.map_blocks, an update to our minimum dependencies, and various bugfixes.
Thanks to our 17 contributors to this release:
Abel Aoun, Deepak Cherian, Illviljan, Johan Mathe, Justus Magin, Kai Mühlbauer, Llorenç Lledó, Mark Harfouche, Markel, Mathias Hauser, Maximilian Roos, Michael Niklas, Niclas Rieger, Sébastien Celles, Tom Nicholas, Trinh Quoc Anh, and crusaderky.
New Features#
xr.cov()
andxr.corr()
now support using weights (GH8527, PR7392). By Llorenç Lledó.Accept the compression arguments new in netCDF 1.6.0 in the netCDF4 backend. See netCDF4 documentation for details. Note that some new compression filters needs plugins to be installed which may not be available in all netCDF distributions. By Markel García-Díez. (GH6929, PR7551)
Add
DataArray.cumulative()
&Dataset.cumulative()
to compute cumulative aggregations, such assum
, along a dimension — for exampleda.cumulative('time').sum()
. This is similar to pandas’.expanding
, and mostly equivalent to.cumsum
methods, or toDataArray.rolling()
with a window length equal to the dimension size. By Maximilian Roos. (PR8512)Decode/Encode netCDF4 enums and store the enum definition in dataarrays’ dtype metadata. If multiple variables share the same enum in netCDF4, each dataarray will have its own enum definition in their respective dtype metadata. By Abel Aoun. (GH8144, PR8147)
Breaking changes#
The minimum versions of some dependencies were changed (PR8586):
Package
Old
New
cartopy
0.20
0.21
dask-core
2022.7
2022.12
distributed
2022.7
2022.12
flox
0.5
0.7
iris
3.2
3.4
matplotlib-base
3.5
3.6
numpy
1.22
1.23
numba
0.55
0.56
packaging
21.3
22.0
seaborn
0.11
0.12
scipy
1.8
1.10
typing_extensions
4.3
4.4
zarr
2.12
2.13
Deprecations#
The squeeze kwarg to GroupBy is now deprecated. (GH2157, PR8507) By Deepak Cherian.
Bug fixes#
Support non-string hashable dimensions in
xarray.DataArray
(GH8546, PR8559). By Michael Niklas.Reverse index output of bottleneck’s rolling move_argmax/move_argmin functions (GH8541, PR8552). By Kai Mühlbauer.
Vendor SerializableLock from dask and use as default lock for netcdf4 backends (GH8442, PR8571). By Kai Mühlbauer.
Add tests and fixes for empty
CFTimeIndex
, including broken html repr (GH7298, PR8600). By Mathias Hauser.
Internal Changes#
The implementation of
map_blocks()
has changed to minimize graph size and duplication of data. This should be a strict improvement even though the graphs are not always embarrassingly parallel any more. Please open an issue if you spot a regression. (PR8412, GH8409). By Deepak Cherian.Remove null values before plotting. (PR8535). By Jimmy Westling.
Redirect cumulative reduction functions internally through the
ChunkManagerEntryPoint
, potentially allowingffill()
andbfill()
to use non-dask chunked array types. (PR8019) By Tom Nicholas.
v2023.12.0 (2023 Dec 08)#
This release brings new hypothesis strategies for testing, significantly faster rolling aggregations as well as
ffill
and bfill
with numbagg
, a new Dataset.eval()
method, and improvements to
reading and writing Zarr arrays (including a new "a-"
mode).
Thanks to our 16 contributors:
Anderson Banihirwe, Ben Mares, Carl Andersson, Deepak Cherian, Doug Latornell, Gregorio L. Trevisan, Illviljan, Jens Hedegaard Nielsen, Justus Magin, Mathias Hauser, Max Jones, Maximilian Roos, Michael Niklas, Patrick Hoefler, Ryan Abernathey, Tom Nicholas
New Features#
Added hypothesis strategies for generating
xarray.Variable
objects containing arbitrary data, useful for parametrizing downstream tests. Accessible undertesting.strategies
, and documented in a new page on testing in the User Guide. (GH6911, PR8404) By Tom Nicholas.rolling()
uses numbagg for most of its computations by default. Numbagg is up to 5x faster than bottleneck where parallelization is possible. Where parallelization isn’t possible — for example a 1D array — it’s about the same speed as bottleneck, and 2-5x faster than pandas’ default functions. (PR8493). numbagg is an optional dependency, so requires installing separately.Use a concise format when plotting datetime arrays. (PR8449). By Jimmy Westling.
Avoid overwriting unchanged existing coordinate variables when appending with
Dataset.to_zarr()
by settingmode='a-'
. By Ryan Abernathey and Deepak Cherian.rank()
now operates on dask-backed arrays, assuming the core dim has exactly one chunk. (PR8475). By Maximilian Roos.Add a
Dataset.eval()
method, similar to the pandas’ method of the same name. (PR7163). This is currently marked as experimental and doesn’t yet support thenumexpr
engine.Dataset.drop_vars()
&DataArray.drop_vars()
allow passing a callable, similar toDataset.where()
&Dataset.sortby()
& others. (PR8511). By Maximilian Roos.
Breaking changes#
Explicitly warn when creating xarray objects with repeated dimension names. Such objects will also now raise when
DataArray.get_axis_num()
is called, which means many functions will raise. This latter change is technically a breaking change, but whilst allowed, this behaviour was never actually supported! (GH3731, PR8491) By Tom Nicholas.
Deprecations#
As part of an effort to standardize the API, we’re renaming the
dims
keyword arg todim
for the minority of functions which current usedims
. This started withxarray.dot()
&DataArray.dot()
and we’ll gradually roll this out across all functions. The warnings are currentlyPendingDeprecationWarning
, which are silenced by default. We’ll convert these toDeprecationWarning
in a future release. By Maximilian Roos.Raise a
FutureWarning
warning that the type ofDataset.dims()
will be changed from a mapping of dimension names to lengths to a set of dimension names. This is to increase consistency withDataArray.dims()
. To access a mapping of dimension names to lengths please useDataset.sizes()
. The same change also applies to DatasetGroupBy.dims. (GH8496, PR8500) By Tom Nicholas.Dataset.drop()
&DataArray.drop()
are now deprecated, since pending deprecation for several years.DataArray.drop_sel()
&DataArray.drop_var()
replace them for labels & variables respectively. (PR8497) By Maximilian Roos.
Bug fixes#
Fix dtype inference for
pd.CategoricalIndex
when categories are backed by apd.ExtensionDtype
(PR8481)Fix writing a variable that requires transposing when not writing to a region (PR8484) By Maximilian Roos.
Static typing of
p0
andbounds
arguments ofxarray.DataArray.curvefit()
andxarray.Dataset.curvefit()
was changed toMapping
(PR8502). By Michael Niklas.Fix typing of
xarray.DataArray.to_netcdf()
andxarray.Dataset.to_netcdf()
whencompute
is evaluated to bool instead of a Literal (PR8268). By Jens Hedegaard Nielsen.
Documentation#
Added illustration of updating the time coordinate values of a resampled dataset using time offset arithmetic. This is the recommended technique to replace the use of the deprecated
loffset
parameter inresample
(PR8479). By Doug Latornell.Improved error message when attempting to get a variable which doesn’t exist from a Dataset. (PR8474) By Maximilian Roos.
Fix default value of
combine_attrs
inxarray.combine_by_coords()
(PR8471) By Gregorio L. Trevisan.
Internal Changes#
DataArray.bfill()
&DataArray.ffill()
now use numbagg <numbagg/numbagg>`_ by default, which is up to 5x faster where parallelization is possible. (PR8339) By Maximilian Roos.Update mypy version to 1.7 (GH8448, PR8501). By Michael Niklas.
v2023.11.0 (Nov 16, 2023)#
Tip
This is our 10th year anniversary release! Thank you for your love and support.
This release brings the ability to use opt_einsum
for xarray.dot()
by default,
support for auto-detecting region
when writing partial datasets to Zarr, and the use of h5py
drivers with h5netcdf
.
Thanks to the 19 contributors to this release: Aman Bagrecha, Anderson Banihirwe, Ben Mares, Deepak Cherian, Dimitri Papadopoulos Orfanos, Ezequiel Cimadevilla Alvarez, Illviljan, Justus Magin, Katelyn FitzGerald, Kai Muehlbauer, Martin Durant, Maximilian Roos, Metamess, Sam Levang, Spencer Clark, Tom Nicholas, mgunyho, templiert
New Features#
Use opt_einsum for
xarray.dot()
by default if installed. By Deepak Cherian. (GH7764, PR8373).Add
DataArray.dt.total_seconds()
method to match the Pandas API. (PR8435). By Ben Mares.Allow passing
region="auto"
inDataset.to_zarr()
to automatically infer the region to write in the original store. Also implement automatic transpose when dimension order does not match the original store. (GH7702, GH8421, PR8434). By Sam Levang.Allow the usage of h5py drivers (eg: ros3) via h5netcdf (PR8360). By Ezequiel Cimadevilla.
Enable VLEN string fill_values, preserve VLEN string dtypes (GH1647, GH7652, GH7868, PR7869). By Kai Mühlbauer.
Breaking changes#
drop support for cdms2. Please use xcdat instead (PR8441). By Justus Magin.
Following pandas,
infer_freq()
will return"Y"
,"YS"
,"QE"
,"ME"
,"h"
,"min"
,"s"
,"ms"
,"us"
, or"ns"
instead of"A"
,"AS"
,"Q"
,"M"
,"H"
,"T"
,"S"
,"L"
,"U"
, or"N"
. This is to be consistent with the deprecation of the latter frequency strings (GH8394, PR8415). By Spencer Clark.Bump minimum tested pint version to
>=0.22
. By Deepak Cherian.Minimum supported versions for the following packages have changed:
h5py >=3.7
,h5netcdf>=1.1
. By Kai Mühlbauer.
Deprecations#
The PseudoNetCDF backend has been removed. By Deepak Cherian.
Supplying dimension-ordered sequences to
DataArray.chunk()
&Dataset.chunk()
is deprecated in favor of supplying a dictionary of dimensions, or a singleint
or"auto"
argument covering all dimensions. Xarray favors using dimensions names rather than positions, and this was one place in the API where dimension positions were used. (PR8341) By Maximilian Roos.Following pandas, the frequency strings
"A"
,"AS"
,"Q"
,"M"
,"H"
,"T"
,"S"
,"L"
,"U"
, and"N"
are deprecated in favor of"Y"
,"YS"
,"QE"
,"ME"
,"h"
,"min"
,"s"
,"ms"
,"us"
, and"ns"
, respectively. These strings are used, for example, indate_range()
,cftime_range()
,DataArray.resample()
, andDataset.resample()
among others (GH8394, PR8415). By Spencer Clark.Rename
Dataset.to_array()
toDataset.to_dataarray()
for consistency withDataArray.to_dataset()
&open_dataarray()
functions. This is a “soft” deprecation — the existing methods work and don’t raise any warnings, given the relatively small benefits of the change. By Maximilian Roos.Finally remove
keep_attrs
kwarg fromDataArray.resample()
andDataset.resample()
. These were deprecated a long time ago. By Deepak Cherian.
Bug fixes#
Port bug fix from pandas to eliminate the adjustment of resample bin edges in the case that the resampling frequency has units of days and is greater than one day (e.g.
"2D"
,"3D"
etc.) and theclosed
argument is set to"right"
to xarray’s implementation of resample for data indexed by aCFTimeIndex
(PR8393). By Spencer Clark.Fix to once again support date offset strings as input to the loffset parameter of resample and test this functionality (PR8422, GH8399). By Katelyn FitzGerald.
Fix a bug where
DataArray.to_dataset()
silently drops a variable if a coordinate with the same name already exists (PR8433, GH7823). By András Gunyhó.Fix for
DataArray.to_zarr()
&Dataset.to_zarr()
to close the created zarr store when passing a path with .zip extension (PR8425). By Carl Andersson <https://github.com/CarlAndersson>_.
Documentation#
Small updates to documentation on distributed writes: See Modifying existing Zarr stores to Zarr. By Deepak Cherian.
v2023.10.1 (19 Oct, 2023)#
This release updates our minimum numpy version in pyproject.toml
to 1.22,
consistent with our documentation below.
v2023.10.0 (19 Oct, 2023)#
This release brings performance enhancements to reading Zarr datasets, the ability to use numbagg for reductions,
an expansion in API for rolling_exp
, fixes two regressions with datetime decoding,
and many other bugfixes and improvements. Groupby reductions will also use numbagg
if flox>=0.8.1
and numbagg
are both installed.
Thanks to our 13 contributors: Anderson Banihirwe, Bart Schilperoort, Deepak Cherian, Illviljan, Kai Mühlbauer, Mathias Hauser, Maximilian Roos, Michael Niklas, Pieter Eendebak, Simon Høxbro Hansen, Spencer Clark, Tom White, olimcc
New Features#
Support high-performance reductions with numbagg. This is enabled by default if
numbagg
is installed. By Deepak Cherian. (PR8316)Add
corr
,cov
,std
&var
to.rolling_exp
. By Maximilian Roos. (PR8307)DataArray.where()
&Dataset.where()
accept a callable for theother
parameter, passing the object as the only argument. Previously, this was only valid for thecond
parameter. (GH8255) By Maximilian Roos..rolling_exp
functions can now take amin_weight
parameter, to only output values when there are sufficient recent non-nan values.numbagg>=0.3.1
is required. (PR8285) By Maximilian Roos.DataArray.sortby()
&Dataset.sortby()
accept a callable for thevariables
parameter, passing the object as the only argument. By Maximilian Roos..rolling_exp
functions can now operate on dask-backed arrays, assuming the core dim has exactly one chunk. (PR8284). By Maximilian Roos.
Breaking changes#
Made more arguments keyword-only (e.g.
keep_attrs
,skipna
) for manyxarray.DataArray
andxarray.Dataset
methods (PR6403). By Mathias Hauser.Dataset.to_zarr()
&DataArray.to_zarr()
require keyword arguments after the initial 7 positional arguments. By Maximilian Roos.
Deprecations#
Rename
Dataset.reset_encoding()
&DataArray.reset_encoding()
toDataset.drop_encoding()
&DataArray.drop_encoding()
for consistency with otherdrop
&reset
methods —drop
generally removes something, whilereset
generally resets to some default or standard value. (PR8287, GH8259) By Maximilian Roos.
Bug fixes#
DataArray.rename()
&Dataset.rename()
would emit a warning when the operation was a no-op. (GH8266) By Simon Hansen.Fixed a regression introduced in the previous release checking time-like units when encoding/decoding masked data (GH8269, PR8277). By Kai Mühlbauer.
Fix datetime encoding precision loss regression introduced in the previous release for datetimes encoded with units requiring floating point values, and a reference date not equal to the first value of the datetime array (GH8271, PR8272). By Spencer Clark.
Fix excess metadata requests when using a Zarr store. Prior to this, metadata was re-read every time data was retrieved from the array, now metadata is retrieved only once when they array is initialized. (GH8290, PR8297). By Oliver McCormack.
Fix to_zarr ending in a ReadOnlyError when consolidated metadata was used and the write_empty_chunks was provided. (GH8323, PR8326) By Matthijs Amesz.
Documentation#
Added page on the interoperability of xarray objects. (PR7992) By Tom Nicholas.
Added xarray-regrid to the list of xarray related projects (PR8272). By Bart Schilperoort.
Internal Changes#
More improvements to support the Python array API standard by using duck array ops in more places in the codebase. (PR8267) By Tom White.
v2023.09.0 (Sep 26, 2023)#
This release continues work on the new xarray.Coordinates
object, allows to provide preferred_chunks when
reading from netcdf files, enables xarray.apply_ufunc()
to handle missing core dimensions and fixes several bugs.
Thanks to the 24 contributors to this release: Alexander Fischer, Amrest Chinkamol, Benoit Bovy, Darsh Ranjan, Deepak Cherian, Gianfranco Costamagna, Gregorio L. Trevisan, Illviljan, Joe Hamman, JR, Justus Magin, Kai Mühlbauer, Kian-Meng Ang, Kyle Sunden, Martin Raspaud, Mathias Hauser, Mattia Almansi, Maximilian Roos, András Gunyhó, Michael Niklas, Richard Kleijn, Riulinchen, Tom Nicholas and Wiktor Kraśnicki.
We welcome the following new contributors to Xarray!: Alexander Fischer, Amrest Chinkamol, Darsh Ranjan, Gianfranco Costamagna, Gregorio L. Trevisan, Kian-Meng Ang, Riulinchen and Wiktor Kraśnicki.
New Features#
Added the
Coordinates.assign()
method that can be used to combine different collections of coordinates prior to assign them to a Dataset or DataArray (PR8102) at once. By Benoît Bovy.Provide preferred_chunks for data read from netcdf files (GH1440, PR7948). By Martin Raspaud.
Added on_missing_core_dims to
apply_ufunc()
to allow for copying or dropping aDataset
’s variables with missing core dimensions (PR8138). By Maximilian Roos.
Breaking changes#
The
Coordinates
constructor now creates a (pandas) index by default for each dimension coordinate. To keep the previous behavior (no index created), pass an empty dictionary toindexes
. The constructor now also extracts and add the indexes from anotherCoordinates
object passed viacoords
(PR8107). By Benoît Bovy.Static typing of
xlim
andylim
arguments in plotting functions now must betuple[float, float]
to align with matplotlib requirements. (GH7802, PR8030). By Michael Niklas.
Deprecations#
Deprecate passing a
pandas.MultiIndex
object directly to theDataset
andDataArray
constructors as well as toDataset.assign()
andDataset.assign_coords()
. A new XarrayCoordinates
object has to be created first usingCoordinates.from_pandas_multiindex()
(PR8094). By Benoît Bovy.
Bug fixes#
Improved static typing of reduction methods (PR6746). By Richard Kleijn.
Fix bug where empty attrs would generate inconsistent tokens (GH6970, PR8101). By Mattia Almansi.
Improved handling of multi-coordinate indexes when updating coordinates, including bug fixes (and improved warnings for deprecated features) for pandas multi-indexes (PR8094). By Benoît Bovy.
Fixed a bug in
merge()
withcompat='minimal'
where the coordinate names were not updated properly internally (GH7405, GH7588, PR8104). By Benoît Bovy.Fix bug where
DataArray
instances on the right-hand side ofDataArray.__setitem__()
lose dimension names (GH7030, PR8067). By Darsh Ranjan.Return
float64
in presence ofNaT
inDatetimeAccessor
and special caseNaT
handling inisocalendar()
(GH7928, PR8084). By Kai Mühlbauer.Fix
construct()
with stride on Datasets without indexes. (GH7021, PR7578). By Amrest Chinkamol and Michael Niklas.Calling plot with kwargs
col
,row
orhue
no longer squeezes dimensions passed via these arguments (GH7552, PR8174). By Wiktor Kraśnicki.Fixed a bug where casting from
float
toint64
(undefined forNaN
) led to varying issues (GH7817, GH7942, GH7790, GH6191, GH7096, GH1064, PR7827). By Kai Mühlbauer.Fixed a bug where inaccurate
coordinates
silently failed to decode variable (GH1809, PR8195). By Kai Mühlbauer.rolling_exp
functions no longer mistakenly lose non-dimensioned coords (GH6528, PR8114). By Maximilian Roos.In the event that user-provided datetime64/timedelta64 units and integer dtype encoding parameters conflict with each other, override the units to preserve an integer dtype for most faithful serialization to disk (GH1064, PR8201). By Kai Mühlbauer.
Static typing of dunder ops methods (like
DataArray.__eq__()
) has been fixed. Remaining issues are upstream problems (GH7780, PR8204). By Michael Niklas.Fix type annotation for
center
argument of plotting methods (likexarray.plot.dataarray_plot.pcolormesh()
) (PR8261). By Pieter Eendebak.
Documentation#
Make documentation of
DataArray.where()
clearer (GH7767, PR7955). By Riulinchen.
Internal Changes#
Many error messages related to invalid dimensions or coordinates now always show the list of valid dims/coords (PR8079). By András Gunyhó.
Refactor of encoding and decoding times/timedeltas to preserve nanosecond resolution in arrays that contain missing values (PR7827). By Kai Mühlbauer.
Transition
.rolling_exp
functions to use .apply_ufunc internally rather than .reduce, as the start of a broader effort to move non-reducing functions away from`.reduce
, (PR8114). By Maximilian Roos.Test range of fill_value’s in test_interpolate_pd_compat (GH8146, PR8189). By Kai Mühlbauer.
v2023.08.0 (Aug 18, 2023)#
This release brings changes to minimum dependencies, allows reading of datasets where a dimension name is
associated with a multidimensional variable (e.g. finite volume ocean model output), and introduces
a new xarray.Coordinates
object.
Thanks to the 16 contributors to this release: Anderson Banihirwe, Articoking, Benoit Bovy, Deepak Cherian, Harshitha, Ian Carroll, Joe Hamman, Justus Magin, Peter Hill, Rachel Wegener, Riley Kuttruff, Thomas Nicholas, Tom Nicholas, ilgast, quantsnus, vallirep
Announcements#
The xarray.Variable
class is being refactored out to a new project title ‘namedarray’.
See the design doc for more
details. Reach out to us on this [discussion topic](pydata/xarray#8080) if you have any thoughts.
New Features#
Coordinates
can now be constructed independently of any Dataset or DataArray (it is also returned by theDataset.coords
andDataArray.coords
properties).Coordinates
objects are useful for passing both coordinate variables and indexes to new Dataset / DataArray objects, e.g., via their constructor or viaDataset.assign_coords()
. We may also wrap coordinate variables in aCoordinates
object in order to skip the automatic creation of (pandas) indexes for dimension coordinates. TheCoordinates.from_pandas_multiindex
constructor may be used to create coordinates directly from apandas.MultiIndex
object (it is preferred over passing it directly as coordinate data, which may be deprecated soon). Like Dataset and DataArray objects,Coordinates
objects may now be used inalign()
andmerge()
. (GH6392, PR7368). By Benoît Bovy.Visually group together coordinates with the same indexes in the index section of the text repr (PR7225). By Justus Magin.
Allow creating Xarray objects where a multidimensional variable shares its name with a dimension. Examples include output from finite volume models like FVCOM. (GH2233, PR7989) By Deepak Cherian and Benoit Bovy.
When outputting
Dataset
objects as Zarr viaDataset.to_zarr()
, user can now specify that chunks that will contain no valid data will not be written. Originally, this could be done by specifying"write_empty_chunks": True
in theencoding
parameter; however, this setting would not carry over when appending new data to an existing dataset. (GH8009) Requireszarr>=2.11
.
Breaking changes#
The minimum versions of some dependencies were changed (PR8022):
Package
Old
New
boto3
1.20
1.24
cftime
1.5
1.6
dask-core
2022.1
2022.7
distributed
2022.1
2022.7
hfnetcdf
0.13
1.0
iris
3.1
3.2
lxml
4.7
4.9
netcdf4
1.5.7
1.6.0
numpy
1.21
1.22
pint
0.18
0.19
pydap
3.2
3.3
rasterio
1.2
1.3
scipy
1.7
1.8
toolz
0.11
0.12
typing_extensions
4.0
4.3
zarr
2.10
2.12
numbagg
0.1
0.2.1
Documentation#
Added page on the internal design of xarray objects. (PR7991) By Tom Nicholas.
Added examples to docstrings of
Dataset.assign_attrs()
,Dataset.broadcast_equals()
,Dataset.equals()
,Dataset.identical()
,Dataset.expand_dims()
,:py:meth:Dataset.drop_vars (GH6793, PR7937) By Harshitha.Add docstrings for the
Index
base class and add some documentation on how to create custom, Xarray-compatible indexes (PR6975) By Benoît Bovy.Added a page clarifying the role of Xarray core team members. (PR7999) By Tom Nicholas.
Fixed broken links in “See also” section of
Dataset.count()
(GH8055, PR8057) By Articoking.Extended the glossary by adding terms Aligning, Broadcasting, Merging, Concatenating, Combining, lazy, labeled, serialization, indexing (GH3355, PR7732) By Harshitha.
Internal Changes#
as_variable()
now consistently includes the variable name in any exceptions raised. (PR7995). By Peter Hillencode_dataset_coordinates()
now sorts coordinates automatically assigned to coordinates attributes during serialization (GH8026, PR8034). By Ian Carroll.
v2023.07.0 (July 17, 2023)#
This release brings improvements to the documentation on wrapping numpy-like arrays, improved docstrings, and bug fixes.
Deprecations#
hue_style is being deprecated for scatter plots. (GH7907, PR7925). By Jimmy Westling.
Bug fixes#
Ensure no forward slashes in variable and dimension names for HDF5-based engines. (GH7943, PR7953) By Kai Mühlbauer.
Documentation#
Added examples to docstrings of
Dataset.assign_attrs()
,Dataset.broadcast_equals()
,Dataset.equals()
,Dataset.identical()
,Dataset.expand_dims()
,:py:meth:Dataset.drop_vars (GH6793, PR7937) By Harshitha.Added page on wrapping chunked numpy-like arrays as alternatives to dask arrays. (PR7951) By Tom Nicholas.
Expanded the page on wrapping numpy-like “duck” arrays. (PR7911) By Tom Nicholas.
Added examples to docstrings of
Dataset.isel()
,Dataset.reduce()
,Dataset.argmin()
,Dataset.argmax()
(GH6793, PR7881) By Harshitha .
Internal Changes#
Allow chunked non-dask arrays (i.e. Cubed arrays) in groupby operations. (PR7941) By Tom Nicholas.
v2023.06.0 (June 21, 2023)#
This release adds features to curvefit
, improves the performance of concatenation, and fixes various bugs.
Thank to our 13 contributors to this release: Anderson Banihirwe, Deepak Cherian, dependabot[bot], Illviljan, Juniper Tyree, Justus Magin, Martin Fleischmann, Mattia Almansi, mgunyho, Rutger van Haasteren, Thomas Nicholas, Tom Nicholas, Tom White.
New Features#
Added support for multidimensional initial guess and bounds in
DataArray.curvefit()
(GH7768, PR7821). By András Gunyhó.Add an
errors
option toDataset.curve_fit()
that allows returning NaN for the parameters and covariances of failed fits, rather than failing the whole series of fits (GH6317, PR7891). By Dominik Stańczak and András Gunyhó.
Breaking changes#
Deprecations#
Deprecate the cdms2 conversion methods (PR7876) By Justus Magin.
Performance#
Improve concatenation performance (GH7833, PR7824). By Jimmy Westling.
Bug fixes#
Fix bug where weighted
polyfit
were changing the original object (GH5644, PR7900). By Mattia Almansi.Don’t call
CachingFileManager.__del__
on interpreter shutdown (GH7814, PR7880). By Justus Magin.Preserve vlen dtype for empty string arrays (GH7328, PR7862). By Tom White and Kai Mühlbauer.
Ensure dtype of reindex result matches dtype of the original DataArray (GH7299, PR7917) By Anderson Banihirwe.
Fix bug where a zero-length zarr
chunk_store
was ignored as if it wasNone
(PR7923) By Juniper Tyree.
Documentation#
Internal Changes#
Minor improvements to support of the python array api standard, internally using the function
xp.astype()
instead of the methodarr.astype()
, as the latter is not in the standard. (PR7847) By Tom Nicholas.Xarray now uploads nightly wheels to https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ (GH7863, PR7865). By Martin Fleischmann.
Stop uploading development wheels to TestPyPI (PR7889) By Justus Magin.
Added an exception catch for
AttributeError
along withImportError
when duck typing the dynamic imports in pycompat.py. This catches some name collisions between packages. (GH7870, PR7874)
v2023.05.0 (May 18, 2023)#
This release adds some new methods and operators, updates our deprecation policy for python versions, fixes some bugs with groupby, and introduces experimental support for alternative chunked parallel array computation backends via a new plugin system!
Note: If you are using a locally-installed development version of xarray then pulling the changes from this release may require you to re-install. This avoids an error where xarray cannot detect dask via the new entrypoints system introduced in PR7019. See GH7856 for details.
Thanks to our 14 contributors: Alan Brammer, crusaderky, David Stansby, dcherian, Deeksha, Deepak Cherian, Illviljan, James McCreight, Joe Hamman, Justus Magin, Kyle Sunden, Max Hollmann, mgunyho, and Tom Nicholas
New Features#
Added new method
DataArray.to_dask_dataframe()
, convert a dataarray into a dask dataframe (GH7409). By Deeksha.Add support for lshift and rshift binary operators (
<<
,>>
) onxr.DataArray
of typeint
(GH7727 , PR7741). By Alan Brammer.Keyword argument data=’array’ to both
xarray.Dataset.to_dict()
andxarray.DataArray.to_dict()
will now return data as the underlying array type. Python lists are returned for data=’list’ or data=True. Supplying data=False only returns the schema without data.encoding=True
returns the encoding dictionary for the underlying variable also. (GH1599, PR7739) . By James McCreight.
Breaking changes#
adjust the deprecation policy for python to once again align with NEP-29 (GH7765, PR7793) By Justus Magin.
Performance#
Optimize
.dt `` accessor performance with ``CFTimeIndex
. (PR7796) By Deepak Cherian.
Bug fixes#
Fix as_compatible_data for masked float arrays, now always creates a copy when mask is present (GH2377, PR7788). By Max Hollmann.
Fix groupby binary ops when grouped array is subset relative to other. (GH7797). By Deepak Cherian.
Fix groupby sum, prod for all-NaN groups with
flox
. (GH7808). By Deepak Cherian.
Internal Changes#
Experimental support for wrapping chunked array libraries other than dask. A new ABC is defined -
xr.core.parallelcompat.ChunkManagerEntrypoint
- which can be subclassed and then registered by alternative chunked array implementations. (GH6807, PR7019) By Tom Nicholas.
v2023.04.2 (April 20, 2023)#
This is a patch release to fix a bug with binning (GH7766)
Bug fixes#
Fix binning when
labels
is specified. (GH7766). By Deepak Cherian.
Documentation#
Added examples to docstrings for
xarray.core.accessor_str.StringAccessor()
methods. (PR7669) . By Mary Gathoni.
v2023.04.1 (April 18, 2023)#
This is a patch release to fix a bug with binning (GH7759)
Bug fixes#
Fix binning by unsorted arrays. (GH7759)
v2023.04.0 (April 14, 2023)#
This release includes support for pandas v2, allows refreshing of backend engines in a session, and removes deprecated backends
for rasterio
and cfgrib
.
Thanks to our 19 contributors: Chinemere, Tom Coleman, Deepak Cherian, Harshitha, Illviljan, Jessica Scheick, Joe Hamman, Justus Magin, Kai Mühlbauer, Kwonil-Kim, Mary Gathoni, Michael Niklas, Pierre, Scott Henderson, Shreyal Gupta, Spencer Clark, mccloskey, nishtha981, veenstrajelmer
We welcome the following new contributors to Xarray!: Mary Gathoni, Harshitha, veenstrajelmer, Chinemere, nishtha981, Shreyal Gupta, Kwonil-Kim, mccloskey.
New Features#
New methods to reset an objects encoding (
Dataset.reset_encoding()
,DataArray.reset_encoding()
). (GH7686, PR7689). By Joe Hamman.Allow refreshing backend engines with
xarray.backends.refresh_engines()
(GH7478, PR7523). By Michael Niklas.Added ability to save
DataArray
objects directly to Zarr usingto_zarr()
. (GH7692, PR7693) . By Joe Hamman.
Breaking changes#
Remove deprecated rasterio backend in favor of rioxarray (PR7392). By Scott Henderson.
Deprecations#
Performance#
Optimize alignment with
join="exact", copy=False
by avoiding copies. (PR7736) By Deepak Cherian.Avoid unnecessary copies of
CFTimeIndex
. (PR7735) By Deepak Cherian.
Bug fixes#
Fix
xr.polyval()
with non-system standard integer coeffs (PR7619). By Shreyal Gupta and Michael Niklas.Improve error message when trying to open a file which you do not have permission to read (GH6523, PR7629). By Thomas Coleman.
Proper plotting when passing
BoundaryNorm
type argument inDataArray.plot()
. (GH4061, GH7014,:pull:7553) By Jelmer Veenstra.Ensure the formatting of time encoding reference dates outside the range of nanosecond-precision datetimes remains the same under pandas version 2.0.0 (GH7420, PR7441). By Justus Magin and Spencer Clark.
Various dtype related fixes needed to support pandas>=2.0 (PR7724) By Justus Magin.
Preserve boolean dtype within encoding (GH7652, PR7720). By Kai Mühlbauer
Documentation#
Update FAQ page on how do I open format X file as an xarray dataset? (GH1285, PR7638) using
open_dataset()
By Harshitha , Tom Nicholas.
Internal Changes#
Don’t assume that arrays read from disk will be Numpy arrays. This is a step toward enabling reads from a Zarr store using the Kvikio or TensorStore libraries. (PR6874). By Deepak Cherian.
Remove internal support for reading GRIB files through the
cfgrib
backend.cfgrib
now uses the external backend interface, so no existing code should break. By Deepak Cherian.Implement CF coding functions in
VariableCoders
(PR7719). By Kai MühlbauerAdded a config.yml file with messages for the welcome bot when a Github user creates their first ever issue or pull request or has their first PR merged. (GH7685, PR7685) By Nishtha P.
Ensure that only nanosecond-precision
pd.Timestamp
objects continue to be used internally under pandas version 2.0.0. This is mainly to ease the transition to this latest version of pandas. It should be relaxed when addressing GH7493. By Spencer Clark (GH7707, PR7731).
v2023.03.0 (March 22, 2023)#
This release brings many bug fixes, and some new features. The maximum pandas version is pinned to <2
until we can support the new pandas datetime types.
Thanks to our 19 contributors:
Abel Aoun, Alex Goodman, Deepak Cherian, Illviljan, Jody Klymak, Joe Hamman, Justus Magin, Mary Gathoni, Mathias Hauser, Mattia Almansi, Mick, Oriol Abril-Pla, Patrick Hoefler, Paul Ockenfuß, Pierre, Shreyal Gupta, Spencer Clark, Tom Nicholas, Tom Vo
New Features#
Fix
xr.cov()
andxr.corr()
now support complex valued arrays (GH7340, PR7392). By Michael Niklas.Allow indexing along unindexed dimensions with dask arrays (GH2511, GH4276, GH4663, PR5873). By Abel Aoun and Deepak Cherian.
Support dask arrays in
first
andlast
reductions. By Deepak Cherian.Improved performance in
open_dataset
for datasets with large object arrays (GH7484, PR7494). By Alex Goodman and Deepak Cherian.
Breaking changes#
Deprecations#
Following pandas, the
base
andloffset
parameters ofxr.DataArray.resample()
andxr.Dataset.resample()
have been deprecated and will be removed in a future version of xarray. Using theorigin
oroffset
parameters is recommended as a replacement for using thebase
parameter and using time offset arithmetic is recommended as a replacement for using theloffset
parameter (PR8459). By Spencer Clark.
Bug fixes#
Improve error message when using in
Dataset.drop_vars()
to state which variables can’t be dropped. (PR7518) By Tom Nicholas.Require to explicitly defining optional dimensions such as hue and markersize for scatter plots. (GH7314, PR7277). By Jimmy Westling.
Fix matplotlib raising a UserWarning when plotting a scatter plot with an unfilled marker (GH7313, PR7318). By Jimmy Westling.
Fix issue with
max_gap
ininterpolate_na
, when applied to multidimensional arrays. (GH7597, PR7598). By Paul Ockenfuß.Fix
DataArray.plot.pcolormesh()
which now works if one of the coordinates has str dtype (GH6775, PR7612). By Michael Niklas.
Documentation#
Clarify language in contributor’s guide (GH7495, PR7595) By Tom Nicholas.
Internal Changes#
Pin pandas to
<2
. By Deepak Cherian.
v2023.02.0 (Feb 7, 2023)#
This release brings a major upgrade to xarray.concat()
, many bug fixes,
and a bump in supported dependency versions. Thanks to our 11 contributors:
Aron Gergely, Deepak Cherian, Illviljan, James Bourbeau, Joe Hamman,
Justus Magin, Hauke Schulz, Kai Mühlbauer, Ken Mankoff, Spencer Clark, Tom Nicholas.
Breaking changes#
Support for
python 3.8
has been dropped and the minimum versions of some dependencies were changed (PR7461):Package
Old
New
python
3.8
3.9
numpy
1.20
1.21
pandas
1.3
1.4
dask
2021.11
2022.1
distributed
2021.11
2022.1
h5netcdf
0.11
0.13
lxml
4.6
4.7
numba
5.4
5.5
Deprecations#
Following pandas, the closed parameters of
cftime_range()
anddate_range()
are deprecated in favor of the inclusive parameters, and will be removed in a future version of xarray (GH6985:, PR7373). By Spencer Clark.
Bug fixes#
xarray.concat()
can now concatenate variables present in some datasets but not others (GH508, PR7400). By Kai Mühlbauer and Scott Chamberlin.Handle
keep_attrs
option in binary operators ofDataset()
(GH7390, PR7391). By Aron Gergely.Improve error message when using dask in
apply_ufunc()
withoutput_sizes
not supplied. (PR7509) By Tom Nicholas.xarray.Dataset.to_zarr()
now drops variable encodings that have been added by xarray during reading a dataset. (GH7129, PR7500). By Hauke Schulz.
Documentation#
Mention the flox package in GroupBy documentation and docstrings. By Deepak Cherian.
v2023.01.0 (Jan 17, 2023)#
This release includes a number of bug fixes. Thanks to the 14 contributors to this release: Aron Gergely, Benoit Bovy, Deepak Cherian, Ian Carroll, Illviljan, Joe Hamman, Justus Magin, Mark Harfouche, Matthew Roeschke, Paige Martin, Pierre, Sam Levang, Tom White, stefank0.
Breaking changes#
CFTimeIndex.get_loc()
has removed themethod
andtolerance
keyword arguments. Use.get_indexer([key], method=..., tolerance=...)
instead (PR7361). By Matthew Roeschke.
Bug fixes#
Avoid in-memory broadcasting when converting to a dask dataframe using
.to_dask_dataframe.
(GH6811, PR7472). By Jimmy Westling.Accessing the property
.nbytes
of a DataArray, or Variable no longer accidentally triggers loading the variable into memory.Allow numpy-only objects in
where()
whenkeep_attrs=True
(GH7362, PR7364). By Sam Levang.add a
keep_attrs
parameter toDataset.pad()
,DataArray.pad()
, andVariable.pad()
(PR7267). By Justus Magin.Fixed performance regression in alignment between indexed and non-indexed objects of the same shape (PR7382). By Benoît Bovy.
Preserve original dtype on accessing MultiIndex levels (GH7250, PR7393). By Ian Carroll.
Internal Changes#
Add the pre-commit hook absolufy-imports to convert relative xarray imports to absolute imports (PR7204, PR7370). By Jimmy Westling.
v2022.12.0 (2022 Dec 2)#
This release includes a number of bug fixes and experimental support for Zarr V3. Thanks to the 16 contributors to this release: Deepak Cherian, Francesco Zanetta, Gregory Lee, Illviljan, Joe Hamman, Justus Magin, Luke Conibear, Mark Harfouche, Mathias Hauser, Mick, Mike Taves, Sam Levang, Spencer Clark, Tom Nicholas, Wei Ji, templiert
New Features#
Enable using offset and origin arguments in
DataArray.resample()
andDataset.resample()
(GH7266, PR7284). By Spencer Clark.Add experimental support for Zarr’s in-progress V3 specification. (PR6475). By Gregory Lee and Joe Hamman.
Breaking changes#
The minimum versions of some dependencies were changed (PR7300):
Package
Old
New
boto
1.18
1.20
cartopy
0.19
0.20
distributed
2021.09
2021.11
dask
2021.09
2021.11
h5py
3.1
3.6
hdf5
1.10
1.12
matplotlib-base
3.4
3.5
nc-time-axis
1.3
1.4
netcdf4
1.5.3
1.5.7
packaging
20.3
21.3
pint
0.17
0.18
pseudonetcdf
3.1
3.2
typing_extensions
3.10
4.0
Deprecations#
The PyNIO backend has been deprecated (GH4491, PR7301). By Joe Hamman.
Bug fixes#
Fix handling of coordinate attributes in
where()
. (GH7220, PR7229) By Sam Levang.Import
nc_time_axis
when needed (GH7275, PR7276). By Michael Niklas.Fix static typing of
xr.polyval()
(GH7312, PR7315). By Michael Niklas.Fix multiple reads on fsspec S3 files by resetting file pointer to 0 when reading file streams (GH6813, PR7304). By David Hoese and Wei Ji Leong.
Fix
Dataset.assign_coords()
resetting all dimension coordinates to default (pandas) index (GH7346, PR7347). By Benoît Bovy.
Documentation#
Add example of reading and writing individual groups to a single netCDF file to I/O docs page. (PR7338) By Tom Nicholas.
Internal Changes#
v2022.11.0 (Nov 4, 2022)#
This release brings a number of bugfixes and documentation improvements. Both text and HTML reprs now have a new “Indexes” section, which we expect will help with development of new Index objects. This release also features more support for the Python Array API.
Many thanks to the 16 contributors to this release: Daniel Goman, Deepak Cherian, Illviljan, Jessica Scheick, Justus Magin, Mark Harfouche, Maximilian Roos, Mick, Patrick Naylor, Pierre, Spencer Clark, Stephan Hoyer, Tom Nicholas, Tom White
New Features#
Add static typing to plot accessors (GH6949, PR7052). By Michael Niklas.
Display the indexes in a new section of the text and HTML reprs (PR6795, PR7183, PR7185) By Justus Magin and Benoît Bovy.
Added methods
DataArrayGroupBy.cumprod()
andDatasetGroupBy.cumprod()
. (PR5816) By Patrick Naylor
Breaking changes#
repr(ds)
may not show the same result because it doesn’t load small, lazy data anymore. Useds.head().load()
when wanting to see just a sample of the data. (GH6722, PR7203). By Jimmy Westling.Many arguments of plotmethods have been made keyword-only.
xarray.plot.plot
module renamed toxarray.plot.dataarray_plot
to prevent shadowing of theplot
method. (GH6949, PR7052). By Michael Niklas.
Deprecations#
Positional arguments for all plot methods have been deprecated (GH6949, PR7052). By Michael Niklas.
xarray.plot.FacetGrid.axes
has been renamed toxarray.plot.FacetGrid.axs
because it’s not clear ifaxes
refers to single or multipleAxes
instances. This aligns withmatplotlib.pyplot.subplots
. (PR7194) By Jimmy Westling.
Bug fixes#
Explicitly opening a file multiple times (e.g., after modifying it on disk) now reopens the file from scratch for h5netcdf and scipy netCDF backends, rather than reusing a cached version (GH4240, GH4862). By Stephan Hoyer.
Fixed bug where
Dataset.coarsen.construct()
would demote non-dimension coordinates to variables. (PR7233) By Tom Nicholas.Raise a TypeError when trying to plot empty data (GH7156, PR7228). By Michael Niklas.
Documentation#
Improves overall documentation around available backends, including adding docstrings for
xarray.backends.list_engines()
Add__str__()
to surface the newBackendEntrypoint
description
andurl
attributes. (GH6577, PR7000) By Jessica Scheick.Created docstring examples for
DataArray.cumsum()
,DataArray.cumprod()
,Dataset.cumsum()
,Dataset.cumprod()
,DatasetGroupBy.cumsum()
,DataArrayGroupBy.cumsum()
. (GH5816, PR7152) By Patrick NaylorAdd example of using
DataArray.coarsen.construct()
to User Guide. (PR7192) By Tom Nicholas.Rename
axes
toaxs
in plotting to align withmatplotlib.pyplot.subplots
. (PR7194) By Jimmy Westling.Add documentation of specific BackendEntrypoints (PR7200). By Michael Niklas.
Add examples to docstring for
DataArray.drop_vars()
,DataArray.reindex_like()
,DataArray.interp_like()
. (GH6793, PR7123) By Daniel Goman.
Internal Changes#
Doctests fail on any warnings (PR7166) By Maximilian Roos.
Improve import time by lazy loading
dask.distributed
(:pull: 7172).Explicitly specify
longdouble=False
incftime.date2num()
when encoding times to preserve existing behavior and prevent future errors when it is eventually set toTrue
by default in cftime (PR7171). By Spencer Clark.Improved import time by lazily importing backend modules, matplotlib, dask.array and flox. (GH6726, PR7179) By Michael Niklas.
Emit a warning under the development version of pandas when we convert non-nanosecond precision datetime or timedelta values to nanosecond precision. This was required in the past, because pandas previously was not compatible with non-nanosecond precision values. However pandas is currently working towards removing this restriction. When things stabilize in pandas we will likely consider relaxing this behavior in xarray as well (GH7175, PR7201). By Spencer Clark.
v2022.10.0 (Oct 14 2022)#
This release brings numerous bugfixes, a change in minimum supported versions, and a new scatter plot method for DataArrays.
Many thanks to 11 contributors to this release: Anderson Banihirwe, Benoit Bovy, Dan Adriaansen, Illviljan, Justus Magin, Lukas Bindreiter, Mick, Patrick Naylor, Spencer Clark, Thomas Nicholas
New Features#
Add scatter plot for datarrays. Scatter plots now also supports 3d plots with the z argument. (PR6778) By Jimmy Westling.
Include the variable name in the error message when CF decoding fails to allow for easier identification of problematic variables (GH7145, PR7147). By Spencer Clark.
Breaking changes#
The minimum versions of some dependencies were changed:
Package
Old
New
cftime
1.4
1.5
distributed
2021.08
2021.09
dask
2021.08
2021.09
iris
2.4
3.1
nc-time-axis
1.2
1.3
numba
0.53
0.54
numpy
1.19
1.20
pandas
1.2
1.3
packaging
20.0
21.0
scipy
1.6
1.7
sparse
0.12
0.13
typing_extensions
3.7
3.10
zarr
2.8
2.10
Bug fixes#
Remove nested function from
open_mfdataset()
to allow Dataset objects to be pickled. (GH7109, PR7116) By Daniel Adriaansen.Support for recursively defined Arrays. Fixes repr and deepcopy. (GH7111, PR7112) By Michael Niklas.
Fixed
Dataset.transpose()
to raise a more informative error. (GH6502, PR7120) By Patrick NaylorFix groupby on a multi-index level coordinate and fix
DataArray.to_index()
for multi-index levels (convert to single index). (GH6836, PR7105) By Benoît Bovy.Support for open_dataset backends that return datasets containing multi-indexes (GH7139, PR7150) By Lukas Bindreiter.
v2022.09.0 (September 30, 2022)#
This release brings a large number of bugfixes and documentation improvements, as well as an external interface for setting custom indexes!
Many thanks to our 40 contributors:
Anderson Banihirwe, Andrew Ronald Friedman, Bane Sullivan, Benoit Bovy, ColemanTom, Deepak Cherian, Dimitri Papadopoulos Orfanos, Emma Marshall, Fabian Hofmann, Francesco Nattino, ghislainp, Graham Inggs, Hauke Schulz, Illviljan, James Bourbeau, Jody Klymak, Julia Signell, Justus Magin, Keewis, Ken Mankoff, Luke Conibear, Mathias Hauser, Max Jones, mgunyho, Michael Delgado, Mick, Mike Taves, Oliver Lopez, Patrick Naylor, Paul Hockett, Pierre Manchon, Ray Bell, Riley Brady, Sam Levang, Spencer Clark, Stefaan Lippens, Tom Nicholas, Tom White, Travis A. O’Brien, and Zachary Moon.
New Features#
Add
Dataset.set_xindex()
andDataset.drop_indexes()
and their DataArray counterpart for setting and dropping pandas or custom indexes given a set of arbitrary coordinates. (PR6971) By Benoît Bovy and Justus Magin.Enable taking the mean of dask-backed
cftime.datetime
arrays (PR6556, PR6940). By Deepak Cherian and Spencer Clark.
Bug fixes#
Allow reading netcdf files where the ‘units’ attribute is a number. (PR7085) By Ghislain Picard.
Allow decoding of 0 sized datetimes. (GH1329, PR6882) By Deepak Cherian.
Make sure DataArray.name is always a string when used as label for plotting. (GH6826, PR6832) By Jimmy Westling.
DataArray.nbytes
now uses thenbytes
property of the underlying array if available. (PR6797) By Max Jones.Rely on the array backend for string formatting. (PR6823). By Jimmy Westling.
Fix incompatibility with numpy 1.20. (GH6818, PR6821) By Michael Niklas.
Fix side effects on index coordinate metadata after aligning objects. (GH6852, PR6857) By Benoît Bovy.
Make FacetGrid.set_titles send kwargs correctly using handle.update(kwargs). (GH6839, PR6843) By Oliver Lopez.
Fix bug where index variables would be changed inplace. (GH6931, PR6938) By Michael Niklas.
Allow taking the mean over non-time dimensions of datasets containing dask-backed cftime arrays. (GH5897, PR6950) By Spencer Clark.
Harmonize returned multi-indexed indexes when applying
concat
along new dimension. (GH6881, PR6889) By Fabian Hofmann.Fix step plots with
hue
arg. (PR6944) By András Gunyhó.Avoid use of random numbers in test_weighted.test_weighted_operations_nonequal_coords. (GH6504, PR6961) By Luke Conibear.
Fix multiple regression issues with
Dataset.set_index()
andDataset.reset_index()
. (PR6992) By Benoît Bovy.Raise a
UserWarning
when renaming a coordinate or a dimension creates a non-indexed dimension coordinate, and suggest the user creating an index either withswap_dims
orset_index
. (GH6607, PR6999) By Benoît Bovy.Use
keep_attrs=True
in grouping and resampling operations by default. (GH7012) This meansDataset.attrs
andDataArray.attrs
are now preserved by default. By Deepak Cherian.Dataset.encoding['source']
now exists when reading from a Path object. (GH5888, PR6974) By Thomas Coleman.Better dtype consistency for
rolling.mean()
. (GH7062, PR7063) By Sam Levang.Allow writing NetCDF files including only dimensionless variables using the distributed or multiprocessing scheduler. (GH7013, PR7040) By Francesco Nattino.
Fix deepcopy of attrs and encoding of DataArrays and Variables. (GH2835, PR7089) By Michael Niklas.
Fix bug where subplot_kwargs were not working when plotting with figsize, size or aspect. (GH7078, PR7080) By Michael Niklas.
Documentation#
Raise a more informative error when trying to open a non-existent zarr store. (GH6484, PR7060) By Sam Levang.
Added examples to docstrings for
DataArray.expand_dims()
,DataArray.drop_duplicates()
,DataArray.reset_coords()
,DataArray.equals()
,DataArray.identical()
,DataArray.broadcast_equals()
,DataArray.bfill()
,DataArray.ffill()
,DataArray.fillna()
,DataArray.dropna()
,DataArray.drop_isel()
,DataArray.drop_sel()
,DataArray.head()
,DataArray.tail()
. (GH5816, PR7088) By Patrick Naylor.Add missing docstrings to various array properties. (PR7090) By Tom Nicholas.
Internal Changes#
Added test for DataArray attrs deepcopy recursion/nested attrs. (GH2835, PR7086) By Paul hockett.
v2022.06.0 (July 21, 2022)#
This release brings a number of bug fixes and improvements, most notably a major internal
refactor of the indexing functionality, the use of flox in groupby
operations,
and experimental support for the new Python Array API standard.
It also stops testing support for the abandoned PyNIO.
Much effort has been made to preserve backwards compatibility as part of the indexing refactor. We are aware of one unfixed issue.
Please also see the whats-new.2022.06.0rc0 for a full list of changes.
Many thanks to our 18 contributors: Bane Sullivan, Deepak Cherian, Dimitri Papadopoulos Orfanos, Emma Marshall, Hauke Schulz, Illviljan, Julia Signell, Justus Magin, Keewis, Mathias Hauser, Michael Delgado, Mick, Pierre Manchon, Ray Bell, Spencer Clark, Stefaan Lippens, Tom White, Travis A. O’Brien,
New Features#
Add
Dataset.dtypes
,core.coordinates.DatasetCoordinates.dtypes
,core.coordinates.DataArrayCoordinates.dtypes
properties: Mapping from variable names to dtypes. (PR6706) By Michael Niklas.Initial typing support for
groupby()
,rolling()
,rolling_exp()
,coarsen()
,weighted()
,resample()
, (PR6702) By Michael Niklas.Experimental support for wrapping any array type that conforms to the python array api standard. (PR6804) By Tom White.
Allow string formatting of scalar DataArrays. (PR5981) By fmaussion.
Bug fixes#
save_mfdataset()
now passes**kwargs
on toDataset.to_netcdf()
, allowing theencoding
andunlimited_dims
options withsave_mfdataset()
. (GH6684) By Travis A. O’Brien.Fix backend support of pydap versions <3.3.0 (GH6648, PR6656). By Hauke Schulz.
Dataset.where()
withdrop=True
now behaves correctly with mixed dimensions. (GH6227, PR6690) By Michael Niklas.Accommodate newly raised
OutOfBoundsTimedelta
error in the development version of pandas when decoding times outside the range that can be represented with nanosecond-precision values (GH6716, PR6717). By Spencer Clark.open_dataset()
with dask and~
in the path now resolves the home directory instead of raising an error. (GH6707, PR6710) By Michael Niklas.DataArrayRolling.__iter__()
withcenter=True
now works correctly. (GH6739, PR6744) By Michael Niklas.
Internal Changes#
xarray.core.groupby
,xarray.core.rolling
,xarray.core.rolling_exp
,xarray.core.weighted
andxarray.core.resample
modules are no longer imported by default. (PR6702)
v2022.06.0rc0 (9 June 2022)#
This pre-release brings a number of bug fixes and improvements, most notably a major internal
refactor of the indexing functionality and the use of flox in groupby
operations. It also stops
testing support for the abandoned PyNIO.
Install it using
mamba create -n <name> python=3.10 xarray
python -m pip install --pre --upgrade --no-deps xarray
Many thanks to the 39 contributors:
Abel Soares Siqueira, Alex Santana, Anderson Banihirwe, Benoit Bovy, Blair Bonnett, Brewster Malevich, brynjarmorka, Charles Stern, Christian Jauvin, Deepak Cherian, Emma Marshall, Fabien Maussion, Greg Behm, Guelate Seyo, Illviljan, Joe Hamman, Joseph K Aicher, Justus Magin, Kevin Paul, Louis Stenger, Mathias Hauser, Mattia Almansi, Maximilian Roos, Michael Bauer, Michael Delgado, Mick, ngam, Oleh Khoma, Oriol Abril-Pla, Philippe Blain, PLSeuJ, Sam Levang, Spencer Clark, Stan West, Thomas Nicholas, Thomas Vogt, Tom White, Xianxiang Li
Known Regressions#
reset_coords(drop=True) does not create indexes (GH6607)
New Features#
The zarr backend is now able to read NCZarr. By Mattia Almansi.
Add a weighted
quantile
method toDatasetWeighted
andDataArrayWeighted
(PR6059). By Christian Jauvin and David Huard.Add a
create_index=True
parameter toDataset.stack()
andDataArray.stack()
so that the creation of multi-indexes is optional (PR5692). By Benoît Bovy.Multi-index levels are now accessible through their own, regular coordinates instead of virtual coordinates (PR5692). By Benoît Bovy.
Add a
display_values_threshold
option to control the total number of array elements which trigger summarization rather than full repr in (numpy) array detailed views of the html repr (PR6400). By Benoît Bovy.Allow passing chunks in
kwargs
form toDataset.chunk()
,DataArray.chunk()
, andVariable.chunk()
. (PR6471) By Tom Nicholas.Add
core.groupby.DatasetGroupBy.cumsum()
andcore.groupby.DataArrayGroupBy.cumsum()
. By Vladislav Skripniuk and Deepak Cherian. (PR3147, PR6525, GH3141)Expose inline_array kwarg from dask.array.from_array in
open_dataset()
,Dataset.chunk()
,DataArray.chunk()
, andVariable.chunk()
. (PR6471)Expose the
inline_array
kwarg fromdask.array.from_array()
inopen_dataset()
,Dataset.chunk()
,DataArray.chunk()
, andVariable.chunk()
. (PR6471) By Tom Nicholas.polyval()
now supportsDataset
andDataArray
args of any shape, is faster and requires less memory. (PR6548) By Michael Niklas.Improved overall typing.
Dataset.to_dict()
andDataArray.to_dict()
may now optionally include encoding attributes. (PR6635) By Joe Hamman.Upload development versions to TestPyPI. By Justus Magin.
Breaking changes#
PyNIO support is now untested. The minimum versions of some dependencies were changed:
Package
Old
New
cftime
1.2
1.4
dask
2.30
2021.4
distributed
2.30
2021.4
h5netcdf
0.8
0.11
matplotlib-base
3.3
3.4
numba
0.51
0.53
numpy
1.18
1.19
pandas
1.1
1.2
pint
0.16
0.17
rasterio
1.1
1.2
scipy
1.5
1.6
sparse
0.11
0.12
zarr
2.5
2.8
The Dataset and DataArray
rename``
methods do not implicitly add or drop indexes. (PR5692). By Benoît Bovy.Many arguments like
keep_attrs
,axis
, andskipna
are now keyword only for all reduction operations like.mean
. By Deepak Cherian, Jimmy Westling.Xarray’s ufuncs have been removed, now that they can be replaced by numpy’s ufuncs in all supported versions of numpy. By Maximilian Roos.
xr.polyval()
now uses thecoord
argument directly instead of its index coordinate. (PR6548) By Michael Niklas.
Bug fixes#
Dataset.to_zarr()
now allows to write all attribute types supported by zarr-python. By Mattia Almansi.Set
skipna=None
for allquantile
methods (e.g.Dataset.quantile()
) and ensure it skips missing values for float dtypes (consistent with other methods). This should not change the behavior (PR6303). By Mathias Hauser.Many bugs fixed by the explicit indexes refactor, mainly related to multi-index (virtual) coordinates. See the corresponding pull-request on GitHub for more details. (PR5692). By Benoît Bovy.
Fixed “unhashable type” error trying to read NetCDF file with variable having its ‘units’ attribute not
str
(e.g.numpy.ndarray
) (GH6368). By Oleh Khoma.Omit warning about specified dask chunks separating chunks on disk when the underlying array is empty (e.g., because of an empty dimension) (GH6401). By Joseph K Aicher.
Fixed the poor html repr performance on large multi-indexes (PR6400). By Benoît Bovy.
Allow fancy indexing of duck dask arrays along multiple dimensions. (PR6414) By Justus Magin.
In the API for backends, support dimensions that express their preferred chunk sizes as a tuple of integers. (GH6333, PR6334) By Stan West.
Fix bug in
where()
when passing non-xarray objects withkeep_attrs=True
. (GH6444, PR6461) By Sam Levang.Allow passing both
other
anddrop=True
arguments toDataArray.where()
andDataset.where()
(PR6466, PR6467). By Michael Delgado.Ensure dtype encoding attributes are not added or modified on variables that contain datetime-like values prior to being passed to
xarray.conventions.decode_cf_variable()
(GH6453, PR6489). By Spencer Clark.Dark themes are now properly detected in Furo-themed Sphinx documents (GH6500, PR6501). By Kevin Paul.
Dataset.isel()
,DataArray.isel()
with drop=True works as intended with scalarDataArray
indexers. (GH6554, PR6579) By Michael Niklas.Fixed silent overflow issue when decoding times encoded with 32-bit and below unsigned integer data types (GH6589, PR6598). By Spencer Clark.
Fixed
.chunks
loading lazy data (GH6538). By Deepak Cherian.
Documentation#
Revise the documentation for developers on specifying a backend’s preferred chunk sizes. In particular, correct the syntax and replace lists with tuples in the examples. (GH6333, PR6334) By Stan West.
Mention that
DataArray.rename()
can rename coordinates. (GH5458, PR6665) By Michael Niklas.Added examples to
Dataset.thin()
andDataArray.thin()
By Emma Marshall.
Performance#
GroupBy binary operations are now vectorized. Previously this involved looping over all groups. (GH5804, PR6160) By Deepak Cherian.
Substantially improved GroupBy operations using flox. This is auto-enabled when
flox
is installed. Usexr.set_options(use_flox=False)
to use the old algorithm. (GH4473, GH4498, GH659, GH2237, PR271). By Deepak Cherian, Anderson Banihirwe, Jimmy Westling.
Internal Changes#
Many internal changes due to the explicit indexes refactor. See the corresponding pull-request on GitHub for more details. (PR5692). By Benoît Bovy.
v2022.03.0 (2 March 2022)#
This release brings a number of small improvements, as well as a move to calendar versioning (GH6176).
Many thanks to the 16 contributors to the v2022.02.0 release!
Aaron Spring, Alan D. Snow, Anderson Banihirwe, crusaderky, Illviljan, Joe Hamman, Jonas Gliß, Lukas Pilz, Martin Bergemann, Mathias Hauser, Maximilian Roos, Romain Caneill, Stan West, Stijn Van Hoey, Tobias Kölling, and Tom Nicholas.
New Features#
Enabled multiplying tick offsets by floats. Allows
float
n
inCFTimeIndex.shift()
ifshift_freq
is betweenDay
andMicrosecond
. (GH6134, PR6135). By Aaron Spring.Enable providing more keyword arguments to the pydap backend when reading OpenDAP datasets (GH6274). By Jonas Gliß <https://github.com/jgliss>.
Allow
DataArray.drop_duplicates()
to drop duplicates along multiple dimensions at once, and addDataset.drop_duplicates()
. (PR6307) By Tom Nicholas.
Breaking changes#
Renamed the
interpolation
keyword of allquantile
methods (e.g.DataArray.quantile()
) tomethod
for consistency with numpy v1.22.0 (PR6108). By Mathias Hauser.
Deprecations#
Bug fixes#
Variables which are chunked using dask in larger (but aligned) chunks than the target zarr chunk size can now be stored using to_zarr() (PR6258) By Tobias Kölling.
Multi-file datasets containing encoded
cftime.datetime
objects can be read in parallel again (GH6226, PR6249, PR6305). By Martin Bergemann and Stan West.
Documentation#
Internal Changes#
v0.21.1 (31 January 2022)#
This is a bugfix release to resolve (GH6216, PR6207).
Bug fixes#
Add packaging as a dependency to Xarray (GH6216, PR6207). By Sebastian Weigand and Joe Hamman.
v0.21.0 (27 January 2022)#
Many thanks to the 20 contributors to the v0.21.0 release!
Abel Aoun, Anderson Banihirwe, Ant Gib, Chris Roat, Cindy Chiao, Deepak Cherian, Dominik Stańczak, Fabian Hofmann, Illviljan, Jody Klymak, Joseph K Aicher, Mark Harfouche, Mathias Hauser, Matthew Roeschke, Maximilian Roos, Michael Delgado, Pascal Bourgault, Pierre, Ray Bell, Romain Caneill, Tim Heap, Tom Nicholas, Zeb Nicholls, joseph nowak, keewis.
New Features#
New top-level function
cross()
. (GH3279, PR5365). By Jimmy Westling.keep_attrs
support forwhere()
(GH4141, GH4682, PR4687). By Justus Magin.Enable the limit option for dask array in the following methods
DataArray.ffill()
,DataArray.bfill()
,Dataset.ffill()
andDataset.bfill()
(GH6112) By Joseph Nowak.
Breaking changes#
Rely on matplotlib’s default datetime converters instead of pandas’ (GH6102, PR6109). By Jimmy Westling.
Improve repr readability when there are a large number of dimensions in datasets or dataarrays by wrapping the text once the maximum display width has been exceeded. (GH5546, PR5662) By Jimmy Westling.
Deprecations#
Removed the lock kwarg from the zarr and pydap backends, completing the deprecation cycle started in GH5256. By Tom Nicholas.
Support for
python 3.7
has been dropped. (PR5892) By Jimmy Westling.
Bug fixes#
Preserve chunks when creating a
DataArray
from anotherDataArray
(PR5984). By Fabian Hofmann.Properly support
DataArray.ffill()
,DataArray.bfill()
,Dataset.ffill()
andDataset.bfill()
along chunked dimensions (GH6112). By Joseph Nowak.Subclasses of
byte
andstr
(e.g.np.str_
andnp.bytes_
) will now serialise to disk rather than raising aValueError: unsupported dtype for netCDF4 variable: object
as they did previously (PR5264). By Zeb Nicholls.Fix applying function with non-xarray arguments using
xr.map_blocks()
. By Cindy Chiao.No longer raise an error for an all-nan-but-one argument to
DataArray.interpolate_na()
when using method=’nearest’ (GH5994, PR6144). By Michael Delgado.dt.season can now handle NaN and NaT. (PR5876). By Pierre Loicq.
Determination of zarr chunks handles empty lists for encoding chunks or variable chunks that occurs in certain circumstances (PR5526). By Chris Roat.
Internal Changes#
Replace
distutils.version
withpackaging.version
(GH6092). By Mathias Hauser.Removed internal checks for
pd.Panel
(GH6145). By Matthew Roeschke.Add
pyupgrade
pre-commit hook (PR6152). By Maximilian Roos.
v0.20.2 (9 December 2021)#
This is a bugfix release to resolve (GH3391, GH5715). It also
includes performance improvements in unstacking to a sparse
array and a
number of documentation improvements.
Many thanks to the 20 contributors:
Aaron Spring, Alexandre Poux, Deepak Cherian, Enrico Minack, Fabien Maussion, Giacomo Caria, Gijom, Guillaume Maze, Illviljan, Joe Hamman, Joseph Hardin, Kai Mühlbauer, Matt Henderson, Maximilian Roos, Michael Delgado, Robert Gieseke, Sebastian Weigand and Stephan Hoyer.
Breaking changes#
Use complex nan when interpolating complex values out of bounds by default (instead of real nan) (PR6019). By Alexandre Poux.
Performance#
Significantly faster unstacking to a
sparse
array. PR5577 By Deepak Cherian.
Bug fixes#
xr.map_blocks()
andxr.corr()
now work when dask is not installed (GH3391, GH5715, PR5731). By Gijom.Fix plot.line crash for data of shape
(1, N)
in _title_for_slice on format_item (PR5948). By Sebastian Weigand.Fix a regression in the removal of duplicate backend entrypoints (GH5944, PR5959) By Kai Mühlbauer.
Fix an issue that datasets from being saved when time variables with units that
cftime
can parse but pandas can not were present (PR6049). By Tim Heap.
Documentation#
Better examples in docstrings for groupby and resampling reductions (PR5871). By Deepak Cherian, Maximilian Roos, Jimmy Westling .
Add list-like possibility for tolerance parameter in the reindex functions. By Antoine Gibek,
Internal Changes#
Use
importlib
to replace functionality ofpkg_resources
in backend plugins tests. (PR5959). By Kai Mühlbauer.
v0.20.1 (5 November 2021)#
This is a bugfix release to fix GH5930.
Bug fixes#
Fix a regression in the detection of the backend entrypoints (GH5930, PR5931) By Justus Magin.
Documentation#
Significant improvements to API reference. By Deepak Cherian.
v0.20.0 (1 November 2021)#
This release brings improved support for pint arrays, methods for weighted standard deviation, variance, and sum of squares, the option to disable the use of the bottleneck library, significantly improved performance of unstack, as well as many bugfixes and internal changes.
Many thanks to the 40 contributors to this release!:
Aaron Spring, Akio Taniguchi, Alan D. Snow, arfy slowy, Benoit Bovy, Christian Jauvin, crusaderky, Deepak Cherian, Giacomo Caria, Illviljan, James Bourbeau, Joe Hamman, Joseph K Aicher, Julien Herzen, Kai Mühlbauer, keewis, lusewell, Martin K. Scherer, Mathias Hauser, Max Grover, Maxime Liquet, Maximilian Roos, Mike Taves, Nathan Lis, pmav99, Pushkar Kopparla, Ray Bell, Rio McMahon, Scott Staniewicz, Spencer Clark, Stefan Bender, Taher Chegini, Thomas Nicholas, Tomas Chor, Tom Augspurger, Victor Negîrneac, Zachary Blackwood, Zachary Moon, and Zeb Nicholls.
New Features#
Add
std
,var
,sum_of_squares
toDatasetWeighted
andDataArrayWeighted
. By Christian Jauvin.Added a
get_options()
method to xarray’s root namespace (GH5698, PR5716) By Pushkar Kopparla.Xarray now does a better job rendering variable names that are long LaTeX sequences when plotting (GH5681, PR5682). By Tomas Chor.
Add an option (
"use_bottleneck"
) to disable the use ofbottleneck
usingset_options()
(PR5560) By Justus Magin.Added
**kwargs
argument toopen_rasterio()
to access overviews (GH3269). By Pushkar Kopparla.Added
storage_options
argument toto_zarr()
(GH5601, PR5615). By Ray Bell, Zachary Blackwood and Nathan Lis.Added calendar utilities
DataArray.convert_calendar()
,DataArray.interp_calendar()
,date_range()
,date_range_like()
andDataArray.dt.calendar
(GH5155, PR5233). By Pascal Bourgault.Histogram plots are set with a title displaying the scalar coords if any, similarly to the other plots (GH5791, PR5792). By Maxime Liquet.
Slice plots display the coords units in the same way as x/y/colorbar labels (PR5847). By Victor Negîrneac.
Added a new
Dataset.chunksizes
,DataArray.chunksizes
, andVariable.chunksizes
property, which will always return a mapping from dimension names to chunking pattern along that dimension, regardless of whether the object is a Dataset, DataArray, or Variable. (GH5846, PR5900) By Tom Nicholas.
Breaking changes#
The minimum versions of some dependencies were changed:
Package
Old
New
cftime
1.1
1.2
dask
2.15
2.30
distributed
2.15
2.30
lxml
4.5
4.6
matplotlib-base
3.2
3.3
numba
0.49
0.51
numpy
1.17
1.18
pandas
1.0
1.1
pint
0.15
0.16
scipy
1.4
1.5
seaborn
0.10
0.11
sparse
0.8
0.11
toolz
0.10
0.11
zarr
2.4
2.5
The
__repr__
of axarray.Dataset
’scoords
anddata_vars
ignorexarray.set_option(display_max_rows=...)
and show the full output when called directly as, e.g.,ds.data_vars
orprint(ds.data_vars)
(GH5545, PR5580). By Stefan Bender.
Deprecations#
Set the default argument for roll_coords to False for
DataArray.roll()
andDataset.roll()
. (PR5653) By Tom Nicholas.xarray.open_mfdataset()
will now error instead of warn when a value forconcat_dim
is passed alongsidecombine='by_coords'
. By Tom Nicholas.
Bug fixes#
Fix ZeroDivisionError from saving dask array with empty dimension (:issue: 5741). By Joseph K Aicher.
Fixed performance bug where
cftime
import attempted within various core operations ifcftime
not installed (PR5640). By Luke SewellFixed bug when combining named DataArrays using
combine_by_coords()
. (PR5834). By Tom Nicholas.When a custom engine was used in
open_dataset()
the engine wasn’t initialized properly, causing missing argument errors or inconsistent method signatures. (PR5684) By Jimmy Westling.Numbers are properly formatted in a plot’s title (GH5788, PR5789). By Maxime Liquet.
Faceted plots will no longer raise a pint.UnitStrippedWarning when a pint.Quantity array is plotted, and will correctly display the units of the data in the colorbar (if there is one) (PR5886). By Tom Nicholas.
With backends, check for path-like objects rather than
pathlib.Path
type, useos.fspath
(PR5879). By Mike Taves.open_mfdataset()
now accepts a singlepathlib.Path
object (:issue: 5881). By Panos Mavrogiorgos.Improved performance of
Dataset.unstack()
(PR5906). By Tom Augspurger.
Documentation#
Users are instructed to try
use_cftime=True
if aTypeError
occurs when combining datasets and one of the types involved is a subclass ofcftime.datetime
(PR5776). By Zeb Nicholls.A clearer error is now raised if a user attempts to assign a Dataset to a single key of another Dataset. (PR5839) By Tom Nicholas.
Internal Changes#
Explicit indexes refactor: avoid
len(index)
inmap_blocks
(PR5670). By Deepak Cherian.Explicit indexes refactor: decouple
xarray.Index`
fromxarray.Variable
(PR5636). By Benoit Bovy.Fix
Mapping
argument typing to allow mypy to pass onstr
keys (PR5690). By Maximilian Roos.Annotate many of our tests, and fix some of the resulting typing errors. This will also mean our typing annotations are tested as part of CI. (PR5728). By Maximilian Roos.
Improve the performance of reprs for large datasets or dataarrays. (PR5661) By Jimmy Westling.
Use isort’s float_to_top config. (PR5695). By Maximilian Roos.
Remove use of the deprecated
kind
argument inpandas.Index.get_slice_bound()
insidexarray.CFTimeIndex
tests (PR5723). By Spencer Clark.Refactor xarray.core.duck_array_ops to no longer special-case dispatching to dask versions of functions when acting on dask arrays, instead relying numpy and dask’s adherence to NEP-18 to dispatch automatically. (PR5571) By Tom Nicholas.
Add an ASV benchmark CI and improve performance of the benchmarks (PR5796) By Jimmy Westling.
Use
importlib
to replace functionality ofpkg_resources
such as version setting and loading of resources. (PR5845). By Martin K. Scherer.
v0.19.0 (23 July 2021)#
This release brings improvements to plotting of categorical data, the ability to specify how attributes
are combined in xarray operations, a new high-level unify_chunks()
function, as well as various
deprecations, bug fixes, and minor improvements.
Many thanks to the 29 contributors to this release!:
Andrew Williams, Augustus, Aureliana Barghini, Benoit Bovy, crusaderky, Deepak Cherian, ellesmith88, Elliott Sales de Andrade, Giacomo Caria, github-actions[bot], Illviljan, Joeperdefloep, joooeey, Julia Kent, Julius Busecke, keewis, Mathias Hauser, Matthias Göbel, Mattia Almansi, Maximilian Roos, Peter Andreas Entschev, Ray Bell, Sander, Santiago Soler, Sebastian, Spencer Clark, Stephan Hoyer, Thomas Hirtz, Thomas Nicholas.
New Features#
Allow passing argument
missing_dims
toVariable.transpose()
andDataset.transpose()
(GH5550, PR5586) By Giacomo Caria.Allow passing a dictionary as coords to a
DataArray
(GH5527, reverts PR1539, which had deprecated this due to python’s inconsistent ordering in earlier versions). By Sander van Rijn.Added
Dataset.coarsen.construct()
,DataArray.coarsen.construct()
(GH5454, PR5475). By Deepak Cherian.Xarray now uses consolidated metadata by default when writing and reading Zarr stores (GH5251). By Stephan Hoyer.
New top-level function
unify_chunks()
. By Mattia Almansi.Allow assigning values to a subset of a dataset using positional or label-based indexing (GH3015, PR5362). By Matthias Göbel.
Attempting to reduce a weighted object over missing dimensions now raises an error (PR5362). By Mattia Almansi.
Add
.sum
torolling_exp()
androlling_exp()
for exponentially weighted rolling sums. These require numbagg 0.2.1; (PR5178). By Maximilian Roos.xarray.cov()
andxarray.corr()
now lazily check for missing values if inputs are dask arrays (GH4804, PR5284). By Andrew Williams.Attempting to
concat
list of elements that are not allDataset
or allDataArray
now raises an error (GH5051, PR5425). By Thomas Hirtz.allow passing a function to
combine_attrs
(PR4896). By Justus Magin.Allow plotting categorical data (PR5464). By Jimmy Westling.
Allow removal of the coordinate attribute
coordinates
on variables by setting.attrs['coordinates']= None
(GH5510). By Elle Smith.Added
DataArray.to_numpy()
,DataArray.as_numpy()
, andDataset.as_numpy()
. (PR5568). By Tom Nicholas.Units in plot labels are now automatically inferred from wrapped
pint.Quantity()
arrays. (PR5561). By Tom Nicholas.
Breaking changes#
The default
mode
forDataset.to_zarr()
whenregion
is set has changed to the newmode="r+"
, which only allows for overriding pre-existing array values. This is a safer default than the priormode="a"
, and allows for higher performance writes (PR5252). By Stephan Hoyer.The main parameter to
combine_by_coords()
is renamed to data_objects instead of datasets so anyone calling this method using a named parameter will need to update the name accordingly (GH3248, PR4696). By Augustus Ijams.
Deprecations#
Removed the deprecated
dim
kwarg toDataArray.integrate()
(PR5630)Removed the deprecated
keep_attrs
kwarg toDataArray.rolling()
(PR5630)Removed the deprecated
keep_attrs
kwarg toDataArray.coarsen()
(PR5630)Completed deprecation of passing an
xarray.DataArray
toVariable()
- will now raise aTypeError
(PR5630)
Bug fixes#
Fix a minor incompatibility between partial datetime string indexing with a
CFTimeIndex
and upcoming pandas version 1.3.0 (GH5356, PR5359). By Spencer Clark.Fix 1-level multi-index incorrectly converted to single index (GH5384, PR5385). By Benoit Bovy.
Don’t cast a duck array in a coordinate to
numpy.ndarray
inDataArray.differentiate()
(PR5408) By Justus Magin.Fix the
repr
ofVariable
objects withdisplay_expand_data=True
(PR5406) By Justus Magin.Plotting a pcolormesh with
xscale="log"
and/oryscale="log"
works as expected after improving the way the interval breaks are generated (GH5333). By Santiago Solercombine_by_coords()
can now handle combining a list of unnamedDataArray
as input (GH3248, PR4696). By Augustus Ijams.
Internal Changes#
Run CI on the first & last python versions supported only; currently 3.7 & 3.9. (PR5433) By Maximilian Roos.
Publish test results & timings on each PR. (PR5537) By Maximilian Roos.
Explicit indexes refactor: add a
xarray.Index.query()
method in which one may eventually provide a custom implementation of label-based data selection (not ready yet for public use). Also refactor the internal, pandas-specific implementation intoPandasIndex.query()
andPandasMultiIndex.query()
(PR5322). By Benoit Bovy.
v0.18.2 (19 May 2021)#
This release reverts a regression in xarray’s unstacking of dask-backed arrays.
v0.18.1 (18 May 2021)#
This release is intended as a small patch release to be compatible with the new
2021.5.0 dask.distributed
release. It also includes a new
drop_duplicates
method, some documentation improvements, the beginnings of
our internal Index refactoring, and some bug fixes.
Thank you to all 16 contributors!
Anderson Banihirwe, Andrew, Benoit Bovy, Brewster Malevich, Giacomo Caria, Illviljan, James Bourbeau, Keewis, Maximilian Roos, Ravin Kumar, Stephan Hoyer, Thomas Nicholas, Tom Nicholas, Zachary Moon.
New Features#
Implement
DataArray.drop_duplicates()
to remove duplicate dimension values (PR5239). By Andrew Huang.Allow passing
combine_attrs
strategy names to thekeep_attrs
parameter ofapply_ufunc()
(PR5041) By Justus Magin.Dataset.interp()
now allows interpolation with non-numerical datatypes, such as booleans, instead of dropping them. (GH4761 PR5008). By Jimmy Westling.Raise more informative error when decoding time variables with invalid reference dates. (GH5199, PR5288). By Giacomo Caria.
Bug fixes#
Opening netCDF files from a path that doesn’t end in
.nc
without supplying an explicitengine
works again (GH5295), fixing a bug introduced in 0.18.0. By Stephan Hoyer
Documentation#
Clean up and enhance docstrings for the
DataArray.plot
andDataset.plot.*
families of methods (PR5285). By Zach Moon.Explanation of deprecation cycles and how to implement them added to contributors guide. (PR5289) By Tom Nicholas.
Internal Changes#
Explicit indexes refactor: add an
xarray.Index
base class andDataset.xindexes
/DataArray.xindexes
properties. Also renamePandasIndexAdapter
toPandasIndex
, which now inherits fromxarray.Index
(PR5102). By Benoit Bovy.Replace
SortedKeysDict
with python’sdict
, given dicts are now ordered. By Maximilian Roos.Updated the release guide for developers. Now accounts for actions that are automated via github actions. (PR5274). By Tom Nicholas.
v0.18.0 (6 May 2021)#
This release brings a few important performance improvements, a wide range of usability upgrades, lots of bug fixes, and some new features. These include a plugin API to add backend engines, a new theme for the documentation, curve fitting methods, and several new plotting functions.
Many thanks to the 38 contributors to this release: Aaron Spring, Alessandro Amici, Alex Marandon, Alistair Miles, Ana Paula Krelling, Anderson Banihirwe, Aureliana Barghini, Baudouin Raoult, Benoit Bovy, Blair Bonnett, David Trémouilles, Deepak Cherian, Gabriel Medeiros Abrahão, Giacomo Caria, Hauke Schulz, Illviljan, Mathias Hauser, Matthias Bussonnier, Mattia Almansi, Maximilian Roos, Ray Bell, Richard Kleijn, Ryan Abernathey, Sam Levang, Spencer Clark, Spencer Jones, Tammas Loughran, Tobias Kölling, Todd, Tom Nicholas, Tom White, Victor Negîrneac, Xianxiang Li, Zeb Nicholls, crusaderky, dschwoerer, johnomotani, keewis
New Features#
apply
combine_attrs
on data variables and coordinate variables when concatenating and merging datasets and dataarrays (PR4902). By Justus Magin.Add
Dataset.to_pandas()
(PR5247) By Giacomo Caria.Add
DataArray.plot.surface()
which wraps matplotlib’s plot_surface to make surface plots (GH2235 GH5084 PR5101). By John Omotani.Allow passing multiple arrays to
Dataset.__setitem__()
(PR5216). By Giacomo Caria.Add ‘cumulative’ option to
Dataset.integrate()
andDataArray.integrate()
so that result is a cumulative integral, likescipy.integrate.cumulative_trapezoidal()
(PR5153). By John Omotani.Add
safe_chunks
option toDataset.to_zarr()
which allows overriding checks made to ensure Dask and Zarr chunk compatibility (GH5056). By Ryan AbernatheyAdd
Dataset.query()
andDataArray.query()
which enable indexing of datasets and data arrays by evaluating query expressions against the values of the data variables (PR4984). By Alistair Miles.Allow passing
combine_attrs
toDataset.merge()
(PR4895). By Justus Magin.Support for dask.graph_manipulation (requires dask >=2021.3) By Guido Imperiale
Add
Dataset.plot.streamplot()
for streamplot plots withDataset
variables (PR5003). By John Omotani.Many of the arguments for the
DataArray.str
methods now support providing an array-like input. In this case, the array provided to the arguments is broadcast against the original array and applied elementwise.DataArray.str
now supports+
,*
, and%
operators. These behave the same as they do forstr
, except that they follow array broadcasting rules.A large number of new
DataArray.str
methods were implemented,DataArray.str.casefold()
,DataArray.str.cat()
,DataArray.str.extract()
,DataArray.str.extractall()
,DataArray.str.findall()
,DataArray.str.format()
,DataArray.str.get_dummies()
,DataArray.str.islower()
,DataArray.str.join()
,DataArray.str.normalize()
,DataArray.str.partition()
,DataArray.str.rpartition()
,DataArray.str.rsplit()
, andDataArray.str.split()
. A number of these methods allow for splitting or joining the strings in an array. (GH4622) By Todd JenningsThanks to the new pluggable backend infrastructure external packages may now use the
xarray.backends
entry point to register additional engines to be used inopen_dataset()
, see the documentation in How to add a new backend (GH4309, GH4803, PR4989, PR4810 and many others). The backend refactor has been sponsored with the “Essential Open Source Software for Science” grant from the Chan Zuckerberg Initiative and developed by B-Open. By Aureliana Barghini and Alessandro Amici.date
added (GH4983, PR4994). By Hauke Schulz.Implement
__getitem__
for bothDatasetGroupBy
andDataArrayGroupBy
, inspired by pandas’get_group()
. By Deepak Cherian.Switch the tutorial functions to use pooch (which is now a optional dependency) and add
tutorial.open_rasterio()
as a way to open example rasterio files (GH3986, PR4102, PR5074). By Justus Magin.Add typing information to unary and binary arithmetic operators operating on
Dataset
,DataArray
,Variable
,DatasetGroupBy
orDataArrayGroupBy
(PR4904). By Richard Kleijn.Add a
combine_attrs
parameter toopen_mfdataset()
(PR4971). By Justus Magin.Enable passing arrays with a subset of dimensions to
DataArray.clip()
&Dataset.clip()
; these methods now usexarray.apply_ufunc()
; (PR5184). By Maximilian Roos.Disable the cfgrib backend if the eccodes library is not installed (PR5083). By Baudouin Raoult.
Added
DataArray.curvefit()
andDataset.curvefit()
for general curve fitting applications. (GH4300, PR4849) By Sam Levang.Add options to control expand/collapse of sections in display of Dataset and DataArray. The function
set_options()
now takes keyword argumentsdisplay_expand_attrs
,display_expand_coords
,display_expand_data
,display_expand_data_vars
, all of which can be one ofTrue
to always expand,False
to always collapse, ordefault
to expand unless over a pre-defined limit (PR5126). By Tom White.Significant speedups in
Dataset.interp()
andDataArray.interp()
. (GH4739, PR4740). By Deepak Cherian.Prevent passing concat_dim to
xarray.open_mfdataset()
when combine=’by_coords’ is specified, which should never have been possible (asxarray.combine_by_coords()
has no concat_dim argument to pass to). Also removes unneeded internal reordering of datasets inxarray.open_mfdataset()
when combine=’by_coords’ is specified. Fixes (GH5230). By Tom Nicholas.Implement
__setitem__
forxarray.core.indexing.DaskIndexingAdapter
if dask version supports item assignment. (GH5171, PR5174) By Tammas Loughran.
Breaking changes#
The minimum versions of some dependencies were changed:
Package
Old
New
boto3
1.12
1.13
cftime
1.0
1.1
dask
2.11
2.15
distributed
2.11
2.15
matplotlib
3.1
3.2
numba
0.48
0.49
open_dataset()
andopen_dataarray()
now accept only the first argument as positional, all others need to be passed are keyword arguments. This is part of the refactor to support external backends (GH4309, PR4989). By Alessandro Amici.Functions that are identities for 0d data return the unchanged data if axis is empty. This ensures that Datasets where some variables do not have the averaged dimensions are not accidentally changed (GH4885, PR5207). By David Schwörer.
DataArray.coarsen
andDataset.coarsen
no longer support passingkeep_attrs
via its constructor. Passkeep_attrs
via the applied function, i.e. useds.coarsen(...).mean(keep_attrs=False)
instead ofds.coarsen(..., keep_attrs=False).mean()
. Further, coarsen now keeps attributes per default (PR5227). By Mathias Hauser.switch the default of the
merge()
combine_attrs
parameter to"override"
. This will keep the current behavior for merging theattrs
of variables but stop dropping theattrs
of the main objects (PR4902). By Justus Magin.
Deprecations#
Warn when passing concat_dim to
xarray.open_mfdataset()
when combine=’by_coords’ is specified, which should never have been possible (asxarray.combine_by_coords()
has no concat_dim argument to pass to). Also removes unneeded internal reordering of datasets inxarray.open_mfdataset()
when combine=’by_coords’ is specified. Fixes (GH5230), via (PR5231, PR5255). By Tom Nicholas.The lock keyword argument to
open_dataset()
andopen_dataarray()
is now a backend specific option. It will give a warning if passed to a backend that doesn’t support it instead of being silently ignored. From the next version it will raise an error. This is part of the refactor to support external backends (GH5073). By Tom Nicholas and Alessandro Amici.
Bug fixes#
Properly support
DataArray.ffill()
,DataArray.bfill()
,Dataset.ffill()
,Dataset.bfill()
along chunked dimensions. (GH2699). By Deepak Cherian.Fix 2d plot failure for certain combinations of dimensions when x is 1d and y is 2d (GH5097, PR5099). By John Omotani.
Ensure standard calendar times encoded with large values (i.e. greater than approximately 292 years), can be decoded correctly without silently overflowing (PR5050). This was a regression in xarray 0.17.0. By Zeb Nicholls.
Added support for numpy.bool_ attributes in roundtrips using h5netcdf engine with invalid_netcdf=True [which casts bool`s to `numpy.bool_] (GH4981, PR4986). By Victor Negîrneac.
Don’t allow passing
axis
toDataset.reduce()
methods (GH3510, PR4940). By Justus Magin.Decode values as signed if attribute _Unsigned = “false” (GH4954) By Tobias Kölling.
Keep coords attributes when interpolating when the indexer is not a Variable. (GH4239, GH4839 PR5031) By Jimmy Westling.
Ensure standard calendar dates encoded with a calendar attribute with some or all uppercase letters can be decoded or encoded to or from
np.datetime64[ns]
dates with or withoutcftime
installed (GH5093, PR5180). By Spencer Clark.Warn on passing
keep_attrs
toresample
androlling_exp
as they are ignored, passkeep_attrs
to the applied function instead (PR5265). By Mathias Hauser.
Documentation#
New section on How to add a new backend in the “Internals” chapter aimed to backend developers (GH4803, PR4810). By Aureliana Barghini.
Add
Dataset.polyfit()
andDataArray.polyfit()
under “See also” in the docstrings ofDataset.polyfit()
andDataArray.polyfit()
(GH5016, PR5020). By Aaron Spring.New sphinx theme & rearrangement of the docs (PR4835). By Anderson Banihirwe.
Internal Changes#
Enable displaying mypy error codes and ignore only specific error codes using
# type: ignore[error-code]
(PR5096). By Mathias Hauser.Replace uses of
raises_regex
with the more standardpytest.raises(Exception, match="foo")
; (PR5188), (PR5191). By Maximilian Roos.
v0.17.0 (24 Feb 2021)#
This release brings a few important performance improvements, a wide range of
usability upgrades, lots of bug fixes, and some new features. These include
better cftime
support, a new quiver plot, better unstack
performance,
more efficient memory use in rolling operations, and some python packaging
improvements. We also have a few documentation improvements (and more planned!).
Many thanks to the 36 contributors to this release: Alessandro Amici, Anderson Banihirwe, Aureliana Barghini, Ayrton Bourn, Benjamin Bean, Blair Bonnett, Chun Ho Chow, DWesl, Daniel Mesejo-León, Deepak Cherian, Eric Keenan, Illviljan, Jens Hedegaard Nielsen, Jody Klymak, Julien Seguinot, Julius Busecke, Kai Mühlbauer, Leif Denby, Martin Durant, Mathias Hauser, Maximilian Roos, Michael Mann, Ray Bell, RichardScottOZ, Spencer Clark, Tim Gates, Tom Nicholas, Yunus Sevinchan, alexamici, aurghs, crusaderky, dcherian, ghislainp, keewis, rhkleijn
Breaking changes#
xarray no longer supports python 3.6
The minimum version policy was changed to also apply to projects with irregular releases. As a result, the minimum versions of some dependencies have changed:
Package
Old
New
Python
3.6
3.7
setuptools
38.4
40.4
numpy
1.15
1.17
pandas
0.25
1.0
dask
2.9
2.11
distributed
2.9
2.11
bottleneck
1.2
1.3
h5netcdf
0.7
0.8
iris
2.2
2.4
netcdf4
1.4
1.5
pseudonetcdf
3.0
3.1
rasterio
1.0
1.1
scipy
1.3
1.4
seaborn
0.9
0.10
zarr
2.3
2.4
As a result of PR4684 the default units encoding for datetime-like values (
np.datetime64[ns]
orcftime.datetime
) will now always be set such thatint64
values can be used. In the past, no units finer than “seconds” were chosen, which would sometimes mean thatfloat64
values were required, which would lead to inaccurate I/O round-trips.Variables referred to in attributes like
bounds
andgrid_mapping
can be set as coordinate variables. These attributes are moved toDataArray.encoding
fromDataArray.attrs
. This behaviour is controlled by thedecode_coords
kwarg toopen_dataset()
andopen_mfdataset()
. The full list of decoded attributes is in Weather and climate data (PR2844, GH3689)As a result of PR4911 the output from calling
DataArray.sum()
orDataArray.prod()
on an integer array withskipna=True
and a non-None value formin_count
will now be a float array rather than an integer array.
Deprecations#
dim
argument toDataArray.integrate()
is being deprecated in favour of acoord
argument, for consistency withDataset.integrate()
. For now usingdim
issues aFutureWarning
. It will be removed in version 0.19.0 (PR3993). By Tom Nicholas.Deprecated
autoclose
kwargs fromopen_dataset()
are removed (PR4725). By Aureliana Barghini.the return value of
Dataset.update()
is being deprecated to make it work more likedict.update()
. It will be removed in version 0.19.0 (PR4932). By Justus Magin.
New Features#
cftime_range()
andDataArray.resample()
now support millisecond ("L"
or"ms"
) and microsecond ("U"
or"us"
) frequencies forcftime.datetime
coordinates (GH4097, PR4758). By Spencer Clark.Significantly higher
unstack
performance on numpy-backed arrays which contain missing values; 8x faster than previous versions in our benchmark, and now 2x faster than pandas (PR4746). By Maximilian Roos.Add
Dataset.plot.quiver()
for quiver plots withDataset
variables. By Deepak Cherian.Add
"drop_conflicts"
to the strategies supported by thecombine_attrs
kwarg (GH4749, PR4827). By Justus Magin.Allow installing from git archives (PR4897). By Justus Magin.
DataArrayCoarsen
andDatasetCoarsen
now implement areduce
method, enabling coarsening operations with custom reduction functions (GH3741, PR4939). By Spencer Clark.Most rolling operations use significantly less memory. (GH4325). By Deepak Cherian.
Add
Dataset.drop_isel()
andDataArray.drop_isel()
(GH4658, PR4819). By Daniel Mesejo.Xarray now leverages updates as of cftime version 1.4.1, which enable exact I/O roundtripping of
cftime.datetime
objects (PR4758). By Spencer Clark.open_dataset()
andopen_mfdataset()
now acceptfsspec
URLs (including globs for the latter) forengine="zarr"
, and so allow reading from many remote and other file systems (PR4461) By Martin DurantDataArray.swap_dims()
&Dataset.swap_dims()
now accept dims in the form of kwargs as well as a dict, like most similar methods. By Maximilian Roos.
Bug fixes#
Use specific type checks in
xarray.core.variable.as_compatible_data
instead of blanket access tovalues
attribute (GH2097) By Yunus Sevinchan.DataArray.resample()
andDataset.resample()
do not trigger computations anymore ifDataset.weighted()
orDataArray.weighted()
are applied (GH4625, PR4668). By Julius Busecke.merge()
withcombine_attrs='override'
makes a copy of the attrs (GH4627).By default, when possible, xarray will now always use values of type
int64
when encoding and decodingnumpy.datetime64[ns]
datetimes. This ensures that maximum precision and accuracy are maintained in the round-tripping process (GH4045, PR4684). It also enables encoding and decoding standard calendar dates with time units of nanoseconds (PR4400). By Spencer Clark and Mark Harfouche.DataArray.astype()
,Dataset.astype()
andVariable.astype()
support theorder
andsubok
parameters again. This fixes a regression introduced in version 0.16.1 (GH4644, PR4683). By Richard Kleijn .Remove dictionary unpacking when using
.loc
to avoid collision with.sel
parameters (PR4695). By Anderson Banihirwe.Fix the legend created by
Dataset.plot.scatter()
(GH4641, PR4723). By Justus Magin.Fix a crash in orthogonal indexing on geographic coordinates with
engine='cfgrib'
(GH4733 PR4737). By Alessandro Amici.Coordinates with dtype
str
orbytes
now retain their dtype on many operations, e.g.reindex
,align
,concat
,assign
, previously they were cast to an object dtype (GH2658 and GH4543). By Mathias Hauser.Limit number of data rows when printing large datasets. (GH4736, PR4750). By Jimmy Westling.
Add
missing_dims
parameter to transpose (GH4647, PR4767). By Daniel Mesejo.Resolve intervals before appending other metadata to labels when plotting (GH4322, PR4794). By Justus Magin.
Fix regression when decoding a variable with a
scale_factor
andadd_offset
given as a list of length one (GH4631). By Mathias Hauser.Expand user directory paths (e.g.
~/
) inopen_mfdataset()
andDataset.to_zarr()
(GH4783, PR4795). By Julien Seguinot.Raise DeprecationWarning when trying to typecast a tuple containing a
DataArray
. User now prompted to first call .data on it (GH4483). By Chun Ho Chow.Ensure that
Dataset.interp()
raisesValueError
when interpolating outside coordinate range andbounds_error=True
(GH4854, PR4855). By Leif Denby.Fix time encoding bug associated with using cftime versions greater than 1.4.0 with xarray (GH4870, PR4871). By Spencer Clark.
Stop
DataArray.sum()
andDataArray.prod()
computing lazy arrays when called with amin_count
parameter (GH4898, PR4911). By Blair Bonnett.Fix bug preventing the
min_count
parameter toDataArray.sum()
andDataArray.prod()
working correctly when calculating over all axes of a float64 array (GH4898, PR4911). By Blair Bonnett.Fix decoding of vlen strings using h5py versions greater than 3.0.0 with h5netcdf backend (GH4570, PR4893). By Kai Mühlbauer.
Allow converting
Dataset
orDataArray
objects with aMultiIndex
and at least one other dimension to apandas
object (GH3008, PR4442). By ghislainp.
Documentation#
Add information about requirements for accessor classes (GH2788, PR4657). By Justus Magin.
Start a list of external I/O integrating with
xarray
(GH683, PR4566). By Justus Magin.Add concat examples and improve combining documentation (GH4620, PR4645). By Ray Bell and Justus Magin.
explicitly mention that
Dataset.update()
updates inplace (GH2951, PR4932). By Justus Magin.Added docs on vectorized indexing (PR4711). By Eric Keenan.
Internal Changes#
Speed up of the continuous integration tests on azure.
Switched to mamba and use matplotlib-base for a faster installation of all dependencies (PR4672).
Use
pytest.mark.skip
instead ofpytest.mark.xfail
for some tests that can currently not succeed (PR4685).Run the tests in parallel using pytest-xdist (PR4694).
By Justus Magin and Mathias Hauser.
Use
pyproject.toml
instead of thesetup_requires
option forsetuptools
(PR4897). By Justus Magin.Replace all usages of
assert x.identical(y)
withassert_identical(x, y)
for clearer error messages (PR4752). By Maximilian Roos.Speed up attribute style access (e.g.
ds.somevar
instead ofds["somevar"]
) and tab completion in IPython (GH4741, PR4742). By Richard Kleijn.Added the
set_close
method toDataset
andDataArray
for backends to specify how to voluntary release all resources. (PR#4809) By Alessandro Amici.Update type hints to work with numpy v1.20 (PR4878). By Mathias Hauser.
Ensure warnings cannot be turned into exceptions in
testing.assert_equal()
and the otherassert_*
functions (PR4864). By Mathias Hauser.Performance improvement when constructing DataArrays. Significantly speeds up repr for Datasets with large number of variables. By Deepak Cherian.
v0.16.2 (30 Nov 2020)#
This release brings the ability to write to limited regions of zarr
files,
open zarr files with open_dataset()
and open_mfdataset()
,
increased support for propagating attrs
using the keep_attrs
flag, as
well as numerous bugfixes and documentation improvements.
Many thanks to the 31 contributors who contributed to this release: Aaron Spring, Akio Taniguchi, Aleksandar Jelenak, alexamici, Alexandre Poux, Anderson Banihirwe, Andrew Pauling, Ashwin Vishnu, aurghs, Brian Ward, Caleb, crusaderky, Dan Nowacki, darikg, David Brochart, David Huard, Deepak Cherian, Dion Häfner, Gerardo Rivera, Gerrit Holl, Illviljan, inakleinbottle, Jacob Tomlinson, James A. Bednar, jenssss, Joe Hamman, johnomotani, Joris Van den Bossche, Julia Kent, Julius Busecke, Kai Mühlbauer, keewis, Keisuke Fujii, Kyle Cranmer, Luke Volpatti, Mathias Hauser, Maximilian Roos, Michaël Defferrard, Michal Baumgartner, Nick R. Papior, Pascal Bourgault, Peter Hausamann, PGijsbers, Ray Bell, Romain Martinez, rpgoldman, Russell Manser, Sahid Velji, Samnan Rahee, Sander, Spencer Clark, Stephan Hoyer, Thomas Zilio, Tobias Kölling, Tom Augspurger, Wei Ji, Yash Saboo, Zeb Nicholls,
Deprecations#
weekofyear
andweek
have been deprecated. UseDataArray.dt.isocalendar().week
instead (PR4534). By Mathias Hauser. Maximilian Roos, and Spencer Clark.DataArray.rolling
andDataset.rolling
no longer support passingkeep_attrs
via its constructor. Passkeep_attrs
via the applied function, i.e. useds.rolling(...).mean(keep_attrs=False)
instead ofds.rolling(..., keep_attrs=False).mean()
Rolling operations now keep their attributes per default (PR4510). By Mathias Hauser.
New Features#
open_dataset()
andopen_mfdataset()
now works withengine="zarr"
(GH3668, PR4003, PR4187). By Miguel Jimenez and Wei Ji Leong.Unary & binary operations follow the
keep_attrs
flag (GH3490, GH4065, GH3433, GH3595, PR4195). By Deepak Cherian.Added
isocalendar()
that returns a Dataset with year, week, and weekday calculated according to the ISO 8601 calendar. Requires pandas version 1.1.0 or greater (PR4534). By Mathias Hauser, Maximilian Roos, and Spencer Clark.Dataset.to_zarr()
now supports aregion
keyword for writing to limited regions of existing Zarr stores (PR4035). See Modifying existing Zarr stores for full details. By Stephan Hoyer.Added typehints in
align()
to reflect that the same type received inobjects
arg will be returned (PR4522). By Michal Baumgartner.Dataset.weighted()
andDataArray.weighted()
are now executing value checks lazily if weights are provided as dask arrays (GH4541, PR4559). By Julius Busecke.Added the
keep_attrs
keyword torolling_exp.mean()
; it now keeps attributes per default. By Mathias Hauser (PR4592).Added
freq
as property toCFTimeIndex
and into theCFTimeIndex.repr
. (GH2416, PR4597) By Aaron Spring.
Bug fixes#
Fix bug where reference times without padded years (e.g.
since 1-1-1
) would lose their units when being passed byencode_cf_datetime
(GH4422, PR4506). Such units are ambiguous about which digit represents the years (is it YMD or DMY?). Now, if such formatting is encountered, it is assumed that the first digit is the years, they are padded appropriately (to e.g.since 0001-1-1
) and a warning that this assumption is being made is issued. Previously, withoutcftime
, such times would be silently parsed incorrectly (at least based on the CF conventions) e.g. “since 1-1-1” would be parsed (viapandas
anddateutil
) tosince 2001-1-1
. By Zeb Nicholls.Fix
DataArray.plot.step()
. By Deepak Cherian.Fix bug where reading a scalar value from a NetCDF file opened with the
h5netcdf
backend would raise aValueError
whendecode_cf=True
(GH4471, PR4485). By Gerrit Holl.Fix bug where datetime64 times are silently changed to incorrect values if they are outside the valid date range for ns precision when provided in some other units (GH4427, PR4454). By Andrew Pauling
Fix silently overwriting the
engine
key when passingopen_dataset()
a file object to an incompatible netCDF (GH4457). Now incompatible combinations of files and engines raise an exception instead. By Alessandro Amici.The
min_count
argument toDataArray.sum()
andDataArray.prod()
is now ignored when not applicable, i.e. whenskipna=False
or whenskipna=None
and the dtype does not have a missing value (GH4352). By Mathias Hauser.combine_by_coords()
now raises an informative error when passing coordinates with differing calendars (GH4495). By Mathias Hauser.DataArray.rolling
andDataset.rolling
now also keep the attributes and names of of (wrapped)DataArray
objects, previously only the global attributes were retained (GH4497, PR4510). By Mathias Hauser.Improve performance where reading small slices from huge dimensions was slower than necessary (PR4560). By Dion Häfner.
Fix bug where
dask_gufunc_kwargs
was silently changed inapply_ufunc()
(PR4576). By Kai Mühlbauer.
Documentation#
document the API not supported with duck arrays (PR4530). By Justus Magin.
Mention the possibility to pass functions to
Dataset.where()
orDataArray.where()
in the parameter documentation (GH4223, PR4613). By Justus Magin.Update the docstring of
DataArray
andDataset
. (PR4532); By Jimmy Westling.Raise a more informative error when
DataArray.to_dataframe()
is is called on a scalar, (GH4228); By Pieter Gijsbers.Fix grammar and typos in the Contributing to xarray guide (PR4545). By Sahid Velji.
Fix grammar and typos in the Reading and writing files guide (PR4553). By Sahid Velji.
Update link to NumPy docstring standard in the Contributing to xarray guide (PR4558). By Sahid Velji.
Add docstrings to
isnull
andnotnull
, and fix the displayed signature (GH2760, PR4618). By Justus Magin.
Internal Changes#
Optional dependencies can be installed along with xarray by specifying extras as
pip install "xarray[extra]"
whereextra
can be one ofio
,accel
,parallel
,viz
andcomplete
. See docs for updated installation instructions. (GH2888, PR4480). By Ashwin Vishnu, Justus Magin and Mathias Hauser.Removed stray spaces that stem from black removing new lines (PR4504). By Mathias Hauser.
Ensure tests are not skipped in the
py38-all-but-dask
test environment (GH4509). By Mathias Hauser.Ignore select numpy warnings around missing values, where xarray handles the values appropriately, (PR4536); By Maximilian Roos.
Replace the internal use of
pd.Index.__or__
andpd.Index.__and__
withpd.Index.union
andpd.Index.intersection
as they will stop working as set operations in the future (GH4565). By Mathias Hauser.Add GitHub action for running nightly tests against upstream dependencies (PR4583). By Anderson Banihirwe.
Ensure all figures are closed properly in plot tests (PR4600). By Yash Saboo, Nirupam K N and Mathias Hauser.
v0.16.1 (2020-09-20)#
This patch release fixes an incompatibility with a recent pandas change, which
was causing an issue indexing with a datetime64
. It also includes
improvements to rolling
, to_dataframe
, cov
& corr
methods and
bug fixes. Our documentation has a number of improvements, including fixing all
doctests and confirming their accuracy on every commit.
Many thanks to the 36 contributors who contributed to this release:
Aaron Spring, Akio Taniguchi, Aleksandar Jelenak, Alexandre Poux, Caleb, Dan Nowacki, Deepak Cherian, Gerardo Rivera, Jacob Tomlinson, James A. Bednar, Joe Hamman, Julia Kent, Kai Mühlbauer, Keisuke Fujii, Mathias Hauser, Maximilian Roos, Nick R. Papior, Pascal Bourgault, Peter Hausamann, Romain Martinez, Russell Manser, Samnan Rahee, Sander, Spencer Clark, Stephan Hoyer, Thomas Zilio, Tobias Kölling, Tom Augspurger, alexamici, crusaderky, darikg, inakleinbottle, jenssss, johnomotani, keewis, and rpgoldman.
Breaking changes#
DataArray.astype()
andDataset.astype()
now preserve attributes. Keep the old behavior by passing keep_attrs=False (GH2049, PR4314). By Dan Nowacki and Gabriel Joel Mitchell.
New Features#
rolling()
androlling()
now accept more than 1 dimension. (PR4219) By Keisuke Fujii.to_dataframe()
andto_dataframe()
now accept adim_order
parameter allowing to specify the resulting dataframe’s dimensions order (GH4331, PR4333). By Thomas Zilio.Support multiple outputs in
xarray.apply_ufunc()
when usingdask='parallelized'
. (GH1815, PR4060). By Kai Mühlbauer.min_count
can be supplied to reductions such as.sum
when specifying multiple dimension to reduce over; (PR4356). By Maximilian Roos.xarray.cov()
andxarray.corr()
now handle missing values; (PR4351). By Maximilian Roos.Add support for parsing datetime strings formatted following the default string representation of cftime objects, i.e. YYYY-MM-DD hh:mm:ss, in partial datetime string indexing, as well as
cftime_range()
(GH4337). By Spencer Clark.Build
CFTimeIndex.__repr__
explicitly aspandas.Index
. Addcalendar
as a new property forCFTimeIndex
and showcalendar
andlength
inCFTimeIndex.__repr__
(GH2416, PR4092) By Aaron Spring.Use a wrapped array’s
_repr_inline_
method to construct the collapsedrepr
ofDataArray
andDataset
objects and document the new method in Xarray Internals. (PR4248). By Justus Magin.Allow per-variable fill values in most functions. (PR4237). By Justus Magin.
Expose
use_cftime
option inopen_zarr()
(GH2886, PR3229) By Samnan Rahee and Anderson Banihirwe.
Bug fixes#
Fix indexing with datetime64 scalars with pandas 1.1 (GH4283). By Stephan Hoyer and Justus Magin.
Variables which are chunked using dask only along some dimensions can be chunked while storing with zarr along previously unchunked dimensions (PR4312) By Tobias Kölling.
Fixed a bug in backend caused by basic installation of Dask (GH4164, PR4318) Sam Morley.
Fixed a few bugs with
Dataset.polyfit()
when encountering deficient matrix ranks (GH4190, PR4193). By Pascal Bourgault.Fixed inconsistencies between docstring and functionality for
DataArray.str.get()
andDataArray.str.wrap()
(GH4334). By Mathias Hauser.Fixed overflow issue causing incorrect results in computing means of
cftime.datetime
arrays (GH4341). By Spencer Clark.Fixed
Dataset.coarsen()
,DataArray.coarsen()
dropping attributes on original object (GH4120, PR4360). By Julia Kent.fix the signature of the plot methods. (PR4359) By Justus Magin.
Fix
xarray.apply_ufunc()
withvectorize=True
andexclude_dims
(GH3890). By Mathias Hauser.Fix KeyError when doing linear interpolation to an nd DataArray that contains NaNs (PR4233). By Jens Svensmark
Fix incorrect legend labels for
Dataset.plot.scatter()
(GH4126). By Peter Hausamann.Fix
dask.optimize
onDataArray
producing an invalid Dask task graph (GH3698) By Tom AugspurgerFix
pip install .
when no.git
directory exists; namely when the xarray source directory has been rsync’ed by PyCharm Professional for a remote deployment over SSH. By Guido ImperialePreserve dimension and coordinate order during
xarray.concat()
(GH2811, GH4072, PR4419). By Kai Mühlbauer.Avoid relying on
set
objects for the ordering of the coordinates (PR4409) By Justus Magin.
Documentation#
Update the docstring of
DataArray.copy()
to remove incorrect mention of ‘dataset’ (GH3606) By Sander van Rijn.Removed skipna argument from
DataArray.count()
,DataArray.any()
,DataArray.all()
. (GH755) By Sander van RijnUpdate the contributing guide to use merges instead of rebasing and state that we squash-merge. (PR4355). By Justus Magin.
Make sure the examples from the docstrings actually work (PR4408). By Justus Magin.
Updated Vectorized Indexing to a clearer example. By Maximilian Roos
Internal Changes#
Fixed all doctests and enabled their running in CI. By Justus Magin.
Relaxed the Minimum dependency versions to support:
all versions of setuptools released in the last 42 months (but no older than 38.4)
all versions of dask and dask.distributed released in the last 12 months (but no older than 2.9)
all versions of other packages released in the last 12 months
All are up from 6 months (GH4295) Guido Imperiale.
Use
dask.array.apply_gufunc
instead ofdask.array.blockwise()
inxarray.apply_ufunc()
when usingdask='parallelized'
. (PR4060, PR4391, PR4392) By Kai Mühlbauer.Align
mypy
versions to0.782
acrossrequirements
and.pre-commit-config.yml
files. (PR4390) By Maximilian RoosOnly load resource files when running inside a Jupyter Notebook (GH4294) By Guido Imperiale
Silenced most
numpy
warnings such asMean of empty slice
. (PR4369) By Maximilian RoosEnable type checking for
concat()
(GH4238) By Mathias Hauser.Updated plot functions for matplotlib version 3.3 and silenced warnings in the plot tests (PR4365). By Mathias Hauser.
Versions in
pre-commit.yaml
are now pinned, to reduce the chances of conflicting versions. (PR4388) By Maximilian Roos
v0.16.0 (2020-07-11)#
This release adds xarray.cov & xarray.corr for covariance & correlation respectively; the idxmax & idxmin methods, the polyfit method & xarray.polyval for fitting polynomials, as well as a number of documentation improvements, other features, and bug fixes. Many thanks to all 44 contributors who contributed to this release:
Akio Taniguchi, Andrew Williams, Aurélien Ponte, Benoit Bovy, Dave Cole, David Brochart, Deepak Cherian, Elliott Sales de Andrade, Etienne Combrisson, Hossein Madadi, Huite, Joe Hamman, Kai Mühlbauer, Keisuke Fujii, Maik Riechert, Marek Jacob, Mathias Hauser, Matthieu Ancellin, Maximilian Roos, Noah D Brenowitz, Oriol Abril, Pascal Bourgault, Phillip Butcher, Prajjwal Nijhara, Ray Bell, Ryan Abernathey, Ryan May, Spencer Clark, Spencer Hill, Srijan Saurav, Stephan Hoyer, Taher Chegini, Todd, Tom Nicholas, Yohai Bar Sinai, Yunus Sevinchan, arabidopsis, aurghs, clausmichele, dmey, johnomotani, keewis, raphael dussin, risebell
Breaking changes#
Minimum supported versions for the following packages have changed:
dask >=2.9
,distributed>=2.9
. By Deepak Cheriangroupby
operations will restore coord dimension order. Passrestore_coord_dims=False
to revert to previous behavior.DataArray.transpose()
will now transpose coordinates by default. Passtranspose_coords=False
to revert to previous behaviour. By Maximilian RoosAlternate draw styles for
plot.step()
must be passed using thedrawstyle
(ords
) keyword argument, instead of thelinestyle
(orls
) keyword argument, in line with the upstream change in Matplotlib. (PR3274) By Elliott Sales de AndradeThe old
auto_combine
function has now been removed in favour of thecombine_by_coords()
andcombine_nested()
functions. This also means that the default behaviour ofopen_mfdataset()
has changed to usecombine='by_coords'
as the default argument value. (GH2616, PR3926) By Tom Nicholas.The
DataArray
andVariable
HTML reprs now expand the data section by default (GH4176) By Stephan Hoyer.
New Features#
DataArray.argmin()
andDataArray.argmax()
now support sequences of ‘dim’ arguments, and if a sequence is passed return a dict (which can be passed toDataArray.isel()
to get the value of the minimum) of the indices for each dimension of the minimum or maximum of a DataArray. (PR3936) By John Omotani, thanks to Keisuke Fujii for work in PR1469.Added
xarray.cov()
andxarray.corr()
(GH3784, PR3550, PR4089). By Andrew Williams and Robin Beer.Implement
DataArray.idxmax()
,DataArray.idxmin()
,Dataset.idxmax()
,Dataset.idxmin()
. (GH60, PR3871) By Todd JenningsAdded
DataArray.polyfit()
andxarray.polyval()
for fitting polynomials. (GH3349, PR3733, PR4099) By Pascal Bourgault.Added
xarray.infer_freq()
for extending frequency inferring to CFTime indexes and data (PR4033). By Pascal Bourgault.chunks='auto'
is now supported in thechunks
argument ofDataset.chunk()
. (GH4055) By Andrew WilliamsControl over attributes of result in
merge()
,concat()
,combine_by_coords()
andcombine_nested()
using combine_attrs keyword argument. (GH3865, PR3877) By John Omotanimissing_dims argument to
Dataset.isel()
,DataArray.isel()
andVariable.isel()
to allow replacing the exception when a dimension passed toisel
is not present with a warning, or just ignore the dimension. (GH3866, PR3923) By John OmotaniSupport dask handling for
DataArray.idxmax()
,DataArray.idxmin()
,Dataset.idxmax()
,Dataset.idxmin()
. (PR3922, PR4135) By Kai Mühlbauer and Pascal Bourgault.More support for unit aware arrays with pint (PR3643, PR3975, PR4163) By Justus Magin.
Support overriding existing variables in
to_zarr()
withmode='a'
even withoutappend_dim
, as long as dimension sizes do not change. By Stephan Hoyer.Allow plotting of boolean arrays. (PR3766) By Marek Jacob
Enable using MultiIndex levels as coordinates in 1D and 2D plots (GH3927). By Mathias Hauser.
A
days_in_month
accessor forxarray.CFTimeIndex
, analogous to thedays_in_month
accessor for apandas.DatetimeIndex
, which returns the days in the month each datetime in the index. Now days in month weights for both standard and non-standard calendars can be obtained using theDatetimeAccessor
(PR3935). This feature requires cftime version 1.1.0 or greater. By Spencer Clark.For the netCDF3 backend, added dtype coercions for unsigned integer types. (GH4014, PR4018) By Yunus Sevinchan
map_blocks()
now accepts atemplate
kwarg. This allows use cases where the result of a computation could not be inferred automatically. By Deepak Cherianmap_blocks()
can now handle dask-backed xarray objects inargs
. (PR3818) By Deepak CherianAdd keyword
decode_timedelta
toxarray.open_dataset()
, (xarray.open_dataarray()
,xarray.open_dataarray()
,xarray.decode_cf()
) that allows to disable/enable the decoding of timedeltas independently of time decoding (GH1621) Aureliana Barghini
Enhancements#
Performance improvement of
DataArray.interp()
andDataset.interp()
We performs independent interpolation sequentially rather than interpolating in one large multidimensional space. (GH2223) By Keisuke Fujii.DataArray.interp()
now support interpolations over chunked dimensions (PR4155). By Alexandre Poux.Major performance improvement for
Dataset.from_dataframe()
when the dataframe has a MultiIndex (PR4184). By Stephan Hoyer. -DataArray.reset_index()
andDataset.reset_index()
now keep coordinate attributes (PR4103). By Oriol Abril.Axes kwargs such as
facecolor
can now be passed toDataArray.plot()
insubplot_kws
. This works for both single axes plots and FacetGrid plots. By Raphael Dussin.Array items with long string reprs are now limited to a reasonable width (PR3900) By Maximilian Roos
Large arrays whose numpy reprs would have greater than 40 lines are now limited to a reasonable length. (PR3905) By Maximilian Roos
Bug fixes#
Fix errors combining attrs in
open_mfdataset()
(GH4009, PR4173) By John OmotaniIf groupby receives a
DataArray
with name=None, assign a default name (GH158) By Phil Butcher.Support dark mode in VS code (GH4024) By Keisuke Fujii.
Fix bug when converting multiindexed pandas objects to sparse xarray objects. (GH4019) By Deepak Cherian.
ValueError
is raised whenfill_value
is not a scalar infull_like()
. (GH3977) By Huite Bootsma.Fix wrong order in converting a
pd.Series
with a MultiIndex toDataArray
. (GH3951, GH4186) By Keisuke Fujii and Stephan Hoyer.Fix renaming of coords when one or more stacked coords is not in sorted order during stack+groupby+apply operations. (GH3287, PR3906) By Spencer Hill
Fix a regression where deleting a coordinate from a copied
DataArray
can affect the originalDataArray
. (GH3899, PR3871) By Todd JenningsFix
FacetGrid
plots with a single contour. (GH3569, PR3915). By Deepak CherianUse divergent colormap if
levels
spans 0. (GH3524) By Deepak CherianFix
FacetGrid
whenvmin == vmax
. (GH3734) By Deepak CherianFix plotting when
levels
is a scalar andnorm
is provided. (GH3735) By Deepak CherianFix bug where plotting line plots with 2D coordinates depended on dimension order. (GH3933) By Tom Nicholas.
Fix
RasterioDeprecationWarning
when using avrt
inopen_rasterio
. (GH3964) By Taher Chegini.Fix
AttributeError
on displaying aVariable
in a notebook context. (GH3972, PR3973) By Ian Castleden.Fix bug causing
DataArray.interpolate_na()
to always drop attributes, and added keep_attrs argument. (GH3968) By Tom Nicholas.Fix bug in time parsing failing to fall back to cftime. This was causing time variables with a time unit of ‘msecs’ to fail to parse. (PR3998) By Ryan May.
Fix weighted mean when passing boolean weights (GH4074). By Mathias Hauser.
Fix html repr in untrusted notebooks: fallback to plain text repr. (PR4053) By Benoit Bovy.
Fix
DataArray.to_unstacked_dataset()
for single-dimension variables. (GH4049) By Deepak CherianFix
open_rasterio()
forWarpedVRT
with specifiedsrc_crs
. (PR4104) By Dave Cole.
Documentation#
update the docstring of
DataArray.assign_coords()
: clarify how to add a new coordinate to an existing dimension and illustrative example (GH3952, PR3958) By Etienne Combrisson.update the docstring of
Dataset.diff()
andDataArray.diff()
so it does document thedim
parameter as required. (GH1040, PR3909) By Justus Magin.Updated Calculating Seasonal Averages from Timeseries of Monthly Means example notebook to take advantage of the new
days_in_month
accessor forxarray.CFTimeIndex
(PR3935). By Spencer Clark.Updated the list of current core developers. (GH3892) By Tom Nicholas.
Add example for multi-dimensional extrapolation and note different behavior of
kwargs
inDataset.interp()
andDataArray.interp()
for 1-d and n-d interpolation (PR3956). By Matthias Riße.Apply
black
to all the code in the documentation (PR4012) By Justus Magin.Narrative documentation now describes
map_blocks()
: Automatic parallelization with apply_ufunc and map_blocks. By Deepak Cherian.Document
.plot
,.dt
,.str
accessors the way they are called. (GH3625, PR3988) By Justus Magin.Add documentation for the parameters and return values of
DataArray.sel()
. By Justus Magin.
Internal Changes#
Raise more informative error messages for chunk size conflicts when writing to zarr files. By Deepak Cherian.
Run the
isort
pre-commit hook only on python source files and update theflake8
version. (GH3750, PR3711) By Justus Magin.Add blackdoc to the list of checkers for development. (PR4177) By Justus Magin.
Add a CI job that runs the tests with every optional dependency except
dask
. (GH3794, PR3919) By Justus Magin.Use
async
/await
for the asynchronous distributed tests. (GH3987, PR3989) By Justus Magin.Various internal code clean-ups (PR4026, PR4038). By Prajjwal Nijhara.
v0.15.1 (23 Mar 2020)#
This release brings many new features such as Dataset.weighted()
methods for weighted array
reductions, a new jupyter repr by default, and the start of units integration with pint. There’s also
the usual batch of usability improvements, documentation additions, and bug fixes.
Breaking changes#
Raise an error when assigning to the
.values
or.data
attribute of dimension coordinates i.e.IndexVariable
objects. This has been broken since v0.12.0. Please useDataArray.assign_coords()
orDataset.assign_coords()
instead. (GH3470, PR3862) By Deepak Cherian
New Features#
Weighted array reductions are now supported via the new
DataArray.weighted()
andDataset.weighted()
methods. See Weighted array reductions. (GH422, PR2922). By Mathias Hauser.The new jupyter notebook repr (
Dataset._repr_html_
andDataArray._repr_html_
) (introduced in 0.14.1) is now on by default. To disable, usexarray.set_options(display_style="text")
. By Julia Signell.Added support for
pandas.DatetimeIndex
-style rounding ofcftime.datetime
objects directly via aCFTimeIndex
or via theDatetimeAccessor
. By Spencer ClarkSupport new h5netcdf backend keyword phony_dims (available from h5netcdf v0.8.0 for
H5NetCDFStore
. By Kai Mühlbauer.Add partial support for unit aware arrays with pint. (PR3706, PR3611) By Justus Magin.
Dataset.groupby()
andDataArray.groupby()
now raise a TypeError on multiple string arguments. Receiving multiple string arguments often means a user is attempting to pass multiple dimensions as separate arguments and should instead pass a single list of dimensions. (PR3802) By Maximilian Roosmap_blocks()
can now apply functions that add new unindexed dimensions. By Deepak CherianAn ellipsis (
...
) is now supported in thedims
argument ofDataset.stack()
andDataArray.stack()
, meaning all unlisted dimensions, similar to its meaning inDataArray.transpose()
. (PR3826) By Maximilian RoosDataset.where()
andDataArray.where()
accept a lambda as a first argument, which is then called on the input; replicating pandas’ behavior. By Maximilian Roos.skipna
is available inDataset.quantile()
,DataArray.quantile()
,core.groupby.DatasetGroupBy.quantile()
,core.groupby.DataArrayGroupBy.quantile()
(GH3843, PR3844) By Aaron Spring.Add a diff summary for testing.assert_allclose. (GH3617, PR3847) By Justus Magin.
Bug fixes#
Fix
Dataset.interp()
when indexing array shares coordinates with the indexed variable (GH3252). By David Huard.Fix recombination of groups in
Dataset.groupby()
andDataArray.groupby()
when performing an operation that changes the size of the groups along the grouped dimension. By Eric Jansen.Fix use of multi-index with categorical values (GH3674). By Matthieu Ancellin.
Fix alignment with
join="override"
when some dimensions are unindexed. (GH3681). By Deepak Cherian.Fix
Dataset.swap_dims()
andDataArray.swap_dims()
producing index with name reflecting the previous dimension name instead of the new one (GH3748, PR3752). By Joseph K Aicher.Use
dask_array_type
instead ofdask_array.Array
for type checking. (GH3779, PR3787) By Justus Magin.concat()
can now handle coordinate variables only present in one of the objects to be concatenated whencoords="different"
. By Deepak Cherian.xarray now respects the over, under and bad colors if set on a provided colormap. (GH3590, PR3601) By johnomotani.
coarsen
androlling
now respectxr.set_options(keep_attrs=True)
to preserve attributes.Dataset.coarsen()
accepts a keyword argumentkeep_attrs
to change this setting. (GH3376, PR3801) By Andrew Thomas.Delete associated indexes when deleting coordinate variables. (GH3746). By Deepak Cherian.
Fix
Dataset.to_zarr()
when usingappend_dim
andgroup
simultaneously. (GH3170). By Matthias Meyer.Fix html repr on
Dataset
with non-string keys (PR3807). By Maximilian Roos.
Documentation#
Fix documentation of
DataArray
removing the deprecated mention that when omitted, dims are inferred from a coords-dict. (PR3821) By Sander van Rijn.Improve the
where()
docstring. By Maximilian RoosUpdate the installation instructions: only explicitly list recommended dependencies (GH3756). By Mathias Hauser.
Internal Changes#
Remove the internal
import_seaborn
function which handled the deprecation of theseaborn.apionly
entry point (GH3747). By Mathias Hauser.Don’t test pint integration in combination with datetime objects. (GH3778, PR3788) By Justus Magin.
Change test_open_mfdataset_list_attr to only run with dask installed (GH3777, PR3780). By Bruno Pagani.
Preserve the ability to index with
method="nearest"
with aCFTimeIndex
with pandas versions greater than 1.0.1 (GH3751). By Spencer Clark.Greater flexibility and improved test coverage of subtracting various types of objects from a
CFTimeIndex
. By Spencer Clark.Update Azure CI MacOS image, given pending removal. By Maximilian Roos
Remove xfails for scipy 1.0.1 for tests that append to netCDF files (PR3805). By Mathias Hauser.
Remove conversion to
pandas.Panel
, given its removal in pandas in favor of xarray’s objects. By Maximilian Roos
v0.15.0 (30 Jan 2020)#
This release brings many improvements to xarray’s documentation: our examples are now binderized notebooks (click here) and we have new example notebooks from our SciPy 2019 sprint (many thanks to our contributors!).
This release also features many API improvements such as a new
TimedeltaAccessor
and support for CFTimeIndex
in
interpolate_na()
); as well as many bug fixes.
Breaking changes#
Bumped minimum tested versions for dependencies:
numpy 1.15
pandas 0.25
dask 2.2
distributed 2.2
scipy 1.3
Remove
compat
andencoding
kwargs fromDataArray
, which have been deprecated since 0.12. (PR3650). Instead, specify theencoding
kwarg when writing to disk or set theDataArray.encoding
attribute directly. By Maximilian Roos.xarray.dot()
,DataArray.dot()
, and the@
operator now usealign="inner"
(except whenxarray.set_options(arithmetic_join="exact")
; GH3694) by Mathias Hauser.
New Features#
Implement
DataArray.pad()
andDataset.pad()
. (GH2605, PR3596). By Mark Boer.DataArray.sel()
andDataset.sel()
now supportpandas.CategoricalIndex
. (GH3669) By Keisuke Fujii.Support using an existing, opened h5netcdf
File
withH5NetCDFStore
. This permits creating anDataset
from a h5netcdfFile
that has been opened using other means (GH3618). By Kai Mühlbauer.Implement
median
andnanmedian
for dask arrays. This works by rechunking to a single chunk along all reduction axes. (GH2999). By Deepak Cherian.concat()
now preserves attributes from the first Variable. (GH2575, GH2060, GH1614) By Deepak Cherian.Dataset.quantile()
,DataArray.quantile()
andGroupBy.quantile
now work with dask Variables. By Deepak Cherian.Added the
count
reduction method to bothDatasetCoarsen
andDataArrayCoarsen
objects. (PR3500) By Deepak CherianAdd
meta
kwarg toapply_ufunc()
; this is passed on todask.array.blockwise()
. (PR3660) By Deepak Cherian.Add
attrs_file
option inopen_mfdataset()
to choose the source file for global attributes in a multi-file dataset (GH2382, PR3498). By Julien Seguinot.Dataset.swap_dims()
andDataArray.swap_dims()
now allow swapping to dimension names that don’t exist yet. (PR3636) By Justus Magin.Extend
DatetimeAccessor
properties and support.dt
accessor for timedeltas viaTimedeltaAccessor
(PR3612) By Anderson Banihirwe.Improvements to interpolating along time axes (GH3641, PR3631). By David Huard.
Support
CFTimeIndex
inDataArray.interpolate_na()
define 1970-01-01 as the default offset for the interpolation index for both
pandas.DatetimeIndex
andCFTimeIndex
,use microseconds in the conversion from timedelta objects to floats to avoid overflow errors.
Bug fixes#
Applying a user-defined function that adds new dimensions using
apply_ufunc()
andvectorize=True
now works withdask > 2.0
. (GH3574, PR3660). By Deepak Cherian.Fix
combine_by_coords()
to allow for combining incomplete hypercubes of Datasets (GH3648). By Ian Bolliger.Fix
combine_by_coords()
when combining cftime coordinates which span long time intervals (GH3535). By Spencer Clark.Fix plotting with transposed 2D non-dimensional coordinates. (GH3138, PR3441) By Deepak Cherian.
plot.FacetGrid.set_titles()
can now replace existing row titles of aFacetGrid
plot. In additionFacetGrid
gained two new attributes:col_labels
androw_labels
containmatplotlib.text.Text
handles for both column and row labels. These can be used to manually change the labels. By Deepak Cherian.Fix issue with Dask-backed datasets raising a
KeyError
on some computations involvingmap_blocks()
(PR3598). By Tom Augspurger.Ensure
Dataset.quantile()
,DataArray.quantile()
issue the correct error whenq
is out of bounds (GH3634) by Mathias Hauser.Fix regression in xarray 0.14.1 that prevented encoding times with certain
dtype
,_FillValue
, andmissing_value
encodings (GH3624). By Spencer ClarkRaise an error when trying to use
Dataset.rename_dims()
to rename to an existing name (GH3438, PR3645) By Justus Magin.Dataset.rename()
,DataArray.rename()
now check for conflicts with MultiIndex level names.Dataset.merge()
no longer fails when passed aDataArray
instead of aDataset
. By Tom Nicholas.Fix a regression in
Dataset.drop()
: allow passing any iterable when dropping variables (GH3552, PR3693) By Justus Magin.Fixed errors emitted by
mypy --strict
in modules that import xarray. (GH3695) by Guido Imperiale.Allow plotting of binned coordinates on the y axis in
plot.line()
andplot.step()
plots (GH3571, PR3685) by Julien Seguinot.setuptools is now marked as a dependency of xarray (PR3628) by Richard Höchenberger.
Documentation#
Switch doc examples to use nbsphinx and replace
sphinx_gallery
scripts with Jupyter notebooks. (PR3105, PR3106, PR3121) By Ryan Abernathey.Added example notebook demonstrating use of xarray with Regional Ocean Modeling System (ROMS) ocean hydrodynamic model output. (PR3116) By Robert Hetland.
Added example notebook demonstrating the visualization of ERA5 GRIB data. (PR3199) By Zach Bruick and Stephan Siemen.
Added examples for
DataArray.quantile()
,Dataset.quantile()
andGroupBy.quantile
. (PR3576) By Justus Magin.Add new example notebook example notebook demonstrating vectorization of a 1D function using
apply_ufunc()
, dask and numba. By Deepak Cherian.Added example for
map_blocks()
. (PR3667) By Riley X. Brady.
Internal Changes#
Make sure dask names change when rechunking by different chunk sizes. Conversely, make sure they stay the same when rechunking by the same chunk size. (GH3350) By Deepak Cherian.
2x to 5x speed boost (on small arrays) for
Dataset.isel()
,DataArray.isel()
, andDataArray.__getitem__()
when indexing by int, slice, list of int, scalar ndarray, or 1-dimensional ndarray. (PR3533) by Guido Imperiale.Removed internal method
Dataset._from_vars_and_coord_names
, which was dominated byDataset._construct_direct
. (PR3565) By Maximilian Roos.Replaced versioneer with setuptools-scm. Moved contents of setup.py to setup.cfg. Removed pytest-runner from setup.py, as per deprecation notice on the pytest-runner project. (PR3714) by Guido Imperiale.
Use of isort is now enforced by CI. (PR3721) by Guido Imperiale
v0.14.1 (19 Nov 2019)#
Breaking changes#
Broken compatibility with
cftime < 1.0.3
. By Deepak Cherian.Warning
cftime version 1.0.4 is broken (cftime/126); please use version 1.0.4.2 instead.
All leftover support for dates from non-standard calendars through
netcdftime
, the module included in versions of netCDF4 prior to 1.4 that eventually became the cftime package, has been removed in favor of relying solely on the standalonecftime
package (PR3450). By Spencer Clark.
New Features#
Added the
sparse
option tounstack()
,unstack()
,reindex()
,reindex()
(GH3518). By Keisuke Fujii.Added the
fill_value
option toDataArray.unstack()
andDataset.unstack()
(GH3518, PR3541). By Keisuke Fujii.Added the
max_gap
kwarg tointerpolate_na()
andinterpolate_na()
. This controls the maximum size of the data gap that will be filled by interpolation. By Deepak Cherian.Added
Dataset.drop_sel()
&DataArray.drop_sel()
for dropping labels.Dataset.drop_vars()
&DataArray.drop_vars()
have been added for dropping variables (including coordinates). The existingDataset.drop()
&DataArray.drop()
methods remain as a backward compatible option for dropping either labels or variables, but using the more specific methods is encouraged. (PR3475) By Maximilian RoosAdded
Dataset.map()
&GroupBy.map
&Resample.map
for mapping / applying a function over each item in the collection, reflecting the widely used and least surprising name for this operation. The existingapply
methods remain for backward compatibility, though using themap
methods is encouraged. (PR3459) By Maximilian RoosDataset.transpose()
andDataArray.transpose()
now support an ellipsis (...
) to represent all ‘other’ dimensions. For example, to move one dimension to the front, use.transpose('x', ...)
. (PR3421) By Maximilian RoosChanged
xr.ALL_DIMS
to equal python’sEllipsis
(...
), and changed internal usages to use...
directly. As before, you can use this to instruct agroupby
operation to reduce over all dimensions. While we have no plans to removexr.ALL_DIMS
, we suggest using...
. (PR3418) By Maximilian Roosxarray.dot()
, andDataArray.dot()
now support thedims=...
option to sum over the union of dimensions of all input arrays (GH3423) by Mathias Hauser.Added new
Dataset._repr_html_
andDataArray._repr_html_
to improve representation of objects in Jupyter. By default this feature is turned off for now. Enable it withxarray.set_options(display_style="html")
. (PR3425) by Benoit Bovy and Julia Signell.Implement dask deterministic hashing for xarray objects. Note that xarray objects with a dask.array backend already used deterministic hashing in previous releases; this change implements it when whole xarray objects are embedded in a dask graph, e.g. when
DataArray.map_blocks()
is invoked. (GH3378, PR3446, PR3515) By Deepak Cherian and Guido Imperiale.Add the documented-but-missing
quantile()
.xarray now respects the
DataArray.encoding["coordinates"]
attribute when writing to disk. See Coordinates for more. (GH3351, PR3487) By Deepak Cherian.Add the documented-but-missing
quantile()
. (GH3525, PR3527). By Justus Magin.
Bug fixes#
Ensure an index of type
CFTimeIndex
is not converted to aDatetimeIndex
when callingDataset.rename()
,Dataset.rename_dims()
andDataset.rename_vars()
. By Mathias Hauser. (GH3522).Fix a bug in
DataArray.set_index()
in case that an existing dimension becomes a level variable of MultiIndex. (PR3520). By Keisuke Fujii.Harmonize
_FillValue
,missing_value
during encoding and decoding steps. (PR3502) By Anderson Banihirwe.Fix regression introduced in v0.14.0 that would cause a crash if dask is installed but cloudpickle isn’t (GH3401) by Rhys Doyle
Fix grouping over variables with NaNs. (GH2383, PR3406). By Deepak Cherian.
Make alignment and concatenation significantly more efficient by using dask names to compare dask objects prior to comparing values after computation. This change makes it more convenient to carry around large non-dimensional coordinate variables backed by dask arrays. Existing workarounds involving
reset_coords(drop=True)
should now be unnecessary in most cases. (GH3068, GH3311, GH3454, PR3453). By Deepak Cherian.Add support for cftime>=1.0.4. By Anderson Banihirwe.
Rolling reduction operations no longer compute dask arrays by default. (GH3161). In addition, the
allow_lazy
kwarg toreduce
is deprecated. By Deepak Cherian.Fix
GroupBy.reduce
when reducing over multiple dimensions. (GH3402). By Deepak CherianAllow appending datetime and bool data variables to zarr stores. (GH3480). By Akihiro Matsukawa.
Add support for numpy >=1.18 (); bugfix mean() on datetime64 arrays on dask backend (GH3409, PR3537). By Guido Imperiale.
Add support for pandas >=0.26 (GH3440). By Deepak Cherian.
Add support for pseudonetcdf >=3.1 (PR3485). By Barron Henderson.
Documentation#
Fix leap year condition in monthly means example. By Mickaël Lalande.
Fix the documentation of
DataArray.resample()
andDataset.resample()
, explicitly stating that a datetime-like dimension is required. (PR3400) By Justus Magin.Update the Terminology page to address multidimensional coordinates. (PR3410) By Jon Thielen.
Fix the documentation of
Dataset.integrate()
andDataArray.integrate()
and add an example toDataset.integrate()
. (PR3469) By Justus Magin.
Internal Changes#
Added integration tests against pint. (PR3238, PR3447, PR3493, PR3508) by Justus Magin.
Note
At the moment of writing, these tests as well as the ability to use pint in general require a highly experimental version of pint (install with
pip install git+https://github.com/andrewgsavage/pint.git@refs/pull/6/head)
. Even with it, interaction with non-numpy array libraries, e.g. dask or sparse, is broken.Use Python 3.6 idioms throughout the codebase. (PR3419) By Maximilian Roos
Run basic CI tests on Python 3.8. (PR3477) By Maximilian Roos
Enable type checking on default sentinel values (PR3472) By Maximilian Roos
Add
Variable._replace
for simpler replacing of a subset of attributes (PR3472) By Maximilian Roos
v0.14.0 (14 Oct 2019)#
Breaking changes#
This release introduces a rolling policy for minimum dependency versions: Minimum dependency versions.
Several minimum versions have been increased:
Package
Old
New
Python
3.5.3
3.6
numpy
1.12
1.14
pandas
0.19.2
0.24
dask
0.16 (tested: 2.4)
1.2
bottleneck
1.1 (tested: 1.2)
1.2
matplotlib
1.5 (tested: 3.1)
3.1
Obsolete patch versions (x.y.Z) are not tested anymore. The oldest supported versions of all optional dependencies are now covered by automated tests (before, only the very latest versions were tested).
(GH3222, GH3293, GH3340, GH3346, GH3358). By Guido Imperiale.
Dropped the
drop=False
optional parameter fromVariable.isel()
. It was unused and doesn’t make sense for a Variable. (PR3375). By Guido Imperiale.Remove internal usage of
collections.OrderedDict
. After dropping support for Python <=3.5, most uses ofOrderedDict
in xarray were no longer necessary. We have removed the internal use of theOrderedDict
in favor of Python’s builtindict
object which is now ordered itself. This change will be most obvious when interacting with theattrs
property on Dataset and DataArray objects. (GH3380, PR3389). By Joe Hamman.
New functions/methods#
Added
map_blocks()
, modeled afterdask.array.map_blocks()
. Also addedDataset.unify_chunks()
,DataArray.unify_chunks()
andtesting.assert_chunks_equal()
. (PR3276). By Deepak Cherian and Guido Imperiale.
Enhancements#
core.groupby.GroupBy
enhancements. By Deepak Cherian.Speed up
Dataset.isel()
up to 33% andDataArray.isel()
up to 25% for small arrays (GH2799, PR3375). By Guido Imperiale.
Bug fixes#
Reintroduce support for
weakref
(broken in v0.13.0). Support has been reinstated forDataArray
andDataset
objects only. Internal xarray objects remain unaddressable by weakref in order to save memory (GH3317). By Guido Imperiale.Line plots with the
x
ory
argument set to a 1D non-dimensional coord now plot the correct data for 2D DataArrays (GH3334). By Tom Nicholas.Make
concat()
more robust when merging variables present in some datasets but not others (GH508). By Deepak Cherian.The default behaviour of reducing across all dimensions for
DataArrayGroupBy
objects has now been properly removed as was done forDatasetGroupBy
in 0.13.0 (GH3337). Usexarray.ALL_DIMS
if you need to replicate previous behaviour. Also raise nicer error message when no groups are created (GH1764). By Deepak Cherian.Fix error in concatenating unlabeled dimensions (PR3362). By Deepak Cherian.
Warn if the
dim
kwarg is passed to rolling operations. This is redundant since a dimension is specified when theDatasetRolling
orDataArrayRolling
object is created. (PR3362). By Deepak Cherian.
Documentation#
Created a glossary of important xarray terms (GH2410, PR3352). By Gregory Gundersen.
Created a “How do I…” section (How do I …) for solutions to common questions. (PR3357). By Deepak Cherian.
Add examples for
Dataset.swap_dims()
andDataArray.swap_dims()
(PR3331, PR3331). By Justus Magin.Add examples for
align()
,merge()
,combine_by_coords()
,full_like()
,zeros_like()
,ones_like()
,Dataset.pipe()
,Dataset.assign()
,Dataset.reindex()
,Dataset.fillna()
(PR3328). By Anderson Banihirwe.Fixed documentation to clean up an unwanted file created in
ipython
example (PR3353). By Gregory Gundersen.
v0.13.0 (17 Sep 2019)#
This release includes many exciting changes: wrapping of
NEP18 compliant
numpy-like arrays; new scatter()
plotting method that can scatter
two DataArrays
in a Dataset
against each other; support for converting pandas
DataFrames to xarray objects that wrap pydata/sparse
; and more!
Breaking changes#
This release increases the minimum required Python version from 3.5.0 to 3.5.3 (GH3089). By Guido Imperiale.
The
isel_points
andsel_points
methods are removed, having been deprecated since v0.10.0. These are redundant with theisel
/sel
methods. See Vectorized Indexing for the details By Maximilian RoosThe
inplace
kwarg for public methods now raises an error, having been deprecated since v0.11.0. By Maximilian Roosconcat()
now requires thedim
argument. Itsindexers
,mode
andconcat_over
kwargs have now been removed. By Deepak CherianPassing a list of colors in
cmap
will now raise an error, having been deprecated since v0.6.1.Most xarray objects now define
__slots__
. This reduces overall RAM usage by ~22% (not counting the underlying numpy buffers); on CPython 3.7/x64, a trivial DataArray has gone down from 1.9kB to 1.5kB.Caveats:
Pickle streams produced by older versions of xarray can’t be loaded using this release, and vice versa.
Any user code that was accessing the
__dict__
attribute of xarray objects will break. The best practice to attach custom metadata to xarray objects is to use theattrs
dictionary.Any user code that defines custom subclasses of xarray classes must now explicitly define
__slots__
itself. Subclasses that don’t add any attributes must state so by defining__slots__ = ()
right after the class header. Omitting__slots__
will now cause aFutureWarning
to be logged, and will raise an error in a later release.
(GH3250) by Guido Imperiale.
The default dimension for
Dataset.groupby()
,Dataset.resample()
,DataArray.groupby()
andDataArray.resample()
reductions is now the grouping or resampling dimension.DataArray.to_dataset()
requiresname
to be passed as a kwarg (previously ambiguous positional arguments were deprecated)Reindexing with variables of a different dimension now raise an error (previously deprecated)
xarray.broadcast_array
is removed (previously deprecated in favor ofbroadcast()
)Variable.expand_dims
is removed (previously deprecated in favor ofVariable.set_dims()
)
New functions/methods#
xarray can now wrap around any NEP18 compliant numpy-like library (important: read notes about
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
in the above link). Added explicit test coverage for sparse. (GH3117, GH3202). This requires sparse>=0.8.0. By Nezar Abdennur and Guido Imperiale.from_dataframe()
andfrom_series()
now supportsparse=True
for converting pandas objects into xarray objects wrapping sparse arrays. This is particularly useful with sparsely populated hierarchical indexes. (GH3206) By Stephan Hoyer.The xarray package is now discoverable by mypy (although typing hints coverage is not complete yet). mypy type checking is now enforced by CI. Libraries that depend on xarray and use mypy can now remove from their setup.cfg the lines:
[mypy-xarray] ignore_missing_imports = True
(GH2877, GH3088, GH3090, GH3112, GH3117, GH3207) By Guido Imperiale and Maximilian Roos.
Added
DataArray.broadcast_like()
andDataset.broadcast_like()
. By Deepak Cherian and David Mertz.Dataset plotting API for visualizing dependencies between two DataArrays! Currently only
Dataset.plot.scatter()
is implemented. By Yohai Bar Sinai and Deepak CherianAdded
DataArray.head()
,DataArray.tail()
andDataArray.thin()
; as well asDataset.head()
,Dataset.tail()
andDataset.thin()
methods. (GH319) By Gerardo Rivera.
Enhancements#
Multiple enhancements to
concat()
andopen_mfdataset()
. By Deepak CherianAdded
compat='override'
. When merging, this option picks the variable from the first dataset and skips all comparisons.Added
join='override'
. When aligning, this only checks that index sizes are equal among objects and skips checking indexes for equality.concat()
andopen_mfdataset()
now support thejoin
kwarg. It is passed down toalign()
.concat()
now callsmerge()
on variables that are not concatenated (i.e. variables withoutconcat_dim
whendata_vars
orcoords
are"minimal"
).concat()
passes its newcompat
kwarg down tomerge()
. (GH2064)
Users can avoid a common bottleneck when using
open_mfdataset()
on a large number of files with variables that are known to be aligned and some of which need not be concatenated. Slow equality comparisons can now be avoided, for e.g.:data = xr.open_mfdataset(files, concat_dim='time', data_vars='minimal', coords='minimal', compat='override', join='override')
In
to_zarr()
, passingmode
is not mandatory ifappend_dim
is set, as it will automatically be set to'a'
internally. By David Brochart.Added the ability to initialize an empty or full DataArray with a single value. (GH277) By Gerardo Rivera.
to_netcdf()
now supports theinvalid_netcdf
kwarg when used withengine="h5netcdf"
. It is passed toh5netcdf.File
. By Ulrich Herter.xarray.Dataset.drop
now supports keyword arguments; dropping index labels by using bothdim
andlabels
or using aDataArrayCoordinates
object are deprecated (GH2910). By Gregory Gundersen.Added examples of
Dataset.set_index()
andDataArray.set_index()
, as well are more specific error messages when the user passes invalid arguments (GH3176). By Gregory Gundersen.Dataset.filter_by_attrs()
now filters the coordinates as well as the variables. By Spencer Jones.
Bug fixes#
Improve “missing dimensions” error message for
apply_ufunc()
(GH2078). By Rick Russotto.assign_coords()
now supports dictionary arguments (GH3231). By Gregory Gundersen.Fix regression introduced in v0.12.2 where
copy(deep=True)
would convert unicode indices to dtype=object (GH3094). By Guido Imperiale.Improved error handling and documentation for .expand_dims() read-only view.
Fix tests for big-endian systems (GH3125). By Graham Inggs.
XFAIL several tests which are expected to fail on ARM systems due to a
datetime
issue in NumPy (GH2334). By Graham Inggs.Fix KeyError that arises when using .sel method with float values different from coords float type (GH3137). By Hasan Ahmad.
Fixed bug in
combine_by_coords()
causing a ValueError if the input had an unused dimension with coordinates which were not monotonic (GH3150). By Tom Nicholas.Fixed crash when applying
distributed.Client.compute()
to a DataArray (GH3171). By Guido Imperiale.Better error message when using groupby on an empty DataArray (GH3037). By Hasan Ahmad.
Fix error that arises when using open_mfdataset on a series of netcdf files having differing values for a variable attribute of type list. (GH3034) By Hasan Ahmad.
Prevent
argmax()
andargmin()
from calling dask compute (GH3237). By Ulrich Herter.Plots in 2 dimensions (pcolormesh, contour) now allow to specify levels as numpy array (GH3284). By Mathias Hauser.
Fixed bug in
DataArray.quantile()
failing to keep attributes when keep_attrs was True (GH3304). By David Huard.
Documentation#
Created a PR checklist as a quick reference for tasks before creating a new PR or pushing new commits. By Gregory Gundersen.
Fixed documentation to clean up unwanted files created in
ipython
examples (GH3227). By Gregory Gundersen.
v0.12.3 (10 July 2019)#
New functions/methods#
New methods
Dataset.to_stacked_array()
andDataArray.to_unstacked_dataset()
for reshaping Datasets of variables with different dimensions (GH1317). This is useful for feeding data from xarray into machine learning models, as described in Stacking different variables together. By Noah Brenowitz.
Enhancements#
Support for renaming
Dataset
variables and dimensions independently withrename_vars()
andrename_dims()
(GH3026). By Julia Kent.Add
scales
,offsets
,units
anddescriptions
attributes toDataArray
returned byopen_rasterio()
. (GH3013) By Erle Carrara.
Bug fixes#
Resolved deprecation warnings from newer versions of matplotlib and dask.
Compatibility fixes for the upcoming pandas 0.25 and NumPy 1.17 releases. By Stephan Hoyer.
Fix summaries for multiindex coordinates (GH3079). By Jonas Hörsch.
Fix HDF5 error that could arise when reading multiple groups from a file at once (GH2954). By Stephan Hoyer.
v0.12.2 (29 June 2019)#
New functions/methods#
Two new functions,
combine_nested()
andcombine_by_coords()
, allow for combining datasets along any number of dimensions, instead of the one-dimensional list of datasets supported byconcat()
.The new
combine_nested
will accept the datasets as a nested list-of-lists, and combine by applying a series of concat and merge operations. The newcombine_by_coords
instead uses the dimension coordinates of datasets to order them.open_mfdataset()
can use eithercombine_nested
orcombine_by_coords
to combine datasets along multiple dimensions, by specifying the argumentcombine='nested'
orcombine='by_coords'
.The older function
auto_combine
has been deprecated, because its functionality has been subsumed by the new functions. To avoid FutureWarnings switch to usingcombine_nested
orcombine_by_coords
, (or set thecombine
argument inopen_mfdataset
). (GH2159) By Tom Nicholas.rolling_exp()
androlling_exp()
added, similar to pandas’pd.DataFrame.ewm
method. Calling.mean
on the resulting object will return an exponentially weighted moving average. By Maximilian Roos.New
DataArray.str
for string related manipulations, based onpandas.Series.str
. By 0x0L.Added
strftime
method to.dt
accessor, making it simpler to hand a datetimeDataArray
to other code expecting formatted dates and times. (GH2090).strftime()
is also now available onCFTimeIndex
. By Alan Brammer and Ryan May.GroupBy.quantile
is now a method ofGroupBy
objects (GH3018). By David Huard.Argument and return types are added to most methods on
DataArray
andDataset
, allowing static type checking both within xarray and external libraries. Type checking with mypy is enabled in CI (though not required yet). By Guido Imperiale and Maximilian Roos.
Enhancements to existing functionality#
Add
keepdims
argument for reduce operations (GH2170) By Scott Wales.Enable
@
operator for DataArray. This is equivalent toDataArray.dot()
By Maximilian Roos.Add
fill_value
argument for reindex, align, and merge operations to enable custom fill values. (GH2876) By Zach Griffith.DataArray.transpose()
now accepts a keyword argumenttranspose_coords
which enables transposition of coordinates in the same way asDataset.transpose()
.DataArray.groupby()
DataArray.groupby_bins()
, andDataArray.resample()
now accept a keyword argumentrestore_coord_dims
which keeps the order of the dimensions of multi-dimensional coordinates intact (GH1856). By Peter Hausamann.Clean up Python 2 compatibility in code (GH2950) By Guido Imperiale.
Better warning message when supplying invalid objects to
xr.merge
(GH2948). By Mathias Hauser.Add
errors
keyword argument toDataset.drop
andDataset.drop_dims()
that allows ignoring errors if a passed label or dimension is not in the dataset (GH2994). By Andrew Ross.
Bug fixes#
Rolling operations on xarray objects containing dask arrays could silently compute the incorrect result or use large amounts of memory (GH2940). By Stephan Hoyer.
Don’t set encoding attributes on bounds variables when writing to netCDF. (GH2921) By Deepak Cherian.
NetCDF4 output: variables with unlimited dimensions must be chunked (not contiguous) on output. (GH1849) By James McCreight.
indexing with an empty list creates an object with zero-length axis (GH2882) By Mayeul d’Avezac.
Return correct count for scalar datetime64 arrays (GH2770) By Dan Nowacki.
Fixed max, min exception when applied to a multiIndex (GH2923) By Ian Castleden
A deep copy deep-copies the coords (GH1463) By Martin Pletcher.
Increased support for missing_value (GH2871) By Deepak Cherian.
Removed usages of pytest.config, which is deprecated (GH2988) By Maximilian Roos.
Fixed performance issues with cftime installed (GH3000) By 0x0L.
Replace incorrect usages of message in pytest assertions with match (GH3011) By Maximilian Roos.
Add explicit pytest markers, now required by pytest (GH3032). By Maximilian Roos.
Test suite fixes for newer versions of pytest (GH3011, GH3032). By Maximilian Roos and Stephan Hoyer.
v0.12.1 (4 April 2019)#
Enhancements#
Allow
expand_dims
method to support inserting/broadcasting dimensions with size > 1. (GH2710) By Martin Pletcher.
Bug fixes#
Dataset.copy(deep=True) now creates a deep copy of the attrs (GH2835). By Andras Gefferth.
Fix incorrect
indexes
resulting from variousDataset
operations (e.g.,swap_dims
,isel
,reindex
,[]
) (GH2842, GH2856). By Stephan Hoyer.
v0.12.0 (15 March 2019)#
Highlights include:
Removed support for Python 2. This is the first version of xarray that is Python 3 only!
New
coarsen()
andintegrate()
methods. See Coarsen large arrays and Computation using Coordinates for details.Many improvements to cftime support. See below for details.
Deprecations#
The
compat
argument toDataset
and theencoding
argument toDataArray
are deprecated and will be removed in a future release. (GH1188) By Maximilian Roos.
Other enhancements#
Added ability to open netcdf4/hdf5 file-like objects with
open_dataset
. Requires (h5netcdf>0.7 and h5py>2.9.0). (GH2781) By Scott HendersonAdd
data=False
option toto_dict()
methods. (GH2656) By Ryan AbernatheyDataArray.coarsen()
andDataset.coarsen()
are newly added. See Coarsen large arrays for details. (GH2525) By Keisuke Fujii.Upsampling an array via interpolation with resample is now dask-compatible, as long as the array is not chunked along the resampling dimension. By Spencer Clark.
xarray.testing.assert_equal()
andxarray.testing.assert_identical()
now provide a more detailed report showing what exactly differs between the two objects (dimensions / coordinates / variables / attributes) (GH1507). By Benoit Bovy.Add
tolerance
option toresample()
methodsbfill
,pad
,nearest
. (GH2695) By Hauke Schulz.DataArray.integrate()
andDataset.integrate()
are newly added. See Computation using Coordinates for the detail. (GH1332) By Keisuke Fujii.Added
drop_dims()
(GH1949). By Kevin Squire.
Bug fixes#
Silenced warnings that appear when using pandas 0.24. By Stephan Hoyer
Interpolating via resample now internally specifies
bounds_error=False
as an argument toscipy.interpolate.interp1d
, allowing for interpolation from higher frequencies to lower frequencies. Datapoints outside the bounds of the original time coordinate are now filled with NaN (GH2197). By Spencer Clark.Line plots with the
x
argument set to a non-dimensional coord now plot the correct data for 1D DataArrays. (GH2725). By Tom Nicholas.Subtracting a scalar
cftime.datetime
object from aCFTimeIndex
now results in apandas.TimedeltaIndex
instead of raising aTypeError
(GH2671). By Spencer Clark.backend_kwargs are no longer ignored when using open_dataset with pynio engine (:issue:’2380’) By Jonathan Joyce.
Fix
open_rasterio
creating a WKT CRS instead of PROJ.4 withrasterio
1.0.14+ (GH2715). By David Hoese.Masking data arrays with
xarray.DataArray.where()
now returns an array with the name of the original masked array (GH2748 and GH2457). By Yohai Bar-Sinai.Fixed error when trying to reduce a DataArray using a function which does not require an axis argument. (GH2768) By Tom Nicholas.
Concatenating a sequence of
DataArray
with varying names sets the name of the output array toNone
, instead of the name of the first input array. If the names are the same it sets the name to that, instead to the name of the first DataArray in the list as it did before. (GH2775). By Tom Nicholas.Per the CF conventions section on calendars, specifying
'standard'
as the calendar type incftime_range()
now correctly refers to the'gregorian'
calendar instead of the'proleptic_gregorian'
calendar (GH2761).
v0.11.3 (26 January 2019)#
Bug fixes#
Saving files with times encoded with reference dates with timezones (e.g. ‘2000-01-01T00:00:00-05:00’) no longer raises an error (GH2649). By Spencer Clark.
Fixed performance regression with
open_mfdataset
(GH2662). By Tom Nicholas.Fixed supplying an explicit dimension in the
concat_dim
argument to toopen_mfdataset
(GH2647). By Ben Root.
v0.11.2 (2 January 2019)#
Removes inadvertently introduced setup dependency on pytest-runner (GH2641). Otherwise, this release is exactly equivalent to 0.11.1.
Warning
This is the last xarray release that will support Python 2.7. Future releases will be Python 3 only, but older versions of xarray will always be available for Python 2.7 users. For the more details, see:
v0.11.1 (29 December 2018)#
This minor release includes a number of enhancements and bug fixes, and two (slightly) breaking changes.
Breaking changes#
Minimum rasterio version increased from 0.36 to 1.0 (for
open_rasterio
)Time bounds variables are now also decoded according to CF conventions (GH2565). The previous behavior was to decode them only if they had specific time attributes, now these attributes are copied automatically from the corresponding time coordinate. This might break downstream code that was relying on these variables to be brake downstream code that was relying on these variables to be not decoded. By Fabien Maussion.
Enhancements#
Ability to read and write consolidated metadata in zarr stores (GH2558). By Ryan Abernathey.
CFTimeIndex
uses slicing for string indexing when possible (likepandas.DatetimeIndex
), which avoids unnecessary copies. By Stephan HoyerEnable passing
rasterio.io.DatasetReader
orrasterio.vrt.WarpedVRT
toopen_rasterio
instead of file path string. Allows for in-memory reprojection, see (GH2588). By Scott Henderson.Like
pandas.DatetimeIndex
,CFTimeIndex
now supports “dayofyear” and “dayofweek” accessors (GH2597). Note this requires a version of cftime greater than 1.0.2. By Spencer Clark.The option
'warn_for_unclosed_files'
(False by default) has been added to allow users to enable a warning when files opened by xarray are deallocated but were not explicitly closed. This is mostly useful for debugging; we recommend enabling it in your test suites if you use xarray for IO. By Stephan HoyerSupport Dask
HighLevelGraphs
by Matthew Rocklin.DataArray.resample()
andDataset.resample()
now supports theloffset
kwarg just like pandas. By Deepak CherianDatasets are now guaranteed to have a
'source'
encoding, so the source file name is always stored (GH2550). By Tom Nicholas.The
apply
methods forDatasetGroupBy
,DataArrayGroupBy
,DatasetResample
andDataArrayResample
now support passing positional arguments to the applied function as a tuple to theargs
argument. By Matti Eskelinen.0d slices of ndarrays are now obtained directly through indexing, rather than extracting and wrapping a scalar, avoiding unnecessary copying. By Daniel Wennberg.
Added support for
fill_value
withshift()
andshift()
By Maximilian Roos
Bug fixes#
Ensure files are automatically closed, if possible, when no longer referenced by a Python variable (GH2560). By Stephan Hoyer
Fixed possible race conditions when reading/writing to disk in parallel (GH2595). By Stephan Hoyer
Fix h5netcdf saving scalars with filters or chunks (GH2563). By Martin Raspaud.
Fix parsing of
_Unsigned
attribute set by OPENDAP servers. (GH2583). By Deepak CherianFix failure in time encoding when exporting to netCDF with versions of pandas less than 0.21.1 (GH2623). By Spencer Clark.
Fix MultiIndex selection to update label and level (GH2619). By Keisuke Fujii.
v0.11.0 (7 November 2018)#
Breaking changes#
Finished deprecations (changed behavior with this release):
Dataset.T
has been removed as a shortcut forDataset.transpose()
. CallDataset.transpose()
directly instead.Iterating over a
Dataset
now includes only data variables, not coordinates. Similarly, callinglen
andbool
on aDataset
now includes only data variables.DataArray.__contains__
(used by Python’sin
operator) now checks array data, not coordinates.The old resample syntax from before xarray 0.10, e.g.,
data.resample('1D', dim='time', how='mean')
, is no longer supported will raise an error in most cases. You need to use the new resample syntax instead, e.g.,data.resample(time='1D').mean()
ordata.resample({'time': '1D'}).mean()
.
New deprecations (behavior will be changed in xarray 0.12):
Reduction of
DataArray.groupby()
andDataArray.resample()
without dimension argument will change in the next release. Now we warn a FutureWarning. By Keisuke Fujii.The
inplace
kwarg of a number of DataArray and Dataset methods is being deprecated and will be removed in the next release. By Deepak Cherian.
Refactored storage backends:
Xarray’s storage backends now automatically open and close files when necessary, rather than requiring opening a file with
autoclose=True
. A global least-recently-used cache is used to store open files; the default limit of 128 open files should suffice in most cases, but can be adjusted if necessary withxarray.set_options(file_cache_maxsize=...)
. Theautoclose
argument toopen_dataset
and related functions has been deprecated and is now a no-op.This change, along with an internal refactor of xarray’s storage backends, should significantly improve performance when reading and writing netCDF files with Dask, especially when working with many files or using Dask Distributed. By Stephan Hoyer
Support for non-standard calendars used in climate science:
Xarray will now always use
cftime.datetime
objects, rather than by default trying to coerce them intonp.datetime64[ns]
objects. ACFTimeIndex
will be used for indexing along time coordinates in these cases.A new method
to_datetimeindex()
has been added to aid in converting from aCFTimeIndex
to apandas.DatetimeIndex
for the remaining use-cases where using aCFTimeIndex
is still a limitation (e.g. for resample or plotting).Setting the
enable_cftimeindex
option is now a no-op and emits aFutureWarning
.
Enhancements#
xarray.DataArray.plot.line()
can now accept multidimensional coordinate variables as input. hue must be a dimension name in this case. (GH2407) By Deepak Cherian.Added support for Python 3.7. (GH2271). By Joe Hamman.
Added support for plotting data with pandas.Interval coordinates, such as those created by
groupby_bins()
By Maximilian Maahn.Added
shift()
for shifting the values of a CFTimeIndex by a specified frequency. (GH2244). By Spencer Clark.Added support for using
cftime.datetime
coordinates withdifferentiate()
,differentiate()
,interp()
, andinterp()
. By Spencer ClarkThere is now a global option to either always keep or always discard dataset and dataarray attrs upon operations. The option is set with
xarray.set_options(keep_attrs=True)
, and the default is to use the old behaviour. By Tom Nicholas.Added a new backend for the GRIB file format based on ECMWF cfgrib python driver and ecCodes C-library. (GH2475) By Alessandro Amici, sponsored by ECMWF.
Resample now supports a dictionary mapping from dimension to frequency as its first argument, e.g.,
data.resample({'time': '1D'}).mean()
. This is consistent with other xarray functions that accept either dictionaries or keyword arguments. By Stephan Hoyer.The preferred way to access tutorial data is now to load it lazily with
xarray.tutorial.open_dataset()
.xarray.tutorial.load_dataset()
calls Dataset.load() prior to returning (and is now deprecated). This was changed in order to facilitate using tutorial datasets with dask. By Joe Hamman.DataArray
can now usexr.set_option(keep_attrs=True)
and retain attributes in binary operations, such as (+, -, * ,/
). Default behaviour is unchanged (Attributes will be dismissed). By Michael Blaschek
Bug fixes#
FacetGrid
now properly uses thecbar_kwargs
keyword argument. (GH1504, GH1717) By Deepak Cherian.Addition and subtraction operators used with a CFTimeIndex now preserve the index’s type. (GH2244). By Spencer Clark.
We now properly handle arrays of
datetime.datetime
anddatetime.timedelta
provided as coordinates. (GH2512) By Deepak Cherian.xarray.DataArray.roll
correctly handles multidimensional arrays. (GH2445) By Keisuke Fujii.xarray.plot()
now properly accepts anorm
argument and does not override the norm’svmin
andvmax
. (GH2381) By Deepak Cherian.xarray.DataArray.std()
now correctly acceptsddof
keyword argument. (GH2240) By Keisuke Fujii.Restore matplotlib’s default of plotting dashed negative contours when a single color is passed to
DataArray.contour()
e.g.colors='k'
. By Deepak Cherian.Fix a bug that caused some indexing operations on arrays opened with
open_rasterio
to error (GH2454). By Stephan Hoyer.Subtracting one CFTimeIndex from another now returns a
pandas.TimedeltaIndex
, analogous to the behavior for DatetimeIndexes (GH2484). By Spencer Clark.Adding a TimedeltaIndex to, or subtracting a TimedeltaIndex from a CFTimeIndex is now allowed (GH2484). By Spencer Clark.
Avoid use of Dask’s deprecated
get=
parameter in tests by Matthew Rocklin.An
OverflowError
is now accurately raised and caught during the encoding process if a reference date is used that is so distant that the dates must be encoded using cftime rather than NumPy (GH2272). By Spencer Clark.Chunked datasets can now roundtrip to Zarr storage continually with to_zarr and
open_zarr
(GH2300). By Lily Wang.
v0.10.9 (21 September 2018)#
This minor release contains a number of backwards compatible enhancements.
Announcements of note:
Xarray is now a NumFOCUS fiscally sponsored project! Read the announcement for more details.
We have a new Development roadmap that outlines our future development plans.
Dataset.apply
now properly documents the way func is called. By Matti Eskelinen.
Enhancements#
differentiate()
anddifferentiate()
are newly added. (GH1332) By Keisuke Fujii.Default colormap for sequential and divergent data can now be set via
set_options()
(GH2394) By Julius Busecke.min_count option is newly supported in
sum()
,prod()
andsum()
, andprod()
. (GH2230) By Keisuke Fujii.plot()
now accepts the kwargsxscale, yscale, xlim, ylim, xticks, yticks
just like pandas. Alsoxincrease=False, yincrease=False
now use matplotlib’s axis inverting methods instead of setting limits. By Deepak Cherian. (GH2224)DataArray coordinates and Dataset coordinates and data variables are now displayed as a b … y z rather than a b c d …. (GH1186) By Seth P.
A new CFTimeIndex-enabled
cftime_range()
function for use in generating dates from standard or non-standard calendars. By Spencer Clark.When interpolating over a
datetime64
axis, you can now provide a datetime string instead of adatetime64
object. E.g.da.interp(time='1991-02-01')
(GH2284) By Deepak Cherian.A clear error message is now displayed if a
set
ordict
is passed in place of an array (GH2331) By Maximilian Roos.Applying
unstack
to a large DataArray or Dataset is now much faster if the MultiIndex has not been modified after stacking the indices. (GH1560) By Maximilian Maahn.You can now control whether or not to offset the coordinates when using the
roll
method and the current behavior, coordinates rolled by default, raises a deprecation warning unless explicitly setting the keyword argument. (GH1875) By Andrew Huang.You can now call
unstack
without arguments to unstack every MultiIndex in a DataArray or Dataset. By Julia Signell.Added the ability to pass a data kwarg to
copy
to create a new object with the same metadata as the original object but using new values. By Julia Signell.
Bug fixes#
xarray.plot.imshow()
correctly uses theorigin
argument. (GH2379) By Deepak Cherian.Fixed
DataArray.to_iris()
failure while creatingDimCoord
by falling back to creatingAuxCoord
. Fixed dependency onvar_name
attribute being set. (GH2201) By Thomas Voigt.Fixed a bug in
zarr
backend which prevented use with datasets with invalid chunk size encoding after reading from an existing store (GH2278). By Joe Hamman.Tests can be run in parallel with pytest-xdist By Tony Tung.
Follow up the renamings in dask; from dask.ghost to dask.overlap By Keisuke Fujii.
Now raises a ValueError when there is a conflict between dimension names and level names of MultiIndex. (GH2299) By Keisuke Fujii.
Follow up the renamings in dask; from dask.ghost to dask.overlap By Keisuke Fujii.
Now
apply_ufunc()
raises a ValueError when the size ofinput_core_dims
is inconsistent with the number of arguments. (GH2341) By Keisuke Fujii.Fixed
Dataset.filter_by_attrs()
behavior not matchingnetCDF4.Dataset.get_variables_by_attributes()
. When more than onekey=value
is passed intoDataset.filter_by_attrs()
it will now return a Dataset with variables which pass all the filters. (GH2315) By Andrew Barna.
v0.10.8 (18 July 2018)#
Breaking changes#
Xarray no longer supports python 3.4. Additionally, the minimum supported versions of the following dependencies has been updated and/or clarified:
pandas: 0.18 -> 0.19
NumPy: 1.11 -> 1.12
Dask: 0.9 -> 0.16
Matplotlib: unspecified -> 1.5
(GH2204). By Joe Hamman.
Enhancements#
interp_like()
andinterp_like()
methods are newly added. (GH2218) By Keisuke Fujii.Added support for curvilinear and unstructured generic grids to
to_cdms2()
andfrom_cdms2()
(GH2262). By Stephane Raynaud.
Bug fixes#
Fixed a bug in
zarr
backend which prevented use with datasets with incomplete chunks in multiple dimensions (GH2225). By Joe Hamman.Fixed a bug in
to_netcdf()
which prevented writing datasets when the arrays had different chunk sizes (GH2254). By Mike Neish.Fixed masking during the conversion to cdms2 objects by
to_cdms2()
(GH2262). By Stephane Raynaud.Fixed a bug in 2D plots which incorrectly raised an error when 2D coordinates weren’t monotonic (GH2250). By Fabien Maussion.
Fixed warning raised in
to_netcdf()
due to deprecation of effective_get in dask (GH2238). By Joe Hamman.
v0.10.7 (7 June 2018)#
Enhancements#
Plot labels now make use of metadata that follow CF conventions (GH2135). By Deepak Cherian and Ryan Abernathey.
Line plots now support facetting with
row
andcol
arguments (GH2107). By Yohai Bar Sinai.interp()
andinterp()
methods are newly added. See Interpolating data for the detail. (GH2079) By Keisuke Fujii.
Bug fixes#
Fixed a bug in
rasterio
backend which prevented use withdistributed
. Therasterio
backend now returns pickleable objects (GH2021). By Joe Hamman.
v0.10.6 (31 May 2018)#
The minor release includes a number of bug-fixes and backwards compatible enhancements.
Enhancements#
New PseudoNetCDF backend for many Atmospheric data formats including GEOS-Chem, CAMx, NOAA arlpacked bit and many others. See
io.PseudoNetCDF
for more details. By Barron Henderson.The
Dataset
constructor now alignsDataArray
arguments indata_vars
to indexes set explicitly incoords
, where previously an error would be raised. (GH674) By Maximilian Roos.sel()
,isel()
&reindex()
, (and theirDataset
counterparts) now support supplying adict
as a first argument, as an alternative to the existing approach of supplying kwargs. This allows for more robust behavior of dimension names which conflict with other keyword names, or are not strings. By Maximilian Roos.rename()
now supports supplying**kwargs
, as an alternative to the existing approach of supplying adict
as the first argument. By Maximilian Roos.cumsum()
andcumprod()
now support aggregation over multiple dimensions at the same time. This is the default behavior when dimensions are not specified (previously this raised an error). By Stephan HoyerDataArray.dot()
anddot()
are partly supported with older dask<0.17.4. (related to GH2203) By Keisuke Fujii.Xarray now uses Versioneer to manage its version strings. (GH1300). By Joe Hamman.
Bug fixes#
Fixed a regression in 0.10.4, where explicitly specifying
dtype='S1'
ordtype=str
inencoding
withto_netcdf()
raised an error (GH2149). Stephan Hoyerapply_ufunc()
now directly validates output variables (GH1931). By Stephan Hoyer.Fixed a bug where
to_netcdf(..., unlimited_dims='bar')
yielded NetCDF files with spurious 0-length dimensions (i.e.b
,a
, andr
) (GH2134). By Joe Hamman.Removed spurious warnings with
Dataset.update(Dataset)
(GH2161) andarray.equals(array)
whenarray
containsNaT
(GH2162). By Stephan Hoyer.Aggregations with
Dataset.reduce()
(includingmean
,sum
, etc) no longer drop unrelated coordinates (GH1470). Also fixed a bug where non-scalar data-variables that did not include the aggregation dimension were improperly skipped. By Stephan HoyerFix
stack()
with non-unique coordinates on pandas 0.23 (GH2160). By Stephan HoyerSelecting data indexed by a length-1
CFTimeIndex
with a slice of strings now behaves as it does when using a length-1DatetimeIndex
(i.e. it no longer falsely returns an empty array when the slice includes the value in the index) (GH2165). By Spencer Clark.Fix
DataArray.groupby().reduce()
mutating coordinates on the input array when grouping over dimension coordinates with duplicated entries (GH2153). By Stephan HoyerFix
Dataset.to_netcdf()
cannot create group withengine="h5netcdf"
(GH2177). By Stephan Hoyer
v0.10.4 (16 May 2018)#
The minor release includes a number of bug-fixes and backwards compatible
enhancements. A highlight is CFTimeIndex
, which offers support for
non-standard calendars used in climate modeling.
Documentation#
New FAQ entry, Xarray related projects. By Deepak Cherian.
Assigning values with indexing now includes examples on how to select and assign values to a
DataArray
with.loc
. By Chiara Lepore.
Enhancements#
Add an option for using a
CFTimeIndex
for indexing times with non-standard calendars and/or outside the Timestamp-valid range; this index enables a subset of the functionality of a standardpandas.DatetimeIndex
. See Non-standard calendars and dates outside the nanosecond-precision range for full details. (GH789, GH1084, GH1252) By Spencer Clark with help from Stephan Hoyer.Allow for serialization of
cftime.datetime
objects (GH789, GH1084, GH2008, GH1252) using the standalonecftime
library. By Spencer Clark.Support writing lists of strings as netCDF attributes (GH2044). By Dan Nowacki.
to_netcdf()
withengine='h5netcdf'
now accepts h5py encoding settingscompression
andcompression_opts
, along with the NetCDF4-Python style settingsgzip=True
andcomplevel
. This allows using any compression plugin installed in hdf5, e.g. LZF (GH1536). By Guido Imperiale.dot()
on dask-backed data will now calldask.array.einsum()
. This greatly boosts speed and allows chunking on the core dims. The function now requires dask >= 0.17.3 to work on dask-backed data (GH2074). By Guido Imperiale.plot.line()
learned new kwargs:xincrease
,yincrease
that change the direction of the respective axes. By Deepak Cherian.Added the
parallel
option toopen_mfdataset()
. This option usesdask.delayed
to parallelize the open and preprocessing steps withinopen_mfdataset
. This is expected to provide performance improvements when opening many files, particularly when used in conjunction with dask’s multiprocessing or distributed schedulers (GH1981). By Joe Hamman.New
compute
option into_netcdf()
,to_zarr()
, andsave_mfdataset()
to allow for the lazy computation of netCDF and zarr stores. This feature is currently only supported by the netCDF4 and zarr backends. (GH1784). By Joe Hamman.
Bug fixes#
ValueError
is raised when coordinates with the wrong size are assigned to aDataArray
. (GH2112) By Keisuke Fujii.Fixed a bug in
rolling()
with bottleneck. Also, fixed a bug in rolling an integer dask array. (GH2113) By Keisuke Fujii.Fixed a bug where keep_attrs=True flag was neglected if
apply_ufunc()
was used withVariable
. (GH2114) By Keisuke Fujii.When assigning a
DataArray
toDataset
, any conflicted non-dimensional coordinates of the DataArray are now dropped. (GH2068) By Keisuke Fujii.Better error handling in
open_mfdataset
(GH2077). By Stephan Hoyer.plot.line()
does not callautofmt_xdate()
anymore. Instead it changes the rotation and horizontal alignment of labels without removing the x-axes of any other subplots in the figure (if any). By Deepak Cherian.Colorbar limits are now determined by excluding ±Infs too. By Deepak Cherian. By Joe Hamman.
Fixed
to_iris
to maintain lazy dask array after conversion (GH2046). By Alex Hilson and Stephan Hoyer.
v0.10.3 (13 April 2018)#
The minor release includes a number of bug-fixes and backwards compatible enhancements.
Enhancements#
isin()
andisin()
methods, which test each value in the array for whether it is contained in the supplied list, returning a bool array. See Selecting values with isin for full details. Similar to thenp.isin
function. By Maximilian Roos.Some speed improvement to construct
DataArrayRolling
object (GH1993) By Keisuke Fujii.Handle variables with different values for
missing_value
and_FillValue
by masking values for both attributes; previously this resulted in aValueError
. (GH2016) By Ryan May.
Bug fixes#
Fixed
decode_cf
function to operate lazily on dask arrays (GH1372). By Ryan Abernathey.Fixed labeled indexing with slice bounds given by xarray objects with datetime64 or timedelta64 dtypes (GH1240). By Stephan Hoyer.
Attempting to convert an xarray.Dataset into a numpy array now raises an informative error message. By Stephan Hoyer.
Fixed a bug in decode_cf_datetime where
int32
arrays weren’t parsed correctly (GH2002). By Fabien Maussion.When calling xr.auto_combine() or xr.open_mfdataset() with a concat_dim, the resulting dataset will have that one-element dimension (it was silently dropped, previously) (GH1988). By Ben Root.
v0.10.2 (13 March 2018)#
The minor release includes a number of bug-fixes and enhancements, along with one possibly backwards incompatible change.
Backwards incompatible changes#
The addition of
__array_ufunc__
for xarray objects (see below) means that NumPy ufunc methods (e.g.,np.add.reduce
) that previously worked onxarray.DataArray
objects by converting them into NumPy arrays will now raiseNotImplementedError
instead. In all cases, the work-around is simple: convert your objects explicitly into NumPy arrays before calling the ufunc (e.g., with.values
).
Enhancements#
Added
dot()
, equivalent tonumpy.einsum()
. Also,dot()
now supportsdims
option, which specifies the dimensions to sum over. (GH1951) By Keisuke Fujii.Support for writing xarray datasets to netCDF files (netcdf4 backend only) when using the dask.distributed scheduler (GH1464). By Joe Hamman.
Support lazy vectorized-indexing. After this change, flexible indexing such as orthogonal/vectorized indexing, becomes possible for all the backend arrays. Also, lazy
transpose
is now also supported. (GH1897) By Keisuke Fujii.Implemented NumPy’s
__array_ufunc__
protocol for all xarray objects (GH1617). This enables using NumPy ufuncs directly onxarray.Dataset
objects with recent versions of NumPy (v1.13 and newer):In [1]: ds = xr.Dataset({"a": 1}) In [2]: np.sin(ds) Out[2]: <xarray.Dataset> Size: 8B Dimensions: () Data variables: a float64 8B 0.8415
This obliviates the need for the
xarray.ufuncs
module, which will be deprecated in the future when xarray drops support for older versions of NumPy. By Stephan Hoyer.Improve
rolling()
logic.DataArrayRolling()
object now supportsconstruct()
method that returns a view of the DataArray / Dataset object with the rolling-window dimension added to the last axis. This enables more flexible operation, such as strided rolling, windowed rolling, ND-rolling, short-time FFT and convolution. (GH1831, GH1142, GH819) By Keisuke Fujii.line()
learned to make plots with data on x-axis if so specified. (GH575) By Deepak Cherian.
Bug fixes#
Raise an informative error message when using
apply_ufunc
with numpy v1.11 (GH1956). By Stephan Hoyer.Fix the precision drop after indexing datetime64 arrays (GH1932). By Keisuke Fujii.
Silenced irrelevant warnings issued by
open_rasterio
(GH1964). By Stephan Hoyer.Fix kwarg colors clashing with auto-inferred cmap (GH1461) By Deepak Cherian.
Fix
imshow()
error when passed an RGB array with size one in a spatial dimension. By Zac Hatfield-Dodds.
v0.10.1 (25 February 2018)#
The minor release includes a number of bug-fixes and backwards compatible enhancements.
Documentation#
Added a new guide on Contributing to xarray (GH640) By Joe Hamman.
Added apply_ufunc example to Toy weather data (GH1844). By Liam Brannigan.
New entry Why don’t aggregations return Python scalars? in the Frequently Asked Questions (GH1726). By 0x0L.
Enhancements#
New functions and methods:
Added
DataArray.to_iris()
andDataArray.from_iris()
for converting data arrays to and from Iris Cubes with the same data and coordinates (GH621 and GH37). By Neil Parley and Duncan Watson-Parris.Experimental support for using Zarr as storage layer for xarray (GH1223). By Ryan Abernathey and Joe Hamman.
New
rank()
on arrays and datasets. Requires bottleneck (GH1731). By 0x0L..dt
accessor can now ceil, floor and round timestamps to specified frequency. By Deepak Cherian.
Plotting enhancements:
xarray.plot.imshow()
now handles RGB and RGBA images. Saturation can be adjusted withvmin
andvmax
, or withrobust=True
. By Zac Hatfield-Dodds.contourf()
learned to contour 2D variables that have both a 1D coordinate (e.g. time) and a 2D coordinate (e.g. depth as a function of time) (GH1737). By Deepak Cherian.plot()
rotates x-axis ticks if x-axis is time. By Deepak Cherian.line()
can draw multiple lines if provided with a 2D variable. By Deepak Cherian.
Other enhancements:
Reduce methods such as
DataArray.sum()
now handles object-type array.In [3]: da = xr.DataArray(np.array([True, False, np.nan], dtype=object), dims="x") In [4]: da.sum() Out[4]: <xarray.DataArray ()> Size: 8B array(1)
(GH1866) By Keisuke Fujii.
Reduce methods such as
DataArray.sum()
now acceptsdtype
arguments. (GH1838) By Keisuke Fujii.Added nodatavals attribute to DataArray when using
open_rasterio()
. (GH1736). By Alan Snow.Use
pandas.Grouper
class in xarray resample methods rather than the deprecatedpandas.TimeGrouper
class (GH1766). By Joe Hamman.Experimental support for parsing ENVI metadata to coordinates and attributes in
xarray.open_rasterio()
. By Matti Eskelinen.Reduce memory usage when decoding a variable with a scale_factor, by converting 8-bit and 16-bit integers to float32 instead of float64 (PR1840), and keeping float16 and float32 as float32 (GH1842). Correspondingly, encoded variables may also be saved with a smaller dtype. By Zac Hatfield-Dodds.
Speed of reindexing/alignment with dask array is orders of magnitude faster when inserting missing values (GH1847). By Stephan Hoyer.
Fix
axis
keyword ignored when applyingnp.squeeze
toDataArray
(GH1487). By Florian Pinault.netcdf4-python
has moved the its time handling in thenetcdftime
module to a standalone package (netcdftime). As such, xarray now considers netcdftime an optional dependency. One benefit of this change is that it allows for encoding/decoding of datetimes with non-standard calendars without thenetcdf4-python
dependency (GH1084). By Joe Hamman.
New functions/methods
Bug fixes#
Rolling aggregation with
center=True
option now gives the same result with pandas including the last element (GH1046). By Keisuke Fujii.Support indexing with a 0d-np.ndarray (GH1921). By Keisuke Fujii.
Added warning in api.py of a netCDF4 bug that occurs when the filepath has 88 characters (GH1745). By Liam Brannigan.
Fixed encoding of multi-dimensional coordinates in
to_netcdf()
(GH1763). By Mike Neish.Fixed chunking with non-file-based rasterio datasets (GH1816) and refactored rasterio test suite. By Ryan Abernathey
Bug fix in open_dataset(engine=’pydap’) (GH1775) By Keisuke Fujii.
Bug fix in vectorized assignment (GH1743, GH1744). Now item assignment to
__setitem__()
checksBug fix in vectorized assignment (GH1743, GH1744). Now item assignment to
DataArray.__setitem__()
checks coordinates of target, destination and keys. If there are any conflict among these coordinates,IndexError
will be raised. By Keisuke Fujii.Properly point
DataArray.__dask_scheduler__
todask.threaded.get
. By Matthew Rocklin.Bug fixes in
DataArray.plot.imshow()
: all-NaN arrays and arrays with size one in some dimension can now be plotted, which is good for exploring satellite imagery (GH1780). By Zac Hatfield-Dodds.Fixed
UnboundLocalError
when opening netCDF file (GH1781). By Stephan Hoyer.The
variables
,attrs
, anddimensions
properties have been deprecated as part of a bug fix addressing an issue where backends were unintentionally loading the datastores data and attributes repeatedly during writes (GH1798). By Joe Hamman.Compatibility fixes to plotting module for NumPy 1.14 and pandas 0.22 (GH1813). By Joe Hamman.
Bug fix in encoding coordinates with
{'_FillValue': None}
in netCDF metadata (GH1865). By Chris Roth.Fix indexing with lists for arrays loaded from netCDF files with
engine='h5netcdf
(GH1864). By Stephan Hoyer.Corrected a bug with incorrect coordinates for non-georeferenced geotiff files (GH1686). Internally, we now use the rasterio coordinate transform tool instead of doing the computations ourselves. A
parse_coordinates
kwarg has been added toopen_rasterio()
(set toTrue
per default). By Fabien Maussion.The colors of discrete colormaps are now the same regardless if seaborn is installed or not (GH1896). By Fabien Maussion.
Fixed dtype promotion rules in
where()
andconcat()
to match pandas (GH1847). A combination of strings/numbers or unicode/bytes now promote to object dtype, instead of strings or unicode. By Stephan Hoyer.Fixed bug where
isnull()
was loading data stored as dask arrays (GH1937). By Joe Hamman.
v0.10.0 (20 November 2017)#
This is a major release that includes bug fixes, new features and a few backwards incompatible changes. Highlights include:
Indexing now supports broadcasting over dimensions, similar to NumPy’s vectorized indexing (but better!).
resample()
has a new groupby-like API like pandas.apply_ufunc()
facilitates wrapping and parallelizing functions written for NumPy arrays.Performance improvements, particularly for dask and
open_mfdataset()
.
Breaking changes#
xarray now supports a form of vectorized indexing with broadcasting, where the result of indexing depends on dimensions of indexers, e.g.,
array.sel(x=ind)
withind.dims == ('y',)
. Alignment between coordinates on indexed and indexing objects is also now enforced. Due to these changes, existing uses of xarray objects to index other xarray objects will break in some cases.The new indexing API is much more powerful, supporting outer, diagonal and vectorized indexing in a single interface. The
isel_points
andsel_points
methods are deprecated, since they are now redundant with theisel
/sel
methods. See Vectorized Indexing for the details (GH1444, GH1436). By Keisuke Fujii and Stephan Hoyer.A new resampling interface to match pandas’ groupby-like API was added to
Dataset.resample()
andDataArray.resample()
(GH1272). Timeseries resampling is fully supported for data with arbitrary dimensions as is both downsampling and upsampling (including linear, quadratic, cubic, and spline interpolation).Old syntax:
In [5]: ds.resample("24H", dim="time", how="max") Out[5]: <xarray.Dataset> [...]
New syntax:
In [6]: ds.resample(time="24H").max() Out[6]: <xarray.Dataset> [...]
Note that both versions are currently supported, but using the old syntax will produce a warning encouraging users to adopt the new syntax. By Daniel Rothenberg.
Calling
repr()
or printing xarray objects at the command line or in a Jupyter Notebook will not longer automatically compute dask variables or load data on arrays lazily loaded from disk (GH1522). By Guido Imperiale.Supplying
coords
as a dictionary to theDataArray
constructor without also supplying an explicitdims
argument is no longer supported. This behavior was deprecated in version 0.9 but will now raise an error (GH727).Several existing features have been deprecated and will change to new behavior in xarray v0.11. If you use any of them with xarray v0.10, you should see a
FutureWarning
that describes how to update your code:Dataset.T
has been deprecated an alias forDataset.transpose()
(GH1232). In the next major version of xarray, it will provide short- cut lookup for variables or attributes with name'T'
.DataArray.__contains__
(e.g.,key in data_array
) currently checks for membership inDataArray.coords
. In the next major version of xarray, it will check membership in the array data found inDataArray.values
instead (GH1267).Direct iteration over and counting a
Dataset
(e.g.,[k for k in ds]
,ds.keys()
,ds.values()
,len(ds)
andif ds
) currently includes all variables, both data and coordinates. For improved usability and consistency with pandas, in the next major version of xarray these will change to only include data variables (GH884). Useds.variables
,ds.data_vars
ords.coords
as alternatives.
Changes to minimum versions of dependencies:
Old numpy < 1.11 and pandas < 0.18 are no longer supported (GH1512). By Keisuke Fujii.
The minimum supported version bottleneck has increased to 1.1 (GH1279). By Joe Hamman.
Enhancements#
New functions/methods
New helper function
apply_ufunc()
for wrapping functions written to work on NumPy arrays to support labels on xarray objects (GH770).apply_ufunc
also support automatic parallelization for many functions with dask. See Wrapping custom computation and Automatic parallelization with apply_ufunc and map_blocks for details. By Stephan Hoyer.Added new method
Dataset.to_dask_dataframe()
, convert a dataset into a dask dataframe. This allows lazy loading of data from a dataset containing dask arrays (GH1462). By James Munroe.New function
where()
for conditionally switching between values in xarray objects, likenumpy.where()
:In [7]: import xarray as xr In [8]: arr = xr.DataArray([[1, 2, 3], [4, 5, 6]], dims=("x", "y")) In [9]: xr.where(arr % 2, "even", "odd") Out[9]: <xarray.DataArray (x: 2, y: 3)> array([['even', 'odd', 'even'], ['odd', 'even', 'odd']], dtype='<U4') Dimensions without coordinates: x, y
Equivalently, the
where()
method also now supports theother
argument, for filling with a value other thanNaN
(GH576). By Stephan Hoyer.Added
show_versions()
function to aid in debugging (GH1485). By Joe Hamman.
Performance improvements
concat()
was computing variables that aren’t in memory (e.g. dask-based) multiple times;open_mfdataset()
was loading them multiple times from disk. Now, both functions will instead load them at most once and, if they do, store them in memory in the concatenated array/dataset (GH1521). By Guido Imperiale.Speed-up (x 100) of
xarray.conventions.decode_cf_datetime
. By Christian Chwala.
IO related improvements
Unicode strings (
str
on Python 3) are now round-tripped successfully even when written as character arrays (e.g., as netCDF3 files or when usingengine='scipy'
) (GH1638). This is controlled by the_Encoding
attribute convention, which is also understood directly by the netCDF4-Python interface. See String encoding for full details. By Stephan Hoyer.Support for
data_vars
andcoords
keywords fromconcat()
added toopen_mfdataset()
(GH438). Using these keyword arguments can significantly reduce memory usage and increase speed. By Oleksandr Huziy.Support for
pathlib.Path
objects added toopen_dataset()
,open_mfdataset()
,xarray.to_netcdf
, andsave_mfdataset()
(GH799):In [10]: from pathlib import Path # In Python 2, use pathlib2! In [11]: data_dir = Path("data/") In [12]: one_file = data_dir / "dta_for_month_01.nc" In [13]: xr.open_dataset(one_file) Out[13]: <xarray.Dataset> [...]
By Willi Rath.
You can now explicitly disable any default
_FillValue
(NaN
for floating point values) by passing the encoding{'_FillValue': None}
(GH1598). By Stephan Hoyer.More attributes available in
attrs
dictionary when raster files are opened withopen_rasterio()
. By Greg Brener.Support for NetCDF files using an
_Unsigned
attribute to indicate that a a signed integer data type should be interpreted as unsigned bytes (GH1444). By Eric Bruning.Support using an existing, opened netCDF4
Dataset
withNetCDF4DataStore
. This permits creating anDataset
from a netCDF4Dataset
that has been opened using other means (GH1459). By Ryan May.Changed
PydapDataStore
to take a Pydap dataset. This permits opening Opendap datasets that require authentication, by instantiating a Pydap dataset with a session object. Also addedxarray.backends.PydapDataStore.open()
which takes a url and session object (GH1068). By Philip Graae.Support reading and writing unlimited dimensions with h5netcdf (GH1636). By Joe Hamman.
Other improvements
Added
_ipython_key_completions_
to xarray objects, to enable autocompletion for dictionary-like access in IPython, e.g.,ds['tem
+ tab ->ds['temperature']
(GH1628). By Keisuke Fujii.Support passing keyword arguments to
load
,compute
, andpersist
methods. Any keyword arguments supplied to these methods are passed on to the corresponding dask function (GH1523). By Joe Hamman.Encoding attributes are now preserved when xarray objects are concatenated. The encoding is copied from the first object (GH1297). By Joe Hamman and Gerrit Holl.
Support applying rolling window operations using bottleneck’s moving window functions on data stored as dask arrays (GH1279). By Joe Hamman.
Experimental support for the Dask collection interface (GH1674). By Matthew Rocklin.
Bug fixes#
Suppress
RuntimeWarning
issued bynumpy
for “invalid value comparisons” (e.g.NaN
). Xarray now behaves similarly to pandas in its treatment of binary and unary operations on objects with NaNs (GH1657). By Joe Hamman.Unsigned int support for reduce methods with
skipna=True
(GH1562). By Keisuke Fujii.Fixes to ensure xarray works properly with pandas 0.21:
to_series()
andto_dataframe()
should not return apandas.MultiIndex
for 1D data (GH1548).Fix plotting with datetime64 axis labels (GH1661).
By Stephan Hoyer.
open_rasterio()
method now shifts the rasterio coordinates so that they are centered in each pixel (GH1468). By Greg Brener.rename()
method now doesn’t throw errors if someVariable
is renamed to the same name as anotherVariable
as long as that otherVariable
is also renamed (GH1477). This method now does throw when twoVariables
would end up with the same name after the rename (since one of them would get overwritten in this case). By Prakhar Goel.Fix
xarray.testing.assert_allclose()
to actually useatol
andrtol
arguments when called onDataArray
objects (GH1488). By Stephan Hoyer.xarray
quantile
methods now properly raise aTypeError
when applied to objects with data stored asdask
arrays (GH1529). By Joe Hamman.Fix positional indexing to allow the use of unsigned integers (GH1405). By Joe Hamman and Gerrit Holl.
Creating a
Dataset
now raisesMergeError
if a coordinate shares a name with a dimension but is comprised of arbitrary dimensions (GH1120). By Joe Hamman.open_rasterio()
method now skips rasterio’scrs
attribute if its value isNone
(GH1520). By Leevi Annala.Fix
xarray.DataArray.to_netcdf()
to return bytes when no path is provided (GH1410). By Joe Hamman.Fix
xarray.save_mfdataset()
to properly raise an informative error when objects other thanDataset
are provided (GH1555). By Joe Hamman.xarray.Dataset.copy()
would not preserve the encoding property (GH1586). By Guido Imperiale.xarray.concat()
would eagerly load dask variables into memory if the first argument was a numpy variable (GH1588). By Guido Imperiale.Fix bug in
to_netcdf()
when writing in append mode (GH1215). By Joe Hamman.Fix
netCDF4
backend to properly roundtrip theshuffle
encoding option (GH1606). By Joe Hamman.Fix bug when using
pytest
class decorators to skipping certain unittests. The previous behavior unintentionally causing additional tests to be skipped (GH1531). By Joe Hamman.Fix pynio backend for upcoming release of pynio with Python 3 support (GH1611). By Ben Hillman.
Fix
seaborn
import warning for Seaborn versions 0.8 and newer when theapionly
module was deprecated. (GH1633). By Joe Hamman.Fix COMPAT: MultiIndex checking is fragile (GH1833). By Florian Pinault.
Fix
rasterio
backend for Rasterio versions 1.0alpha10 and newer. (GH1641). By Chris Holden.
Bug fixes after rc1#
Suppress warning in IPython autocompletion, related to the deprecation of
.T
attributes (GH1675). By Keisuke Fujii.Fix a bug in lazily-indexing netCDF array. (GH1688) By Keisuke Fujii.
(Internal bug) MemoryCachedArray now supports the orthogonal indexing. Also made some internal cleanups around array wrappers (GH1429). By Keisuke Fujii.
(Internal bug) MemoryCachedArray now always wraps
np.ndarray
byNumpyIndexingAdapter
. (GH1694) By Keisuke Fujii.Fix importing xarray when running Python with
-OO
(GH1706). By Stephan Hoyer.Saving a netCDF file with a coordinates with a spaces in its names now raises an appropriate warning (GH1689). By Stephan Hoyer.
Fix two bugs that were preventing dask arrays from being specified as coordinates in the DataArray constructor (GH1684). By Joe Hamman.
Fixed
apply_ufunc
withdask='parallelized'
for scalar arguments (GH1697). By Stephan Hoyer.Fix “Chunksize cannot exceed dimension size” error when writing netCDF4 files loaded from disk (GH1225). By Stephan Hoyer.
Validate the shape of coordinates with names matching dimensions in the DataArray constructor (GH1709). By Stephan Hoyer.
Raise
NotImplementedError
when attempting to save a MultiIndex to a netCDF file (GH1547). By Stephan Hoyer.Remove netCDF dependency from rasterio backend tests. By Matti Eskelinen
Bug fixes after rc2#
Fixed unexpected behavior in
Dataset.set_index()
andDataArray.set_index()
introduced by pandas 0.21.0. Setting a new index with a single variable resulted in 1-levelpandas.MultiIndex
instead of a simplepandas.Index
(GH1722). By Benoit Bovy.Fixed unexpected memory loading of backend arrays after
print
. (GH1720). By Keisuke Fujii.
v0.9.6 (8 June 2017)#
This release includes a number of backwards compatible enhancements and bug fixes.
Enhancements#
New
sortby()
method toDataset
andDataArray
that enable sorting along dimensions (GH967). See the docs for examples. By Chun-Wei Yuan and Kyle Heuton.Add
.dt
accessor to DataArrays for computing datetime-like properties for the values they contain, similar topandas.Series
(GH358). By Daniel Rothenberg.Renamed internal dask arrays created by
open_dataset
to match new dask conventions (GH1343). By Ryan Abernathey.as_variable()
is now part of the public API (GH1303). By Benoit Bovy.align()
now supportsjoin='exact'
, which raises an error instead of aligning when indexes to be aligned are not equal. By Stephan Hoyer.New function
open_rasterio()
for opening raster files with the rasterio library. See the docs for details. By Joe Hamman, Nic Wayand and Fabien Maussion
Bug fixes#
Fix error from repeated indexing of datasets loaded from disk (GH1374). By Stephan Hoyer.
Fix a bug where
.isel_points
wrongly assigns unselected coordinate todata_vars
. By Keisuke Fujii.Tutorial datasets are now checked against a reference MD5 sum to confirm successful download (GH1392). By Matthew Gidden.
DataArray.chunk()
now accepts dask specific kwargs likeDataset.chunk()
does. By Fabien Maussion.Support for
engine='pydap'
with recent releases of Pydap (3.2.2+), including on Python 3 (GH1174).
Documentation#
A new gallery allows to add interactive examples to the documentation. By Fabien Maussion.
Testing#
Fix test suite failure caused by changes to
pandas.cut
function (GH1386). By Ryan Abernathey.Enhanced tests suite by use of
@network
decorator, which is controlled via--run-network-tests
command line argument topy.test
(GH1393). By Matthew Gidden.
v0.9.5 (17 April, 2017)#
Remove an inadvertently introduced print statement.
v0.9.3 (16 April, 2017)#
This minor release includes bug-fixes and backwards compatible enhancements.
Enhancements#
New
persist()
method to Datasets and DataArrays to enable persisting data in distributed memory when using Dask (GH1344). By Matthew Rocklin.New
expand_dims()
method forDataArray
andDataset
(GH1326). By Keisuke Fujii.
Bug fixes#
Fix
.where()
withdrop=True
when arguments do not have indexes (GH1350). This bug, introduced in v0.9, resulted in xarray producing incorrect results in some cases. By Stephan Hoyer.Fixed writing to file-like objects with
to_netcdf()
(GH1320). Stephan Hoyer.Fixed explicitly setting
engine='scipy'
withto_netcdf
when not providing a path (GH1321). Stephan Hoyer.Fixed open_dataarray does not pass properly its parameters to open_dataset (GH1359). Stephan Hoyer.
Ensure test suite works when runs from an installed version of xarray (GH1336). Use
@pytest.mark.slow
instead of a custom flag to mark slow tests. By Stephan Hoyer
v0.9.2 (2 April 2017)#
The minor release includes bug-fixes and backwards compatible enhancements.
Enhancements#
rolling
on Dataset is now supported (GH859)..rolling()
on Dataset is now supported (GH859). By Keisuke Fujii.When bottleneck version 1.1 or later is installed, use bottleneck for rolling
var
,argmin
,argmax
, andrank
computations. Also, rolling median now accepts amin_periods
argument (GH1276). By Joe Hamman.When
.plot()
is called on a 2D DataArray and only one dimension is specified withx=
ory=
, the other dimension is now guessed (GH1291). By Vincent Noel.Added new method
assign_attrs()
toDataArray
andDataset
, a chained-method compatible implementation of thedict.update
method on attrs (GH1281). By Henry S. Harrison.Added new
autoclose=True
argument toopen_mfdataset()
to explicitly close opened files when not in use to prevent occurrence of an OS Error related to too many open files (GH1198). Note, the default isautoclose=False
, which is consistent with previous xarray behavior. By Phillip J. Wolfram.The
repr()
ofDataset
andDataArray
attributes uses a similar format to coordinates and variables, with vertically aligned entries truncated to fit on a single line (GH1319). Hopefully this will stop people writingdata.attrs = {}
and discarding metadata in notebooks for the sake of cleaner output. The full metadata is still available asdata.attrs
. By Zac Hatfield-Dodds.Enhanced tests suite by use of
@slow
and@flaky
decorators, which are controlled via--run-flaky
and--skip-slow
command line arguments topy.test
(GH1336). By Stephan Hoyer and Phillip J. Wolfram.New aggregation on rolling objects
count()
which providing a rolling count of valid values (GH1138).
Bug fixes#
Rolling operations now keep preserve original dimension order (GH1125). By Keisuke Fujii.
Fixed
sel
withmethod='nearest'
on Python 2.7 and 64-bit Windows (GH1140). Stephan Hoyer.Fixed
where
withdrop='True'
for empty masks (GH1341). By Stephan Hoyer and Phillip J. Wolfram.
v0.9.1 (30 January 2017)#
Renamed the “Unindexed dimensions” section in the Dataset
and
DataArray
repr (added in v0.9.0) to “Dimensions without coordinates”
(GH1199).
v0.9.0 (25 January 2017)#
This major release includes five months worth of enhancements and bug fixes from 24 contributors, including some significant changes that are not fully backwards compatible. Highlights include:
Coordinates are now optional in the xarray data model, even for dimensions.
Changes to caching, lazy loading and pickling to improve xarray’s experience for parallel computing.
Improvements for accessing and manipulating
pandas.MultiIndex
levels.Many new methods and functions, including
quantile()
,cumsum()
,cumprod()
combine_first
set_index()
,reset_index()
,reorder_levels()
,full_like()
,zeros_like()
,ones_like()
open_dataarray()
,compute()
,Dataset.info()
,testing.assert_equal()
,testing.assert_identical()
, andtesting.assert_allclose()
.
Breaking changes#
Index coordinates for each dimensions are now optional, and no longer created by default GH1017. You can identify such dimensions without coordinates by their appearance in list of “Dimensions without coordinates” in the
Dataset
orDataArray
repr:In [14]: xr.Dataset({"foo": (("x", "y"), [[1, 2]])}) Out[14]: <xarray.Dataset> Dimensions: (x: 1, y: 2) Dimensions without coordinates: x, y Data variables: foo (x, y) int64 1 2
This has a number of implications:
align()
andreindex()
can now error, if dimensions labels are missing and dimensions have different sizes.Because pandas does not support missing indexes, methods such as
to_dataframe
/from_dataframe
andstack
/unstack
no longer roundtrip faithfully on all inputs. Usereset_index()
to remove undesired indexes.Dataset.__delitem__
anddrop()
no longer delete/drop variables that have dimensions matching a deleted/dropped variable.DataArray.coords.__delitem__
is now allowed on variables matching dimension names..sel
and.loc
now handle indexing along a dimension without coordinate labels by doing integer based indexing. See Missing coordinate labels for an example.indexes
is no longer guaranteed to include all dimensions names as keys. The new methodget_index()
has been added to get an index for a dimension guaranteed, falling back to produce a defaultRangeIndex
if necessary.
The default behavior of
merge
is nowcompat='no_conflicts'
, so some merges will now succeed in cases that previously raisedxarray.MergeError
. Setcompat='broadcast_equals'
to restore the previous default. See Merging with ‘no_conflicts’ for more details.Reading
values
no longer always caches values in a NumPy array GH1128. Caching of.values
on variables read from netCDF files on disk is still the default whenopen_dataset()
is called withcache=True
. By Guido Imperiale and Stephan Hoyer.Pickling a
Dataset
orDataArray
linked to a file on disk no longer caches its values into memory before pickling (GH1128). Instead, pickle stores file paths and restores objects by reopening file references. This enables preliminary, experimental use of xarray for opening files with dask.distributed. By Stephan Hoyer.Coordinates used to index a dimension are now loaded eagerly into
pandas.Index
objects, instead of loading the values lazily. By Guido Imperiale.Automatic levels for 2d plots are now guaranteed to land on
vmin
andvmax
when these kwargs are explicitly provided (GH1191). The automated level selection logic also slightly changed. By Fabien Maussion.DataArray.rename()
behavior changed to strictly change theDataArray.name
if called with string argument, or strictly change coordinate names if called with dict-like argument. By Markus Gonser.By default
to_netcdf()
add a_FillValue = NaN
attributes to float types. By Frederic Laliberte.repr
onDataArray
objects uses an shortened display for NumPy array data that is less likely to overflow onto multiple pages (GH1207). By Stephan Hoyer.xarray no longer supports python 3.3, versions of dask prior to v0.9.0, or versions of bottleneck prior to v1.0.
Deprecations#
Renamed the
Coordinate
class from xarray’s low level API toIndexVariable
.Variable.to_variable
andVariable.to_coord
have been renamed toto_base_variable()
andto_index_variable()
.Deprecated supplying
coords
as a dictionary to theDataArray
constructor without also supplying an explicitdims
argument. The old behavior encouraged relying on the iteration order of dictionaries, which is a bad practice (GH727).Removed a number of methods deprecated since v0.7.0 or earlier:
load_data
,vars
,drop_vars
,dump
,dumps
and thevariables
keyword argument toDataset
.Removed the dummy module that enabled
import xray
.
Enhancements#
Added new method
combine_first()
toDataArray
andDataset
, based on the pandas method of the same name (see Combine). By Chun-Wei Yuan.Added the ability to change default automatic alignment (arithmetic_join=”inner”) for binary operations via
set_options()
(see Automatic alignment). By Chun-Wei Yuan.Add checking of
attr
names and values when saving to netCDF, raising useful error messages if they are invalid. (GH911). By Robin Wilson.Added ability to save
DataArray
objects directly to netCDF files usingto_netcdf()
, and to load directly from netCDF files usingopen_dataarray()
(GH915). These remove the need to convert aDataArray
to aDataset
before saving as a netCDF file, and deals with names to ensure a perfect ‘roundtrip’ capability. By Robin Wilson.Multi-index levels are now accessible as “virtual” coordinate variables, e.g.,
ds['time']
can pull out the'time'
level of a multi-index (see Coordinates).sel
also accepts providing multi-index levels as keyword arguments, e.g.,ds.sel(time='2000-01')
(see Multi-level indexing). By Benoit Bovy.Added
set_index
,reset_index
andreorder_levels
methods to easily create and manipulate (multi-)indexes (see Set and reset index). By Benoit Bovy.Added the
compat
option'no_conflicts'
tomerge
, allowing the combination of xarray objects with disjoint (GH742) or overlapping (GH835) coordinates as long as all present data agrees. By Johnnie Gray. See Merging with ‘no_conflicts’ for more details.It is now possible to set
concat_dim=None
explicitly inopen_mfdataset()
to disable inferring a dimension along which to concatenate. By Stephan Hoyer.Added methods
DataArray.compute()
,Dataset.compute()
, andVariable.compute()
as a non-mutating alternative toload()
. By Guido Imperiale.Adds DataArray and Dataset methods
cumsum()
andcumprod()
. By Phillip J. Wolfram.New properties
Dataset.sizes
andDataArray.sizes
for providing consistent access to dimension length on bothDataset
andDataArray
(GH921). By Stephan Hoyer.New keyword argument
drop=True
forsel()
,isel()
andsqueeze()
for dropping scalar coordinates that arise from indexing.DataArray
(GH242). By Stephan Hoyer.New top-level functions
full_like()
,zeros_like()
, andones_like()
By Guido Imperiale.Overriding a preexisting attribute with
register_dataset_accessor()
orregister_dataarray_accessor()
now issues a warning instead of raising an error (GH1082). By Stephan Hoyer.Options for axes sharing between subplots are exposed to
FacetGrid
andplot()
, so axes sharing can be disabled for polar plots. By Bas Hoonhout.New utility functions
assert_equal()
,assert_identical()
, andassert_allclose()
for asserting relationships between xarray objects, designed for use in a pytest test suite.figsize
,size
andaspect
plot arguments are now supported for all plots (GH897). See Controlling the figure size for more details. By Stephan Hoyer and Fabien Maussion.New
info()
method to summarizeDataset
variables and attributes. The method prints to a buffer (e.g.stdout
) with output similar to what the command line utilityncdump -h
produces (GH1150). By Joe Hamman.Added the ability write unlimited netCDF dimensions with the
scipy
andnetcdf4
backends via the newxray.Dataset.encoding
attribute or via theunlimited_dims
argument toxray.Dataset.to_netcdf
. By Joe Hamman.New
quantile()
method to calculate quantiles from DataArray objects (GH1187). By Joe Hamman.
Bug fixes#
groupby_bins
now restores empty bins by default (GH1019). By Ryan Abernathey.Fix issues for dates outside the valid range of pandas timestamps (GH975). By Mathias Hauser.
Unstacking produced flipped array after stacking decreasing coordinate values (GH980). By Stephan Hoyer.
Setting
dtype
via theencoding
parameter ofto_netcdf
failed if the encoded dtype was the same as the dtype of the original array (GH873). By Stephan Hoyer.Fix issues with variables where both attributes
_FillValue
andmissing_value
are set toNaN
(GH997). By Marco Zühlke..where()
and.fillna()
now preserve attributes (GH1009). By Fabien Maussion.Applying
broadcast()
to an xarray object based on the dask backend won’t accidentally convert the array from dask to numpy anymore (GH978). By Guido Imperiale.Dataset.concat()
now preserves variables order (GH1027). By Fabien Maussion.Fixed an issue with pcolormesh (GH781). A new
infer_intervals
keyword gives control on whether the cell intervals should be computed or not. By Fabien Maussion.Grouping over an dimension with non-unique values with
groupby
gives correct groups. By Stephan Hoyer.Fixed accessing coordinate variables with non-string names from
.coords
. By Stephan Hoyer.rename()
now simultaneously renames the array and any coordinate with the same name, when supplied via adict
(GH1116). By Yves Delley.Fixed sub-optimal performance in certain operations with object arrays (GH1121). By Yves Delley.
Fix
.groupby(group)
whengroup
has datetime dtype (GH1132). By Jonas Sølvsteen.Fixed a bug with facetgrid (the
norm
keyword was ignored, GH1159). By Fabien Maussion.Resolved a concurrency bug that could cause Python to crash when simultaneously reading and writing netCDF4 files with dask (GH1172). By Stephan Hoyer.
Fix to make
.copy()
actually copy dask arrays, which will be relevant for future releases of dask in which dask arrays will be mutable (GH1180). By Stephan Hoyer.Fix opening NetCDF files with multi-dimensional time variables (GH1229). By Stephan Hoyer.
Performance improvements#
xarray.Dataset.isel_points
andxarray.Dataset.sel_points
now use vectorised indexing in numpy and dask (GH1161), which can result in several orders of magnitude speedup. By Jonathan Chambers.
v0.8.2 (18 August 2016)#
This release includes a number of bug fixes and minor enhancements.
Breaking changes#
broadcast()
andconcat()
now auto-align inputs, usingjoin=outer
. Previously, these functions raisedValueError
for non-aligned inputs. By Guido Imperiale.
Enhancements#
New documentation on Transitioning from pandas.Panel to xarray. By Maximilian Roos.
New
Dataset
andDataArray
methodsto_dict()
andfrom_dict()
to allow easy conversion between dictionaries and xarray objects (GH432). See dictionary IO for more details. By Julia Signell.Added
exclude
andindexes
optional parameters toalign()
, andexclude
optional parameter tobroadcast()
. By Guido Imperiale.Better error message when assigning variables without dimensions (GH971). By Stephan Hoyer.
Better error message when reindex/align fails due to duplicate index values (GH956). By Stephan Hoyer.
Bug fixes#
Ensure xarray works with h5netcdf v0.3.0 for arrays with
dtype=str
(GH953). By Stephan Hoyer.Dataset.__dir__()
(i.e. the method python calls to get autocomplete options) failed if one of the dataset’s keys was not a string (GH852). By Maximilian Roos.Dataset
constructor can now take arbitrary objects as values (GH647). By Maximilian Roos.Clarified
copy
argument forreindex()
andalign()
, which now consistently always return new xarray objects (GH927).Fix
open_mfdataset
withengine='pynio'
(GH936). By Stephan Hoyer.groupby_bins
sorted bin labels as strings (GH952). By Stephan Hoyer.Fix bug introduced by v0.8.0 that broke assignment to datasets when both the left and right side have the same non-unique index values (GH956).
v0.8.1 (5 August 2016)#
Bug fixes#
Fix bug in v0.8.0 that broke assignment to Datasets with non-unique indexes (GH943). By Stephan Hoyer.
v0.8.0 (2 August 2016)#
This release includes four months of new features and bug fixes, including several breaking changes.
Breaking changes#
Dropped support for Python 2.6 (GH855).
Indexing on multi-index now drop levels, which is consistent with pandas. It also changes the name of the dimension / coordinate when the multi-index is reduced to a single index (GH802).
Contour plots no longer add a colorbar per default (GH866). Filled contour plots are unchanged.
DataArray.values
and.data
now always returns an NumPy array-like object, even for 0-dimensional arrays with object dtype (GH867). Previously,.values
returned native Python objects in such cases. To convert the values of scalar arrays to Python objects, use the.item()
method.
Enhancements#
Groupby operations now support grouping over multidimensional variables. A new method called
groupby_bins()
has also been added to allow users to specify bins for grouping. The new features are described in Multidimensional Grouping and Working with Multidimensional Coordinates. By Ryan Abernathey.DataArray and Dataset method
where()
now supports adrop=True
option that clips coordinate elements that are fully masked. By Phillip J. Wolfram.New top level
merge()
function allows for combining variables from any number ofDataset
and/orDataArray
variables. See Merge for more details. By Stephan Hoyer.DataArray.resample()
andDataset.resample()
now support thekeep_attrs=False
option that determines whether variable and dataset attributes are retained in the resampled object. By Jeremy McGibbon.Better multi-index support in
DataArray.sel()
,DataArray.loc()
,Dataset.sel()
andDataset.loc()
, which now behave more closely to pandas and which also accept dictionaries for indexing based on given level names and labels (see Multi-level indexing). By Benoit Bovy.New (experimental) decorators
register_dataset_accessor()
andregister_dataarray_accessor()
for registering custom xarray extensions without subclassing. They are described in the new documentation page on Xarray Internals. By Stephan Hoyer.Round trip boolean datatypes. Previously, writing boolean datatypes to netCDF formats would raise an error since netCDF does not have a bool datatype. This feature reads/writes a dtype attribute to boolean variables in netCDF files. By Joe Hamman.
2D plotting methods now have two new keywords (cbar_ax and cbar_kwargs), allowing more control on the colorbar (GH872). By Fabien Maussion.
New Dataset method
Dataset.filter_by_attrs()
, akin tonetCDF4.Dataset.get_variables_by_attributes
, to easily filter data variables using its attributes. Filipe Fernandes.
Bug fixes#
Attributes were being retained by default for some resampling operations when they should not. With the
keep_attrs=False
option, they will no longer be retained by default. This may be backwards-incompatible with some scripts, but the attributes may be kept by adding thekeep_attrs=True
option. By Jeremy McGibbon.Concatenating xarray objects along an axis with a MultiIndex or PeriodIndex preserves the nature of the index (GH875). By Stephan Hoyer.
Fixed bug in arithmetic operations on DataArray objects whose dimensions are numpy structured arrays or recarrays GH861, GH837. By Maciek Swat.
decode_cf_timedelta
now accepts arrays withndim
>1 (GH842).This fixes issue GH665. Filipe Fernandes.
Fix a bug where xarray.ufuncs that take two arguments would incorrectly use to numpy functions instead of dask.array functions (GH876). By Stephan Hoyer.
Support for pickling functions from
xarray.ufuncs
(GH901). By Stephan Hoyer.Variable.copy(deep=True)
no longer converts MultiIndex into a base Index (GH769). By Benoit Bovy.Fixes for groupby on dimensions with a multi-index (GH867). By Stephan Hoyer.
Fix printing datasets with unicode attributes on Python 2 (GH892). By Stephan Hoyer.
Fixed incorrect test for dask version (GH891). By Stephan Hoyer.
Fixed dim argument for isel_points/sel_points when a pandas.Index is passed. By Stephan Hoyer.
contour()
now plots the correct number of contours (GH866). By Fabien Maussion.
v0.7.2 (13 March 2016)#
This release includes two new, entirely backwards compatible features and several bug fixes.
Enhancements#
New DataArray method
DataArray.dot()
for calculating the dot product of two DataArrays along shared dimensions. By Dean Pospisil.Rolling window operations on DataArray objects are now supported via a new
DataArray.rolling()
method. For example:In [15]: import xarray as xr ....: import numpy as np ....: In [16]: arr = xr.DataArray(np.arange(0, 7.5, 0.5).reshape(3, 5), dims=("x", "y")) In [17]: arr Out[17]: <xarray.DataArray (x: 3, y: 5)> array([[ 0. , 0.5, 1. , 1.5, 2. ], [ 2.5, 3. , 3.5, 4. , 4.5], [ 5. , 5.5, 6. , 6.5, 7. ]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4 In [18]: arr.rolling(y=3, min_periods=2).mean() Out[18]: <xarray.DataArray (x: 3, y: 5)> array([[ nan, 0.25, 0.5 , 1. , 1.5 ], [ nan, 2.75, 3. , 3.5 , 4. ], [ nan, 5.25, 5.5 , 6. , 6.5 ]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4
See Rolling window operations for more details. By Joe Hamman.
Bug fixes#
Fixed an issue where plots using pcolormesh and Cartopy axes were being distorted by the inference of the axis interval breaks. This change chooses not to modify the coordinate variables when the axes have the attribute
projection
, allowing Cartopy to handle the extent of pcolormesh plots (GH781). By Joe Hamman.2D plots now better handle additional coordinates which are not
DataArray
dimensions (GH788). By Fabien Maussion.
v0.7.1 (16 February 2016)#
This is a bug fix release that includes two small, backwards compatible enhancements. We recommend that all users upgrade.
Enhancements#
Bug fixes#
Restore checks for shape consistency between data and coordinates in the DataArray constructor (GH758).
Single dimension variables no longer transpose as part of a broader
.transpose
. This behavior was causingpandas.PeriodIndex
dimensions to lose their type (GH749)Dataset
labels remain as their native type on.to_dataset
. Previously they were coerced to strings (GH745)Fixed a bug where replacing a
DataArray
index coordinate would improperly align the coordinate (GH725).DataArray.reindex_like
now maintains the dtype of complex numbers when reindexing leads to NaN values (GH738).Dataset.rename
andDataArray.rename
support the old and new names being the same (GH724).Fix
from_dataframe()
for DataFrames with Categorical column and a MultiIndex index (GH737).Fixes to ensure xarray works properly after the upcoming pandas v0.18 and NumPy v1.11 releases.
Acknowledgments#
The following individuals contributed to this release:
Edward Richards
Maximilian Roos
Rafael Guedes
Spencer Hill
Stephan Hoyer
v0.7.0 (21 January 2016)#
This major release includes redesign of DataArray
internals, as well as new methods for reshaping, rolling and shifting
data. It includes preliminary support for pandas.MultiIndex
,
as well as a number of other features and bug fixes, several of which
offer improved compatibility with pandas.
New name#
The project formerly known as “xray” is now “xarray”, pronounced “x-array”! This avoids a namespace conflict with the entire field of x-ray science. Renaming our project seemed like the right thing to do, especially because some scientists who work with actual x-rays are interested in using this project in their work. Thanks for your understanding and patience in this transition. You can now find our documentation and code repository at new URLs:
To ease the transition, we have simultaneously released v0.7.0 of both
xray
and xarray
on the Python Package Index. These packages are
identical. For now, import xray
still works, except it issues a
deprecation warning. This will be the last xray release. Going forward, we
recommend switching your import statements to import xarray as xr
.
Breaking changes#
The internal data model used by
xray.DataArray
has been rewritten to fix several outstanding issues (GH367, GH634, this stackoverflow report). Internally,DataArray
is now implemented in terms of._variable
and._coords
attributes instead of holding variables in aDataset
object.This refactor ensures that if a DataArray has the same name as one of its coordinates, the array and the coordinate no longer share the same data.
In practice, this means that creating a DataArray with the same
name
as one of its dimensions no longer automatically uses that array to label the corresponding coordinate. You will now need to provide coordinate labels explicitly. Here’s the old behavior:In [19]: xray.DataArray([4, 5, 6], dims="x", name="x") Out[19]: <xray.DataArray 'x' (x: 3)> array([4, 5, 6]) Coordinates: * x (x) int64 4 5 6
and the new behavior (compare the values of the
x
coordinate):In [20]: xray.DataArray([4, 5, 6], dims="x", name="x") Out[20]: <xray.DataArray 'x' (x: 3)> array([4, 5, 6]) Coordinates: * x (x) int64 0 1 2
It is no longer possible to convert a DataArray to a Dataset with
xray.DataArray.to_dataset
if it is unnamed. This will now raiseValueError
. If the array is unnamed, you need to supply thename
argument.
Enhancements#
Basic support for
MultiIndex
coordinates on xray objects, including indexing,stack()
andunstack()
:In [21]: df = pd.DataFrame({"foo": range(3), "x": ["a", "b", "b"], "y": [0, 0, 1]}) In [22]: s = df.set_index(["x", "y"])["foo"] In [23]: arr = xray.DataArray(s, dims="z") In [24]: arr Out[24]: <xray.DataArray 'foo' (z: 3)> array([0, 1, 2]) Coordinates: * z (z) object ('a', 0) ('b', 0) ('b', 1) In [25]: arr.indexes["z"] Out[25]: MultiIndex(levels=[[u'a', u'b'], [0, 1]], labels=[[0, 1, 1], [0, 0, 1]], names=[u'x', u'y']) In [26]: arr.unstack("z") Out[26]: <xray.DataArray 'foo' (x: 2, y: 2)> array([[ 0., nan], [ 1., 2.]]) Coordinates: * x (x) object 'a' 'b' * y (y) int64 0 1 In [27]: arr.unstack("z").stack(z=("x", "y")) Out[27]: <xray.DataArray 'foo' (z: 4)> array([ 0., nan, 1., 2.]) Coordinates: * z (z) object ('a', 0) ('a', 1) ('b', 0) ('b', 1)
See Stack and unstack for more details.
Warning
xray’s MultiIndex support is still experimental, and we have a long to- do list of desired additions (GH719), including better display of multi-index levels when printing a
Dataset
, and support for saving datasets with a MultiIndex to a netCDF file. User contributions in this area would be greatly appreciated.Support for reading GRIB, HDF4 and other file formats via PyNIO.
Better error message when a variable is supplied with the same name as one of its dimensions.
Plotting: more control on colormap parameters (GH642).
vmin
andvmax
will not be silently ignored anymore. Settingcenter=False
prevents automatic selection of a divergent colormap.New
xray.Dataset.shift
andxray.Dataset.roll
methods for shifting/rotating datasets or arrays along a dimension:In [28]: array = xray.DataArray([5, 6, 7, 8], dims="x") In [29]: array.shift(x=2) Out[29]: <xarray.DataArray (x: 4)> Size: 32B array([nan, nan, 5., 6.]) Dimensions without coordinates: x In [30]: array.roll(x=2) Out[30]: <xarray.DataArray (x: 4)> Size: 32B array([7, 8, 5, 6]) Dimensions without coordinates: x
Notice that
shift
moves data independently of coordinates, butroll
moves both data and coordinates.Assigning a
pandas
object directly as aDataset
variable is now permitted. Its index names correspond to thedims
of theDataset
, and its data is aligned.Passing a
pandas.DataFrame
orpandas.Panel
to a Dataset constructor is now permitted.New function
xray.broadcast
for explicitly broadcastingDataArray
andDataset
objects against each other. For example:In [31]: a = xray.DataArray([1, 2, 3], dims="x") In [32]: b = xray.DataArray([5, 6], dims="y") In [33]: a Out[33]: <xarray.DataArray (x: 3)> Size: 24B array([1, 2, 3]) Dimensions without coordinates: x In [34]: b Out[34]: <xarray.DataArray (y: 2)> Size: 16B array([5, 6]) Dimensions without coordinates: y In [35]: a2, b2 = xray.broadcast(a, b) In [36]: a2 Out[36]: <xarray.DataArray (x: 3, y: 2)> Size: 48B array([[1, 1], [2, 2], [3, 3]]) Dimensions without coordinates: x, y In [37]: b2 Out[37]: <xarray.DataArray (x: 3, y: 2)> Size: 48B array([[5, 6], [5, 6], [5, 6]]) Dimensions without coordinates: x, y
Bug fixes#
Fixes for several issues found on
DataArray
objects with the same name as one of their coordinates (see Breaking changes for more details).DataArray.to_masked_array
always returns masked array with mask being an array (not a scalar value) (GH684)Allows for (imperfect) repr of Coords when underlying index is PeriodIndex (GH645).
Fixes for several issues found on
DataArray
objects with the same name as one of their coordinates (see Breaking changes for more details).Attempting to assign a
Dataset
orDataArray
variable/attribute using attribute-style syntax (e.g.,ds.foo = 42
) now raises an error rather than silently failing (GH656, GH714).You can now pass pandas objects with non-numpy dtypes (e.g.,
categorical
ordatetime64
with a timezone) into xray without an error (GH716).
Acknowledgments#
The following individuals contributed to this release:
Antony Lee
Fabien Maussion
Joe Hamman
Maximilian Roos
Stephan Hoyer
Takeshi Kanmae
femtotrader
v0.6.1 (21 October 2015)#
This release contains a number of bug and compatibility fixes, as well as enhancements to plotting, indexing and writing files to disk.
Note that the minimum required version of dask for use with xray is now version 0.6.
API Changes#
The handling of colormaps and discrete color lists for 2D plots in
xray.DataArray.plot
was changed to provide more compatibility with matplotlib’scontour
andcontourf
functions (GH538). Now discrete lists of colors should be specified usingcolors
keyword, rather thancmap
.
Enhancements#
Faceted plotting through
xray.plot.FacetGrid
and thexray.plot.plot
method. See Faceting for more details and examples.xray.Dataset.sel
andxray.Dataset.reindex
now support thetolerance
argument for controlling nearest-neighbor selection (GH629):In [38]: array = xray.DataArray([1, 2, 3], dims="x") In [39]: array.reindex(x=[0.9, 1.5], method="nearest", tolerance=0.2) Out[39]: <xray.DataArray (x: 2)> array([ 2., nan]) Coordinates: * x (x) float64 0.9 1.5
This feature requires pandas v0.17 or newer.
New
encoding
argument inxray.Dataset.to_netcdf
for writing netCDF files with compression, as described in the new documentation section on Writing encoded data.Add
xray.Dataset.real
andxray.Dataset.imag
attributes to Dataset and DataArray (GH553).More informative error message with
xray.Dataset.from_dataframe
if the frame has duplicate columns.xray now uses deterministic names for dask arrays it creates or opens from disk. This allows xray users to take advantage of dask’s nascent support for caching intermediate computation results. See GH555 for an example.
Bug fixes#
Forwards compatibility with the latest pandas release (v0.17.0). We were using some internal pandas routines for datetime conversion, which unfortunately have now changed upstream (GH569).
Aggregation functions now correctly skip
NaN
for data forcomplex128
dtype (GH554).Fixed indexing 0d arrays with unicode dtype (GH568).
xray.DataArray.name
and Dataset keys must be a string or None to be written to netCDF (GH533).xray.DataArray.where
now uses dask instead of numpy if either the array orother
is a dask array. Previously, ifother
was a numpy array the method was evaluated eagerly.Global attributes are now handled more consistently when loading remote datasets using
engine='pydap'
(GH574).It is now possible to assign to the
.data
attribute of DataArray objects.