Skip to content
forked from pydata/xarray

Commit 5a0ba46

Browse files
committed
$Merge branch 'main' into grouper-objects
* 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) ...
2 parents 2188a17 + 4f5675c commit 5a0ba46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1865
-577
lines changed

.github/config.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Comment to be posted to on first time issues
2+
newIssueWelcomeComment: >
3+
Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
4+
5+
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
6+
7+
See the [Contributing Guide](https://docs.xarray.dev/en/latest/contributing.html) for more.
8+
9+
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
10+
11+
Thank you!
12+
13+
# Comment to be posted to on PRs from first time contributors in your repository
14+
newPRWelcomeComment: >
15+
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient.
16+
17+
If you have questions, some answers may be found in our [contributing guidelines](http://docs.xarray.dev/en/stable/contributing.html).
18+
19+
# Comment to be posted to on pull requests merged by a first time user
20+
firstPRMergeComment: >
21+
Congratulations on completing your first pull request! Welcome to Xarray!
22+
We are proud of you, and hope to see you again!
23+
![celebration gif](https://media.giphy.com/media/umYMU8G2ixG5mJBDo5/giphy.gif)

.github/workflows/ci-additional.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ jobs:
119119
python xarray/util/print_versions.py
120120
- name: Install mypy
121121
run: |
122-
python -m pip install 'mypy<0.990'
122+
python -m pip install mypy --force-reinstall
123123
124124
- name: Run mypy
125125
run: |
126126
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
127127
128128
- name: Upload mypy coverage to Codecov
129-
uses: codecov/[email protected].1
129+
uses: codecov/[email protected].2
130130
with:
131131
file: mypy_report/cobertura.xml
132132
flags: mypy
@@ -173,14 +173,14 @@ jobs:
173173
python xarray/util/print_versions.py
174174
- name: Install mypy
175175
run: |
176-
python -m pip install 'mypy<0.990'
176+
python -m pip install mypy --force-reinstall
177177
178178
- name: Run mypy
179179
run: |
180180
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
181181
182182
- name: Upload mypy coverage to Codecov
183-
uses: codecov/[email protected].1
183+
uses: codecov/[email protected].2
184184
with:
185185
file: mypy_report/cobertura.xml
186186
flags: mypy39

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
path: pytest.xml
140140

141141
- name: Upload code coverage to Codecov
142-
uses: codecov/[email protected].1
142+
uses: codecov/[email protected].2
143143
with:
144144
file: ./coverage.xml
145145
flags: unittests

.github/workflows/pypi-release.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
7373
- name: Publish package to TestPyPI
7474
if: github.event_name == 'push'
75-
uses: pypa/[email protected].3
75+
uses: pypa/[email protected].5
7676
with:
7777
user: __token__
7878
password: ${{ secrets.TESTPYPI_TOKEN }}
@@ -90,7 +90,7 @@ jobs:
9090
name: releases
9191
path: dist
9292
- name: Publish package to PyPI
93-
uses: pypa/[email protected].3
93+
uses: pypa/[email protected].5
9494
with:
9595
user: __token__
9696
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/testpypi-release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
7979
- name: Publish package to TestPyPI
8080
if: github.event_name == 'push'
81-
uses: pypa/[email protected].3
81+
uses: pypa/[email protected].5
8282
with:
8383
user: __token__
8484
password: ${{ secrets.TESTPYPI_TOKEN }}

.pre-commit-config.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@ repos:
1616
files: ^xarray/
1717
- repo: https://github.com/charliermarsh/ruff-pre-commit
1818
# Ruff version.
19-
rev: 'v0.0.259'
19+
rev: 'v0.0.261'
2020
hooks:
2121
- id: ruff
2222
args: ["--fix"]
2323
# https://github.com/python/black#version-control-integration
2424
- repo: https://github.com/psf/black
25-
rev: 23.1.0
25+
rev: 23.3.0
2626
hooks:
27-
- id: black
2827
- id: black-jupyter
2928
- repo: https://github.com/keewis/blackdoc
3029
rev: v0.3.8
3130
hooks:
3231
- id: blackdoc
3332
exclude: "generate_aggregations.py"
34-
additional_dependencies: ["black==23.1.0"]
33+
additional_dependencies: ["black==23.3.0"]
3534
- id: blackdoc-autoupdate-black
3635
- repo: https://github.com/pre-commit/mirrors-mypy
37-
rev: v1.1.1
36+
rev: v1.2.0
3837
hooks:
3938
- id: mypy
4039
# Copied from setup.cfg

asv_bench/asv.conf.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"distributed": [""],
6969
"flox": [""],
7070
"numpy_groupies": [""],
71-
"sparse": [""]
71+
"sparse": [""],
72+
"cftime": [""]
7273
},
7374

7475

asv_bench/benchmarks/alignment.py

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import numpy as np
2+
3+
import xarray as xr
4+
5+
from . import parameterized, requires_dask
6+
7+
ntime = 365 * 30
8+
nx = 50
9+
ny = 50
10+
11+
rng = np.random.default_rng(0)
12+
13+
14+
class Align:
15+
def setup(self, *args, **kwargs):
16+
data = rng.standard_normal((ntime, nx, ny))
17+
self.ds = xr.Dataset(
18+
{"temperature": (("time", "x", "y"), data)},
19+
coords={
20+
"time": xr.date_range("2000", periods=ntime),
21+
"x": np.arange(nx),
22+
"y": np.arange(ny),
23+
},
24+
)
25+
self.year = self.ds.time.dt.year
26+
self.idx = np.unique(rng.integers(low=0, high=ntime, size=ntime // 2))
27+
self.year_subset = self.year.isel(time=self.idx)
28+
29+
@parameterized(["join"], [("outer", "inner", "left", "right", "exact", "override")])
30+
def time_already_aligned(self, join):
31+
xr.align(self.ds, self.year, join=join)
32+
33+
@parameterized(["join"], [("outer", "inner", "left", "right")])
34+
def time_not_aligned(self, join):
35+
xr.align(self.ds, self.year[-100:], join=join)
36+
37+
@parameterized(["join"], [("outer", "inner", "left", "right")])
38+
def time_not_aligned_random_integers(self, join):
39+
xr.align(self.ds, self.year_subset, join=join)
40+
41+
42+
class AlignCFTime(Align):
43+
def setup(self, *args, **kwargs):
44+
super().setup()
45+
self.ds["time"] = xr.date_range("2000", periods=ntime, calendar="noleap")
46+
self.year = self.ds.time.dt.year
47+
self.year_subset = self.year.isel(time=self.idx)
48+
49+
50+
class AlignDask(Align):
51+
def setup(self, *args, **kwargs):
52+
requires_dask()
53+
super().setup()
54+
self.ds = self.ds.chunk({"time": 100})

ci/requirements/all-but-dask.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
- numbagg
2626
- numpy<1.24
2727
- packaging
28-
- pandas<2
28+
- pandas
2929
- pint
3030
- pip
3131
- pseudonetcdf

ci/requirements/doc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- numba
2020
- numpy>=1.21,<1.24
2121
- packaging>=21.3
22-
- pandas>=1.4,<2
22+
- pandas>=1.4
2323
- pooch
2424
- pip
2525
- pre-commit

ci/requirements/environment-py311.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies:
2727
- numexpr
2828
- numpy
2929
- packaging
30-
- pandas<2
30+
- pandas
3131
- pint
3232
- pip
3333
- pooch

ci/requirements/environment-windows-py311.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
# - numbagg
2525
- numpy
2626
- packaging
27-
- pandas<2
27+
- pandas
2828
- pint
2929
- pip
3030
- pre-commit

ci/requirements/environment-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- numbagg
2525
- numpy<1.24
2626
- packaging
27-
- pandas<2
27+
- pandas
2828
- pint
2929
- pip
3030
- pre-commit

ci/requirements/environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies:
2727
- numexpr
2828
- numpy<1.24
2929
- packaging
30-
- pandas<2
30+
- pandas
3131
- pint
3232
- pip
3333
- pooch

doc/api-hidden.rst

+1-13
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
Variable.dims
235235
Variable.dtype
236236
Variable.encoding
237+
Variable.reset_encoding
237238
Variable.imag
238239
Variable.nbytes
239240
Variable.ndim
@@ -374,10 +375,8 @@
374375
CFTimeIndex.is_floating
375376
CFTimeIndex.is_integer
376377
CFTimeIndex.is_interval
377-
CFTimeIndex.is_mixed
378378
CFTimeIndex.is_numeric
379379
CFTimeIndex.is_object
380-
CFTimeIndex.is_type_compatible
381380
CFTimeIndex.isin
382381
CFTimeIndex.isna
383382
CFTimeIndex.isnull
@@ -398,7 +397,6 @@
398397
CFTimeIndex.round
399398
CFTimeIndex.searchsorted
400399
CFTimeIndex.set_names
401-
CFTimeIndex.set_value
402400
CFTimeIndex.shift
403401
CFTimeIndex.slice_indexer
404402
CFTimeIndex.slice_locs
@@ -412,7 +410,6 @@
412410
CFTimeIndex.to_flat_index
413411
CFTimeIndex.to_frame
414412
CFTimeIndex.to_list
415-
CFTimeIndex.to_native_types
416413
CFTimeIndex.to_numpy
417414
CFTimeIndex.to_series
418415
CFTimeIndex.tolist
@@ -437,8 +434,6 @@
437434
CFTimeIndex.hasnans
438435
CFTimeIndex.hour
439436
CFTimeIndex.inferred_type
440-
CFTimeIndex.is_all_dates
441-
CFTimeIndex.is_monotonic
442437
CFTimeIndex.is_monotonic_increasing
443438
CFTimeIndex.is_monotonic_decreasing
444439
CFTimeIndex.is_unique
@@ -483,7 +478,6 @@
483478
backends.NetCDF4DataStore.is_remote
484479
backends.NetCDF4DataStore.lock
485480

486-
backends.NetCDF4BackendEntrypoint.available
487481
backends.NetCDF4BackendEntrypoint.description
488482
backends.NetCDF4BackendEntrypoint.url
489483
backends.NetCDF4BackendEntrypoint.guess_can_open
@@ -516,7 +510,6 @@
516510
backends.H5NetCDFStore.sync
517511
backends.H5NetCDFStore.ds
518512

519-
backends.H5netcdfBackendEntrypoint.available
520513
backends.H5netcdfBackendEntrypoint.description
521514
backends.H5netcdfBackendEntrypoint.url
522515
backends.H5netcdfBackendEntrypoint.guess_can_open
@@ -531,7 +524,6 @@
531524
backends.PseudoNetCDFDataStore.open_store_variable
532525
backends.PseudoNetCDFDataStore.ds
533526

534-
backends.PseudoNetCDFBackendEntrypoint.available
535527
backends.PseudoNetCDFBackendEntrypoint.description
536528
backends.PseudoNetCDFBackendEntrypoint.url
537529
backends.PseudoNetCDFBackendEntrypoint.guess_can_open
@@ -546,7 +538,6 @@
546538
backends.PydapDataStore.open
547539
backends.PydapDataStore.open_store_variable
548540

549-
backends.PydapBackendEntrypoint.available
550541
backends.PydapBackendEntrypoint.description
551542
backends.PydapBackendEntrypoint.url
552543
backends.PydapBackendEntrypoint.guess_can_open
@@ -574,7 +565,6 @@
574565
backends.ScipyDataStore.sync
575566
backends.ScipyDataStore.ds
576567

577-
backends.ScipyBackendEntrypoint.available
578568
backends.ScipyBackendEntrypoint.description
579569
backends.ScipyBackendEntrypoint.url
580570
backends.ScipyBackendEntrypoint.guess_can_open
@@ -595,13 +585,11 @@
595585
backends.ZarrStore.sync
596586
backends.ZarrStore.ds
597587

598-
backends.ZarrBackendEntrypoint.available
599588
backends.ZarrBackendEntrypoint.description
600589
backends.ZarrBackendEntrypoint.url
601590
backends.ZarrBackendEntrypoint.guess_can_open
602591
backends.ZarrBackendEntrypoint.open_dataset
603592

604-
backends.StoreBackendEntrypoint.available
605593
backends.StoreBackendEntrypoint.description
606594
backends.StoreBackendEntrypoint.url
607595
backends.StoreBackendEntrypoint.guess_can_open

doc/api.rst

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Dataset contents
112112
Dataset.drop_dims
113113
Dataset.set_coords
114114
Dataset.reset_coords
115+
Dataset.reset_encoding
115116
Dataset.convert_calendar
116117
Dataset.interp_calendar
117118
Dataset.get_index
@@ -303,6 +304,7 @@ DataArray contents
303304
DataArray.drop_indexes
304305
DataArray.drop_duplicates
305306
DataArray.reset_coords
307+
DataArray.reset_encoding
306308
DataArray.copy
307309
DataArray.convert_calendar
308310
DataArray.interp_calendar
@@ -640,6 +642,7 @@ DataArray methods
640642
DataArray.to_numpy
641643
DataArray.to_pandas
642644
DataArray.to_series
645+
DataArray.to_zarr
643646
DataArray.chunk
644647
DataArray.close
645648
DataArray.compute
@@ -1094,6 +1097,7 @@ Advanced API
10941097
backends.BackendArray
10951098
backends.BackendEntrypoint
10961099
backends.list_engines
1100+
backends.refresh_engines
10971101

10981102
Default, pandas-backed indexes built-in Xarray:
10991103

0 commit comments

Comments
 (0)