Skip to content

Lookup table in xarray? #6079

Discussion options

You must be logged in to vote

Michael Delgado on stackoverflow came through:

You're looking for the advanced indexing with DataArrays feature of xarray.

You can provide a DataArray as a keyword argument to DataArray.sel or Dataset.sel - this will reshape the indexed array along the dimensions of the indexing array, based on the values of the indexing array. I think this is exactly what you're looking for in a "lookup table".

In your case:

lookup.sel(mukey=raster.mukey)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by openSourcerer9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant