Code Monkey home page Code Monkey logo

Comments (5)

welcome avatar welcome commented on September 24, 2024

Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!

from xarray.

dcherian avatar dcherian commented on September 24, 2024

IIUC we call this reindex: https://docs.xarray.dev/en/stable/generated/xarray.Dataset.reindex.html

Do you think the docs for sel can be improved to point this out?

from xarray.

asford avatar asford commented on September 24, 2024

reindex is close to the behavior we want, but mandates that the indexer has the same dims as the target.
In this operation, we're indexing along a single dim with a multi-dimensional coord.
So we expect the selection + fill to result in a differently-dimensioned structure.

I've put a gist up at: https://gist.github.com/asford/b10a9f62b3657be7a122b3411e90ba2a

I may not be invoking this correctly, happy to further guidance.

from xarray.

asford avatar asford commented on September 24, 2024

Clarified in description, perhaps an adaptation of reindex rather than sel?
The naïve dat.reindex(letter=query.stack(letter=query.dims)) breaks because reindex ends up replacing the coord index (which we want to preserve) with the indexing values.

from xarray.

benbovy avatar benbovy commented on September 24, 2024

perhaps an adaptation of reindex rather than sel?

I think this would make more sense indeed. Similarly to advanced indexing, advanced reindexing might perhaps be done by passing xarray Variable or DataArray objects as indexer mapping values to .reindex() and checking their dimensions. Not sure about the amount of internal refactoring this would require, though.

from xarray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.