github pydata/xarray v0.3.2

This release focused on bug-fixes, speedups and resolving some niggling inconsistencies.

There are a few cases where the behavior of xray differs from the previous version. However, I expect that in almost all cases your code will continue to run unmodified.

xray now requires pandas v0.15.0 or later. This was necessary for supporting TimedeltaIndex without too many painful hacks.

Backwards incompatible changes:

  • Arrays of datetime.datetime objects are now automatically cast to datetime64[ns] arrays when stored in an xray object, using machinery borrowed from pandas:

    In [1]: from datetime import datetime
    In [2]: xray.Dataset({'t': [datetime(2000, 1, 1)]})
    Out[2]: 
    <xray.Dataset>
    Dimensions:  (t: 1)
    Coordinates:
    * t        (t) datetime64[ns] 2000-01-01
    Variables:
      *empty*
    
  • xray now has support (including serialization to netCDF) for pandas.TimedeltaIndex. datetime.timedelta objects are thus accordingly cast to timedelta64[ns] objects when appropriate.

  • Masked arrays are now properly coerced to use NaN as a sentinel value.

Enhancements:

  • Due to popular demand, we have added experimental attribute style access as a shortcut for dataset variables, coordinates and attributes:
    In [3]: ds = xray.Dataset({'tmin': ([], 25, {'units': 'celcius'})}) In [4]: ds.tmin.units Out[4]: 'celcius'

Tab-completion for these variables should work in editors such as IPython. However, setting variables or attributes in this fashion is not yet supported because there are some unresolved ambiguities.

  • You can now use a dictionary for indexing with labeled dimensions. This provides a safe way to do assignment with labeled dimensions:

    In [5]: array = xray.DataArray(np.zeros(5), dims=['x'])
    In [6]: array[dict(x=slice(3))] = 1
    In [7]: array
    Out[7]: 
    <xray.DataArray (x: 5)>
    array([ 1.,  1.,  1.,  0.,  0.])
    Coordinates:
    * x        (x) int64 0 1 2 3 4
    
  • Non-index coordinates can now be faithfully written to and restored from netCDF files. This is done according to CF conventions when possible by using the coordinates attribute on a data variable. When not possible, xray defines a global coordinates attribute.

  • Preliminary support for converting xray.DataArray objects to and from CDAT cdms2 variables.

  • We sped up any operation that involves creating a new Dataset or DataArray (e.g., indexing, aggregation, arithmetic) by a factor of 30 to 50%. The full speed up requires cyordereddict to be installed.

Bug fixes:

  • Fix for to_dataframe() with 0d string/object coordinates
  • Fix for to_netcdf with 0d string variable
  • Fix writing datetime64 arrays to netcdf if NaT is present
  • Fix align silently upcasts data arrays when NaNs are inserted
latest releases: v0.19.0, v0.18.2, v0.18.1...
6 years ago