nctoolkit icon indicating copy to clipboard operation
nctoolkit copied to clipboard

Add inplace arg for dataset methods

Open robertjwilson opened this issue 2 years ago • 0 comments

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()`

robertjwilson avatar Aug 24 '23 16:08 robertjwilson