Skip to content

Does scipp support dependent/conditional indices across dimensions? #3165

Discussion options

You must be logged in to vote

There is some support for this in form of "multi-dimensional coordinates", albeit potentially too limited for some applications.

The main limitation is that the array sizes have to be regular, i.e. rectangular. Here is an example:

import scipp as sc

temperature = sc.linspace('T', 1, 4, num=3, unit='K')
pressure = sc.array(
    dims=('T', 'p'), unit='MPa', values=[[1, 2, 3], [1.5, 2.5, 3.5], [2, 4, 6]]
)
da = sc.DataArray(temperature * pressure, coords={'T': temperature, 'p': pressure})
da.plot()

Note some more limitations:

  • Label-based indexing with the dependent coord will not work (since the result-shape would not be rectangular).
  • You cannot have X depend on Y and Y depend on X (well,…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by fkiraly
Comment options

You must be logged in to vote
4 replies
@SimonHeybrock
Comment options

@fkiraly
Comment options

@fkiraly
Comment options

@SimonHeybrock
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants