Skip to content

Add rename_vars and rename_dims - #3045

Merged
shoyer merged 31 commits into
pydata:masterfrom
jukent:master
Jul 2, 2019
Merged

Add rename_vars and rename_dims#3045
shoyer merged 31 commits into
pydata:masterfrom
jukent:master

Conversation

@jukent

@jukent jukent commented Jun 25, 2019

Copy link
Copy Markdown
Contributor

@jukent

jukent commented Jun 25, 2019

Copy link
Copy Markdown
Contributor Author

I uninstalled the bot that automatically closed the pull request #3042

@pep8speaks

pep8speaks commented Jun 25, 2019

Copy link
Copy Markdown

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

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-07-02 18:28:57 UTC

Comment thread xarray/tests/test_dataset.py Outdated
@max-sixty

Copy link
Copy Markdown
Collaborator

FYI the failure in appveyor is unrelated and can be ignored

Comment thread xarray/tests/test_dataset.py Outdated
Comment thread xarray.code-workspace Outdated
Co-Authored-By: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>

@max-sixty max-sixty 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.

Great! Thanks @jukent

Only items:

  • remove miscreant (vscode?) file
  • depending on your + others thoughts, change to rename_variables
  • add kwargs test

Comment thread xarray/core/dataset.py
Comment thread xarray/core/dataset.py Outdated
Comment thread xarray/tests/test_dataset.py
Comment thread xarray/tests/test_dataset.py
Comment thread xarray/tests/test_dataset.py
Comment thread xarray/core/dataset.py Outdated
Comment thread xarray/core/dataset.py Outdated
jukent and others added 3 commits June 26, 2019 11:43
Co-Authored-By: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-Authored-By: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
@dcherian

Copy link
Copy Markdown
Contributor

@jukent You should also give yourself credit in whats-new.rst and add stuff to api.rst. I also see that you're a first-time contributor. Welcome! We really appreciate your efforts.

Comment thread xarray/core/dataset.py Outdated
jukent and others added 3 commits June 26, 2019 11:59
Co-Authored-By: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
@max-sixty

Copy link
Copy Markdown
Collaborator

FYI tests are failing with E NameError: name '_rename_var_dims_helper' is not defined: https://travis-ci.org/pydata/xarray/jobs/550940568

@jukent

jukent commented Jun 26, 2019

Copy link
Copy Markdown
Contributor Author

FYI tests are failing with E NameError: name '_rename_var_dims_helper' is not defined: https://travis-ci.org/pydata/xarray/jobs/550940568

Huh not sure why that is. I can remove that function and see if it works then.

@shoyer

shoyer commented Jun 26, 2019

Copy link
Copy Markdown
Member

I would definitely recommend reading through our contributor's guide on how to setup a local environment for testing your code: http://xarray.pydata.org/en/stable/contributing.html

It is much easier to fix issues when you run tests locally rather than waiting on continuous integration tests (Travis-CI) to tell you that things are broken.

@jukent

jukent commented Jun 26, 2019

Copy link
Copy Markdown
Contributor Author

I would definitely recommend reading through our contributor's guide on how to setup a local environment for testing your code: http://xarray.pydata.org/en/stable/contributing.html

It is much easier to fix issues when you run tests locally rather than waiting on continuous integration tests (Travis-CI) to tell you that things are broken.

Thank you was just needing to look into this.

@jukent

jukent commented Jul 1, 2019

Copy link
Copy Markdown
Contributor Author

Checks could be more complicated, but I think this is ready to merge!

@dcherian dcherian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

whats-new fix required. Otherwise LGTM.

Comment thread doc/whats-new.rst Outdated
@codecov

codecov Bot commented Jul 1, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3045 into master will increase coverage by 1.01%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3045      +/-   ##
==========================================
+ Coverage   93.78%   94.79%   +1.01%     
==========================================
  Files          68       67       -1     
  Lines       13156    12892     -264     
==========================================
- Hits        12338    12221     -117     
+ Misses        818      671     -147
Impacted Files Coverage Δ
xarray/core/dataset.py 96.14% <94.11%> (-0.1%) ⬇️
xarray/_version.py

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0aeee7f...b3232ad. Read the comment docs.

@dcherian dcherian changed the title Reopened rename_vars and rename_dims fxs with tests! Add rename_vars and rename_dims Jul 1, 2019
@dcherian

dcherian commented Jul 1, 2019

Copy link
Copy Markdown
Contributor

OK fixed whats-new. Sorry it gets a little confusing if there's been a release in the meantime.

This looks good to me. @max-sixty check once more and merge?

@shoyer

shoyer commented Jul 2, 2019

Copy link
Copy Markdown
Member

Looking at the coverage report from codecov above, it looks like the lines where you raise ValueError for non-existent keys currently don't have any test coverage. Please add unit tests that verify the right error is raised, i.e., with pytest.raises.

@max-sixty

Copy link
Copy Markdown
Collaborator

The code looks great now, nice work @jukent - very succinct

If we can add that small test that @shoyer references (can do it in one of the existing test, just two lines), and potentially there's a duplication in the whatsnew.

(I'm on vacation so don't wait for me to merge)

@jukent

jukent commented Jul 2, 2019

Copy link
Copy Markdown
Contributor Author

Added those tests for for the raised Value Error.

@shoyer

shoyer commented Jul 2, 2019

Copy link
Copy Markdown
Member

pep8speaks has a few minor style complaints to fix: #3045 (comment)

actual_2 = original.rename_vars(**name_dict)
assert_identical(expected, actual_2)

# Test to raise ValueError

@shoyer shoyer Jul 2, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For future reference, try to leave out redundant comments like this that literally describe how code works. If it would be just as clear to read the code directly, it's best to let code stand on its own.

@shoyer
shoyer merged commit af37ddd into pydata:master Jul 2, 2019
@shoyer

shoyer commented Jul 2, 2019

Copy link
Copy Markdown
Member

thanks @jukent !

@max-sixty

Copy link
Copy Markdown
Collaborator

Thanks @jukent! We're happy to have you as a contributor!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename dims independently from coords?

5 participants