Skip to content

Add a simple nbytes representation in DataArrays and Dataset repr #8702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ v2024.02.0 (unreleased)
New Features
~~~~~~~~~~~~

- Added a simple `nbytes` representation in DataArrays and Dataset `repr`.
(:issue:`8690`, :pull:`8702`).
By `Etienne Schalk <https://github.com/etienneschalk>`_.
- Allow negative frequency strings (e.g. ``"-1YE"``). These strings are for example used
in :py:func:`date_range`, and :py:func:`cftime_range` (:pull:`8651`).
By `Mathias Hauser <https://github.com/mathause>`_.
Expand Down
6 changes: 3 additions & 3 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,12 +1431,12 @@ def save_mfdataset(
... coords={"time": pd.date_range("2010-01-01", freq="ME", periods=48)},
... )
>>> ds
<xarray.Dataset>
<xarray.Dataset> Size: 768B
Dimensions: (time: 48)
Coordinates:
* time (time) datetime64[ns] 2010-01-31 2010-02-28 ... 2013-12-31
* time (time) datetime64[ns] 384B 2010-01-31 2010-02-28 ... 2013-12-31
Data variables:
a (time) float64 0.0 0.02128 0.04255 0.06383 ... 0.9574 0.9787 1.0
a (time) float64 384B 0.0 0.02128 0.04255 ... 0.9574 0.9787 1.0
>>> years, datasets = zip(*ds.groupby("time.year"))
>>> paths = [f"{y}.nc" for y in years]
>>> xr.save_mfdataset(datasets, paths)
Expand Down
12 changes: 6 additions & 6 deletions xarray/coding/cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,30 +383,30 @@ def _partial_date_slice(self, resolution, parsed):
... dims=["time"],
... )
>>> da.sel(time="2001-01-01")
<xarray.DataArray (time: 1)>
<xarray.DataArray (time: 1)> Size: 8B
array([1])
Coordinates:
* time (time) object 2001-01-01 00:00:00
* time (time) object 8B 2001-01-01 00:00:00
>>> da = xr.DataArray(
... [1, 2],
... coords=[[pd.Timestamp(2001, 1, 1), pd.Timestamp(2001, 2, 1)]],
... dims=["time"],
... )
>>> da.sel(time="2001-01-01")
<xarray.DataArray ()>
<xarray.DataArray ()> Size: 8B
array(1)
Coordinates:
time datetime64[ns] 2001-01-01
time datetime64[ns] 8B 2001-01-01
>>> da = xr.DataArray(
... [1, 2],
... coords=[[pd.Timestamp(2001, 1, 1, 1), pd.Timestamp(2001, 2, 1)]],
... dims=["time"],
... )
>>> da.sel(time="2001-01-01")
<xarray.DataArray (time: 1)>
<xarray.DataArray (time: 1)> Size: 8B
array([1])
Coordinates:
* time (time) datetime64[ns] 2001-01-01T01:00:00
* time (time) datetime64[ns] 8B 2001-01-01T01:00:00
"""
start, end = _parsed_string_to_bounds(self.date_type, resolution, parsed)

Expand Down
Loading