Skip to content

Add coarsen.construct - #5476

Merged
dcherian merged 16 commits into
pydata:mainfrom
dcherian:coarsen_reshape
Jun 24, 2021
Merged

Add coarsen.construct#5476
dcherian merged 16 commits into
pydata:mainfrom
dcherian:coarsen_reshape

Conversation

@dcherian

@dcheriandcherian commented Jun 16, 2021

Copy link
Copy Markdown
Contributor
  • ClosesAdd coarsen.construct #5454
  • Tests added
  • Passes pre-commit run --all-files
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

Builds on #5474

Here's an example

importnumpyasnpimportxarrayasxrds=xr.Dataset(
{
"vart": ("time", np.arange(48)),
"varx": ("x", np.arange(10)),
"vartx": (("x", "time"), np.arange(480).reshape(10, 48)),
"vary": ("y", np.arange(12)),
},
coords={"time": np.arange(48), "y": np.arange(12)},
)
ds.coarsen(time=12, x=5, boundary="trim").construct(
{"time": ("year", "month"), "x": ("x", "x_reshaped")}
)

What do people think of this syntax: {"time": ("year", "month"), "x": ("x", "x_reshaped")? Should we instead do {"time": "month", "x": "x_reshaped"} and have the user later rename the x or time dimension if they want?

@pep8speaks

pep8speaks commented Jun 16, 2021

Copy link
Copy Markdown

Hello @dcherian! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 16:1: F401 '.test_dataarray.da' imported but unused
Line 17:1: F401 '.test_dataset.ds' imported but unused
Line 20:36: F811 redefinition of unused 'ds' from line 17
Line 27:26: F811 redefinition of unused 'ds' from line 17
Line 42:25: F811 redefinition of unused 'ds' from line 17
Line 58:5: F811 redefinition of unused 'da' from line 16
Line 69:5: F811 redefinition of unused 'da' from line 16
Line 91:5: F811 redefinition of unused 'ds' from line 17
Line 163:5: F811 redefinition of unused 'ds' from line 17
Line 193:25: F811 redefinition of unused 'ds' from line 17
Line 224:5: F811 redefinition of unused 'da' from line 16
Line 276:5: F811 redefinition of unused 'da' from line 16
Line 298:28: F811 redefinition of unused 'da' from line 16
Line 314:5: F811 redefinition of unused 'ds' from line 17

Comment last updated at 2021-06-23 16:18:22 UTC

@dcheriandcherian changed the title Refactor out coarsen testsAdd coarsen.constructJun 16, 2021

@mathausemathause left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good I left some minor comments. I have not looked at the moved tests.

Comment threadxarray/core/rolling.py Outdated
Comment threadxarray/core/rolling.py Outdated
Comment threadxarray/core/rolling.py Outdated
Comment threadxarray/core/rolling.py
Comment threadxarray/core/rolling.py Outdated
Comment threadxarray/tests/test_coarsen.py Outdated
@dcherian

Copy link
Copy Markdown
ContributorAuthor

This should be ready for review & merge

@mathausemathause left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@dcheriandcherian added plan to merge Final call for comments and removed needs review labels Jun 23, 2021
* main:
Improve error message for guess engine (pydata#5455)
Refactor dataset groupby tests (pydata#5506)
DOC: zarr note on encoding (pydata#5427)
Allow plotting categorical data (pydata#5464)
@keewiskeewis mentioned this pull request Jun 23, 2021
@dcherian

Copy link
Copy Markdown
ContributorAuthor

Thanks for the review @mathause

@dcherian
dcherian merged commit 8a338ee into pydata:mainJun 24, 2021
@dcherian
dcherian deleted the coarsen_reshape branch June 24, 2021 16:55
@github-actions

Copy link
Copy Markdown
Contributor

Unit Test Results

0 files ±0 0 suites ±0 0s ⏱️ ±0s
0 tests ±0 0 ✔️ ±0 0 💤 ±0 0 ❌ ±0 

Results for commit 8a338ee. ± Comparison against base commit 8a338ee.

@TomNicholasTomNicholas mentioned this pull request Jul 8, 2021
8 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan to mergeFinal call for comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add coarsen.construct

3 participants

@dcherian@pep8speaks@mathause