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

Subset by rows and pruning examples in docstring #338

Merged
merged 4 commits into from
Dec 10, 2023

Conversation

milancurcic
Copy link
Member

@milancurcic milancurcic commented Dec 8, 2023

Not a feature but examples in docstring.

Closes #196.
Closes #305.

After looking into how to do this more easily (see #305 for the problem), I found that it doesn't warrant new functionality, e.g. rows keyword parameter. We merely need to slice the id array by the desired rows.

@milancurcic milancurcic added the documentation Improvements or additions to documentation label Dec 8, 2023
@milancurcic milancurcic requested a review from selipot December 8, 2023 15:27
@milancurcic milancurcic self-assigned this Dec 8, 2023
@milancurcic milancurcic changed the title Subset by rows example in docstring Subset by rows and pruning examples in docstring Dec 8, 2023
@philippemiron
Copy link
Contributor

That's clean! And close 2 issues with a docstring might be a record. haha

@milancurcic
Copy link
Member Author

Well, it's really thanks to your versatile design of subset..

@milancurcic
Copy link
Member Author

I found a better way but we have to allow specifying dimensions in criteria. With the most recent commit, you can do:

subset(ds, {"traj": rows})

because the dimension data are conveniently the row indices.

@philippemiron
Copy link
Contributor

philippemiron commented Dec 8, 2023

That's nice!

subset(ds, {"obs": (0, n-1)})

is quick to get n obs.

@milancurcic milancurcic added the enhancement New feature or request label Dec 8, 2023
@selipot selipot merged commit 2f453e9 into Cloud-Drift:main Dec 10, 2023
15 checks passed
philippemiron pushed a commit to philippemiron/clouddrift that referenced this pull request Dec 10, 2023
* Subset by rows

* Add doctring example for pruning a dataset

* Allow querying dimensions in subset

* example edit

---------

Co-authored-by: Shane Elipot <selipot@miami.edu>
selipot added a commit that referenced this pull request Dec 16, 2023
* sofar dataset

* add test

* Subset by rows and pruning examples in docstring (#338)

* Subset by rows

* Add doctring example for pruning a dataset

* Allow querying dimensions in subset

* example edit

---------

Co-authored-by: Shane Elipot <selipot@miami.edu>

* Fix #226 (#339)

Co-authored-by: Philippe Miron <philippe.miron@dtn.com>

* fix deprecation warnings in tests (#340)

* fix deprecation warnings

* remove complex warning

* ds.sizes instead of ds.dims which will eventually return only tuple of dimensions

* log zero in sphere

* wrong exception

---------

Co-authored-by: Philippe Miron <philippe.miron@dtn.com>

* Ellipse functions (#334)

* ellipse functions

* remove comment

* lint

* typo in tests

* extra return carriage

* Update clouddrift/signal.py

Co-authored-by: Milan Curcic <caomaco@gmail.com>

* better tests

* corrected tests

* version bump

* new tests

* errstate ignore

---------

Co-authored-by: Milan Curcic <caomaco@gmail.com>

* Update datasets.py

* change name

---------

Co-authored-by: Philippe Miron <philippe.miron@dtn.com>
Co-authored-by: Milan Curcic <caomaco@gmail.com>
Co-authored-by: Shane Elipot <selipot@miami.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

subset by row/segment? prune taking an xarray Dataset as an input?
3 participants