html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/3763#issuecomment-583783815,https://api.github.com/repos/pydata/xarray/issues/3763,583783815,MDEyOklzc3VlQ29tbWVudDU4Mzc4MzgxNQ==,6213168,2020-02-08T22:39:54Z,2020-02-08T22:39:54Z,MEMBER,"Hi Scott,
I can't think of a generic situation where text labels have a numerical
weight that is hardcoded to their position on the alphabet, e.g. mean(""A"",
""C"") = ""B"".
What one typically does is map the labels (any string) to their (arbitrary)
weights, interpolate the weights, and then do a nearest-neighbour
interpolation (or floor or ceil, depending on the preference) back to the
label. Which is what you described but with the special caveat that your
weights are the ASCII codes for your labels.
On Sat, 8 Feb 2020 at 20:43, scottcanoe wrote:
> I'd like to suggest an improvement to enable a repeat-based interpolation
> mechanism for non-numerical data. In my use case, I have time series data
> (dim='t'), where each timepoint is associated with a measured variable
> (e.g., fluorescence) as well as a label indicating the stimulus being
> presented (e.g., ""A""). However, if and when I need to upsample my data, the
> string-valued stimulus information is lost, and its imperative that the
> stimulus information is still present when working on the resampled data.
>
> My solution to this problem has been to map the labels to integers, use
> nearest-neighbor interpolation on the integer-valued representation, and
> finally map the integers back to labels. (I'm willing to bet there's a name
> for this technique, but I wasn't able to find it by googling around for it.)
>
> I'm new to xarray, but so far as I can tell this functionality is not
> provided. More specifically, calling DataArray.interp on a string-valued
> array results in a type error ( a numeric type array. Given ).
>
> Finally, I'd like to applaud you for your work on xarray. I only wish I
> had found it sooner!
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
>
> .
>
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,562075354