Skip to content
forked from pydata/xarray

Commit

Permalink
$Merge branch 'main' into grouper-objects
Browse files Browse the repository at this point in the history
* main: (34 commits)
  Update whats-new.rst
  Fix binning by unsorted array (pydata#7762)
  Bump codecov/codecov-action from 3.1.1 to 3.1.2 (pydata#7760)
  Fix typing errors using mypy 1.2 (pydata#7752)
  [skip-ci] dev whats-new
  Add whats-new for v2023.04.0 (pydata#7757)
  remove the `black` hook (pydata#7756)
  reword the what's new entry for the `pandas` 2.0 dtype changes (pydata#7755)
  restructure the contributing guide (pydata#7681)
  Continue to use nanosecond-precision Timestamps in precision-sensitive areas (pydata#7731)
  minor doc updates to clarify extensions using accessors (pydata#7751)
  align: Avoid reindexing when join="exact" (pydata#7736)
  `pandas=2.0` support (pydata#7724)
  Clarify vectorized indexing documentation (pydata#7747)
  Avoid recasting a CFTimeIndex (pydata#7735)
  fix typo (pydata#7746)
  [pre-commit.ci] pre-commit autoupdate (pydata#7745)
  Bump pypa/gh-action-pypi-publish from 1.8.4 to 1.8.5 (pydata#7743)
  preserve boolean dtype in encoding (pydata#7720)
  [skip-ci] Add alignment benchmarks (pydata#7738)
  ...
  • Loading branch information
dcherian committed Apr 18, 2023
2 parents 2188a17 + 4f5675c commit 5a0ba46
Show file tree
Hide file tree
Showing 75 changed files with 1,865 additions and 577 deletions.
23 changes: 23 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the [Contributing Guide](https://docs.xarray.dev/en/latest/contributing.html) for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient.
If you have questions, some answers may be found in our [contributing guidelines](http://docs.xarray.dev/en/stable/contributing.html).
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Congratulations on completing your first pull request! Welcome to Xarray!
We are proud of you, and hope to see you again!
![celebration gif](https://media.giphy.com/media/umYMU8G2ixG5mJBDo5/giphy.gif)
8 changes: 4 additions & 4 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ jobs:
python xarray/util/print_versions.py
- name: Install mypy
run: |
python -m pip install 'mypy<0.990'
python -m pip install mypy --force-reinstall
- name: Run mypy
run: |
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v3.1.2
with:
file: mypy_report/cobertura.xml
flags: mypy
Expand Down Expand Up @@ -173,14 +173,14 @@ jobs:
python xarray/util/print_versions.py
- name: Install mypy
run: |
python -m pip install 'mypy<0.990'
python -m pip install mypy --force-reinstall
- name: Run mypy
run: |
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v3.1.2
with:
file: mypy_report/cobertura.xml
flags: mypy39
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
path: pytest.xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v3.1.2
with:
file: ./coverage.xml
flags: unittests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Publish package to TestPyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@v1.8.3
uses: pypa/gh-action-pypi-publish@v1.8.5
with:
user: __token__
password: ${{ secrets.TESTPYPI_TOKEN }}
Expand All @@ -90,7 +90,7 @@ jobs:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.3
uses: pypa/gh-action-pypi-publish@v1.8.5
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testpypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Publish package to TestPyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@v1.8.3
uses: pypa/gh-action-pypi-publish@v1.8.5
with:
user: __token__
password: ${{ secrets.TESTPYPI_TOKEN }}
Expand Down
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@ repos:
files: ^xarray/
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.259'
rev: 'v0.0.261'
hooks:
- id: ruff
args: ["--fix"]
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
- id: black-jupyter
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: blackdoc
exclude: "generate_aggregations.py"
additional_dependencies: ["black==23.1.0"]
additional_dependencies: ["black==23.3.0"]
- id: blackdoc-autoupdate-black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.2.0
hooks:
- id: mypy
# Copied from setup.cfg
Expand Down
3 changes: 2 additions & 1 deletion asv_bench/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"distributed": [""],
"flox": [""],
"numpy_groupies": [""],
"sparse": [""]
"sparse": [""],
"cftime": [""]
},


Expand Down
54 changes: 54 additions & 0 deletions asv_bench/benchmarks/alignment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import numpy as np

import xarray as xr

from . import parameterized, requires_dask

ntime = 365 * 30
nx = 50
ny = 50

rng = np.random.default_rng(0)


class Align:
def setup(self, *args, **kwargs):
data = rng.standard_normal((ntime, nx, ny))
self.ds = xr.Dataset(
{"temperature": (("time", "x", "y"), data)},
coords={
"time": xr.date_range("2000", periods=ntime),
"x": np.arange(nx),
"y": np.arange(ny),
},
)
self.year = self.ds.time.dt.year
self.idx = np.unique(rng.integers(low=0, high=ntime, size=ntime // 2))
self.year_subset = self.year.isel(time=self.idx)

@parameterized(["join"], [("outer", "inner", "left", "right", "exact", "override")])
def time_already_aligned(self, join):
xr.align(self.ds, self.year, join=join)

@parameterized(["join"], [("outer", "inner", "left", "right")])
def time_not_aligned(self, join):
xr.align(self.ds, self.year[-100:], join=join)

@parameterized(["join"], [("outer", "inner", "left", "right")])
def time_not_aligned_random_integers(self, join):
xr.align(self.ds, self.year_subset, join=join)


class AlignCFTime(Align):
def setup(self, *args, **kwargs):
super().setup()
self.ds["time"] = xr.date_range("2000", periods=ntime, calendar="noleap")
self.year = self.ds.time.dt.year
self.year_subset = self.year.isel(time=self.idx)


class AlignDask(Align):
def setup(self, *args, **kwargs):
requires_dask()
super().setup()
self.ds = self.ds.chunk({"time": 100})
2 changes: 1 addition & 1 deletion ci/requirements/all-but-dask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
- numbagg
- numpy<1.24
- packaging
- pandas<2
- pandas
- pint
- pip
- pseudonetcdf
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- numba
- numpy>=1.21,<1.24
- packaging>=21.3
- pandas>=1.4,<2
- pandas>=1.4
- pooch
- pip
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-py311.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- numexpr
- numpy
- packaging
- pandas<2
- pandas
- pint
- pip
- pooch
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows-py311.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
# - numbagg
- numpy
- packaging
- pandas<2
- pandas
- pint
- pip
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- numbagg
- numpy<1.24
- packaging
- pandas<2
- pandas
- pint
- pip
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- numexpr
- numpy<1.24
- packaging
- pandas<2
- pandas
- pint
- pip
- pooch
Expand Down
14 changes: 1 addition & 13 deletions doc/api-hidden.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
Variable.dims
Variable.dtype
Variable.encoding
Variable.reset_encoding
Variable.imag
Variable.nbytes
Variable.ndim
Expand Down Expand Up @@ -374,10 +375,8 @@
CFTimeIndex.is_floating
CFTimeIndex.is_integer
CFTimeIndex.is_interval
CFTimeIndex.is_mixed
CFTimeIndex.is_numeric
CFTimeIndex.is_object
CFTimeIndex.is_type_compatible
CFTimeIndex.isin
CFTimeIndex.isna
CFTimeIndex.isnull
Expand All @@ -398,7 +397,6 @@
CFTimeIndex.round
CFTimeIndex.searchsorted
CFTimeIndex.set_names
CFTimeIndex.set_value
CFTimeIndex.shift
CFTimeIndex.slice_indexer
CFTimeIndex.slice_locs
Expand All @@ -412,7 +410,6 @@
CFTimeIndex.to_flat_index
CFTimeIndex.to_frame
CFTimeIndex.to_list
CFTimeIndex.to_native_types
CFTimeIndex.to_numpy
CFTimeIndex.to_series
CFTimeIndex.tolist
Expand All @@ -437,8 +434,6 @@
CFTimeIndex.hasnans
CFTimeIndex.hour
CFTimeIndex.inferred_type
CFTimeIndex.is_all_dates
CFTimeIndex.is_monotonic
CFTimeIndex.is_monotonic_increasing
CFTimeIndex.is_monotonic_decreasing
CFTimeIndex.is_unique
Expand Down Expand Up @@ -483,7 +478,6 @@
backends.NetCDF4DataStore.is_remote
backends.NetCDF4DataStore.lock

backends.NetCDF4BackendEntrypoint.available
backends.NetCDF4BackendEntrypoint.description
backends.NetCDF4BackendEntrypoint.url
backends.NetCDF4BackendEntrypoint.guess_can_open
Expand Down Expand Up @@ -516,7 +510,6 @@
backends.H5NetCDFStore.sync
backends.H5NetCDFStore.ds

backends.H5netcdfBackendEntrypoint.available
backends.H5netcdfBackendEntrypoint.description
backends.H5netcdfBackendEntrypoint.url
backends.H5netcdfBackendEntrypoint.guess_can_open
Expand All @@ -531,7 +524,6 @@
backends.PseudoNetCDFDataStore.open_store_variable
backends.PseudoNetCDFDataStore.ds

backends.PseudoNetCDFBackendEntrypoint.available
backends.PseudoNetCDFBackendEntrypoint.description
backends.PseudoNetCDFBackendEntrypoint.url
backends.PseudoNetCDFBackendEntrypoint.guess_can_open
Expand All @@ -546,7 +538,6 @@
backends.PydapDataStore.open
backends.PydapDataStore.open_store_variable

backends.PydapBackendEntrypoint.available
backends.PydapBackendEntrypoint.description
backends.PydapBackendEntrypoint.url
backends.PydapBackendEntrypoint.guess_can_open
Expand Down Expand Up @@ -574,7 +565,6 @@
backends.ScipyDataStore.sync
backends.ScipyDataStore.ds

backends.ScipyBackendEntrypoint.available
backends.ScipyBackendEntrypoint.description
backends.ScipyBackendEntrypoint.url
backends.ScipyBackendEntrypoint.guess_can_open
Expand All @@ -595,13 +585,11 @@
backends.ZarrStore.sync
backends.ZarrStore.ds

backends.ZarrBackendEntrypoint.available
backends.ZarrBackendEntrypoint.description
backends.ZarrBackendEntrypoint.url
backends.ZarrBackendEntrypoint.guess_can_open
backends.ZarrBackendEntrypoint.open_dataset

backends.StoreBackendEntrypoint.available
backends.StoreBackendEntrypoint.description
backends.StoreBackendEntrypoint.url
backends.StoreBackendEntrypoint.guess_can_open
Expand Down
4 changes: 4 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Dataset contents
Dataset.drop_dims
Dataset.set_coords
Dataset.reset_coords
Dataset.reset_encoding
Dataset.convert_calendar
Dataset.interp_calendar
Dataset.get_index
Expand Down Expand Up @@ -303,6 +304,7 @@ DataArray contents
DataArray.drop_indexes
DataArray.drop_duplicates
DataArray.reset_coords
DataArray.reset_encoding
DataArray.copy
DataArray.convert_calendar
DataArray.interp_calendar
Expand Down Expand Up @@ -640,6 +642,7 @@ DataArray methods
DataArray.to_numpy
DataArray.to_pandas
DataArray.to_series
DataArray.to_zarr
DataArray.chunk
DataArray.close
DataArray.compute
Expand Down Expand Up @@ -1094,6 +1097,7 @@ Advanced API
backends.BackendArray
backends.BackendEntrypoint
backends.list_engines
backends.refresh_engines

Default, pandas-backed indexes built-in Xarray:

Expand Down
Loading

0 comments on commit 5a0ba46

Please sign in to comment.