-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added an introduction to the reshaping documentation #7623
Conversation
nishtha981
commented
Mar 14, 2023
- Closes Reshaping doc intro looks incomplete #7091
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR and welcome to xarray.
I think this intro can still be improved, I have left a few hints. Maybe collectively we can come up with a more general motivation.
@@ -6,6 +6,16 @@ Reshaping and reorganizing data | |||
|
|||
These methods allow you to reorganize your data by changing dimensions, array shape, order of values, or indexes. | |||
|
|||
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sentence should be the first one of this intro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay!
Will change that and put it as the beginning
doc/user-guide/reshaping.rst
Outdated
@@ -6,6 +6,16 @@ Reshaping and reorganizing data | |||
|
|||
These methods allow you to reorganize your data by changing dimensions, array shape, order of values, or indexes. | |||
|
|||
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. | |||
|
|||
To reorder dimensions on a DataArray or across all variables on a Dataset, use the transpose() method. An ellipsis (...) can be used to represent all other dimensions. To expand a DataArray or all variables on a Dataset along a new dimension, use the expand_dims() method. This method attaches a new dimension with size 1 to all data variables. To remove such a size-1 dimension from the DataArray or Dataset, use the squeeze() method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think having this short summary which repeats parts from below is very useful to have here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
Will remove it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost :)
doc/user-guide/reshaping.rst
Outdated
@@ -4,7 +4,9 @@ | |||
Reshaping and reorganizing data | |||
############################### | |||
|
|||
These methods allow you to reorganize your data by changing dimensions, array shape, order of values, or indexes. | |||
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. To convert from a Dataset to a DataArray, use the to_array() method. Unlike pandas, xarray's stack() method does not automatically drop missing values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. To convert from a Dataset to a DataArray, use the to_array() method. Unlike pandas, xarray's stack() method does not automatically drop missing values. | |
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. |
No need to mention specific method and their peculiarities in the introduction already.
I didn't check below, so make sure that the section about these methods contain the sentences you have added here.
doc/user-guide/reshaping.rst
Outdated
These methods allow you to reorganize your data by changing dimensions, array shape, order of values, or indexes. | ||
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. To convert from a Dataset to a DataArray, use the to_array() method. Unlike pandas, xarray's stack() method does not automatically drop missing values. | ||
|
||
These methods are particularly useful for reshaping xarray objects for use in machine learning packages, such as scikit-learn, that usually require two-dimensional numpy arrays as inputs. It can also be used in working with geospatial data where we need to analyze and visualize geospatial data, such as satellite imagery or geospatial datasets. Xarray can also be used for time series analysis, including forecasting and anomaly detection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods are particularly useful for reshaping xarray objects for use in machine learning packages, such as scikit-learn, that usually require two-dimensional numpy arrays as inputs. It can also be used in working with geospatial data where we need to analyze and visualize geospatial data, such as satellite imagery or geospatial datasets. Xarray can also be used for time series analysis, including forecasting and anomaly detection. | |
These methods are particularly useful for reshaping xarray objects for use in machine learning packages, such as scikit-learn, that usually require two-dimensional numpy arrays as inputs. It can also be used in working with geospatial data where we need to analyze and visualize geospatial data, such as satellite imagery or geospatial datasets. |
I think the last sentence does not really apply to reshaping. You can just drop it completely or check if you can add it somewhere else in a more general introduction.
@headtr1ck @TomNicholas |
doc/user-guide/reshaping.rst
Outdated
These methods allow you to reorganize your data by changing dimensions, array shape, order of values, or indexes. | ||
Reshaping and reorganizing data refers to the process of changing the structure or organization of data by modifying dimensions, array shapes, order of values, or indexes. Xarray provides several methods to accomplish these tasks. Unlike pandas, xarray's stack() method does not automatically drop missing values. | ||
|
||
These methods are particularly useful for reshaping xarray objects for use in machine learning packages, such as scikit-learn, that usually require two-dimensional numpy arrays as inputs. It can also be used in working with geospatial data where we need to analyze and visualize geospatial data, such as satellite imagery or geospatial datasets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to say "geospatial data" three times in the same sentence.
Instead I might say
"Reshaping can also be required before passing data to external visualization tools, for example geospatial data might expect input organized into a particular format corresponding to stacks of satellite images."
I've made a final edit to remove the mention of a specific method in the intro, and remove some blanks lines. This looks good to me now so I'll merge it! Thanks @nishtha981 ! |
Hey! |
Hey @TomNicholas |
Hi @nishtha981 - that's great that you identified what was causing the docs ci builds to fail! I was wondering why that was! Fixing this for xarray may require more than just re-running the ci. For example it might require us to pin a particular version of a library (here sphinx_book_theme) in order to guarantee the CI works again. If it doesn't work immediately now, what we normally do is to open a new github issue on xarray's issue tracker to track the problem. That way if the problem comes up in multiple PRs we can just refer all of them back to the one issue, until it gets resolved completely. |
I've also just told the readthedocs to rebuild just now |
@TomNicholas |
Head branch was pushed to by a user without write access
I am not sure if pinning works as pydata-sphinx-theme had some private function which sphinx-book-theme was using but now it cannot. |
See #7703 |
Hey! @TomNicholas |
Thanks @nishtha981 ! I just realised after merging that this PR should in theory have had a corresponding entry in the what's new page, as all PRs are supposed to have. We won't worry about that this time, but try and remember to add it next time! That way you will also be listed as a contributor on the what's new page. |
Sure! |