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 inplace arg for dataset methods #100

Open
robertjwilson opened this issue Aug 24, 2023 · 0 comments
Open

Add inplace arg for dataset methods #100

robertjwilson opened this issue Aug 24, 2023 · 0 comments

Comments

@robertjwilson
Copy link
Member

Currently, it is slightly tedious to create new datasets based on existing ones. This requires you to use the copy method.

For example, if you wanted to create a new dataset so that you could plot the spatial average of a dataset, you would have to do this:

`ds1 = ds.copy()`
`ds.spatial_mean()`
`ds1.plot()`

This is one step too many. Methods currently modify datasets in place. What's needed is a way to return a new dataset with an inplace arg similar to what happens in pandas. So the above would become:

`ds1 = ds.spatial_mean(inplace = False)`
`ds1.plot()`
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

No branches or pull requests

1 participant