Skip to content

Conversation

@leouieda
Copy link
Member

We were relying on the order of the coords attribute of the data set to meshgrid the coordinates. This is wrong because xarray takes the coordinate order from dims instead, which is what we should also do. Took this chance to refactor the code and included a test that would have caught the bug.

Reminders:

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst and the base __init__.py file for the package.
  • Write detailed docstrings for all functions/classes/methods. It often helps to design better code if you write the docstrings first.
  • If adding new functionality, add an example to the docstring, gallery, and/or tutorials.

Was using coords but thats an unordered dict and not necessarily the
order of dimensions for the dataset.
The dims in the Dataset aren't ordered. Have to get them from the
DataArrays themselves. Simplified some of the code for the rest of the
function as well. Tests pass but need to check with different data
arrays.
Copy link
Contributor

@jessepisel jessepisel left a comment

Choose a reason for hiding this comment

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

These changes look good, nice work @leouieda . The function is easier to read and is more explicit. Tests look reasonable, and all the builds are passing.

@leouieda
Copy link
Member Author

Thanks, @jessepisel! Merging this in now.

@leouieda leouieda merged commit 0c314c6 into master Feb 27, 2020
@leouieda leouieda deleted the grid-to-table-bug branch February 27, 2020 11:23
@leouieda leouieda mentioned this pull request Mar 12, 2020
6 tasks
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.

3 participants