Skip to content
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

Add rename_vars and rename_dims #3045

Merged
merged 31 commits into from
Jul 2, 2019
Merged

Add rename_vars and rename_dims #3045

merged 31 commits into from
Jul 2, 2019

Conversation

jukent
Copy link
Contributor

@jukent jukent commented Jun 25, 2019

@jukent
Copy link
Contributor Author

jukent commented Jun 25, 2019

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

@pep8speaks
Copy link

pep8speaks commented Jun 25, 2019

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

xarray/tests/test_dataset.py Outdated Show resolved Hide resolved
@max-sixty
Copy link
Collaborator

FYI the failure in appveyor is unrelated and can be ignored

xarray/tests/test_dataset.py Outdated Show resolved Hide resolved
xarray.code-workspace Outdated Show resolved Hide resolved
Co-Authored-By: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Copy link
Collaborator

@max-sixty max-sixty left a comment

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

xarray/core/dataset.py Show resolved Hide resolved
xarray/core/dataset.py Outdated Show resolved Hide resolved
xarray/tests/test_dataset.py Show resolved Hide resolved
xarray/tests/test_dataset.py Show resolved Hide resolved
xarray/tests/test_dataset.py Show resolved Hide resolved
xarray/core/dataset.py Outdated Show resolved Hide resolved
xarray/core/dataset.py Outdated Show resolved Hide resolved
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
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.

xarray/core/dataset.py Outdated Show resolved Hide resolved
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
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
Copy link
Contributor Author

jukent commented Jun 26, 2019

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
Copy link
Member

shoyer commented Jun 26, 2019

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
Copy link
Contributor Author

jukent commented Jun 26, 2019

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
Copy link
Contributor Author

jukent commented Jul 1, 2019

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

Copy link
Contributor

@dcherian dcherian left a comment

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.

doc/whats-new.rst Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 1, 2019

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
Copy link
Contributor

dcherian commented Jul 1, 2019

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
Copy link
Member

shoyer commented Jul 2, 2019

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
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
Copy link
Contributor Author

jukent commented Jul 2, 2019

Added those tests for for the raised Value Error.

@shoyer
Copy link
Member

shoyer commented Jul 2, 2019

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
Copy link
Member

@shoyer shoyer Jul 2, 2019

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
Copy link
Member

shoyer commented Jul 2, 2019

thanks @jukent !

@max-sixty
Copy link
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