issue_comments: 577436046
This data as json
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/3709#issuecomment-577436046 | https://api.github.com/repos/pydata/xarray/issues/3709 | 577436046 | MDEyOklzc3VlQ29tbWVudDU3NzQzNjA0Ng== | 1550771 | 2020-01-22T23:33:17Z | 2020-01-23T13:21:37Z | NONE | I think the real power in this proposal is in the ability to chain operations on interactive components using an API that will be familiar to xarray users. We have a similar concept in HoloViews which allows you to build complex processing and visualization pipelines. I'll work through some examples in HoloViz ecosystem to show what is possible there and maybe provide some ideas or approaches that might work here. Let's work with a relatively contrived but simple example and load the air_temperature sample dataset:
In this example you explode your dataset into individual chunks for each longitude, then apply a reduction along the latitude and finally cast the output to a Curve giving us a Curve of the mean temperature at each longitude:
Now we decide we want to resample the data too, so we import the resample operation and apply it to our existing pipeline:
But really we don't just want to compute the mean we want to pick the reduce function and we also want to be able to set the resampling frequency and pick a color. By combining Panel and HoloViews you can inject widget parameters at every stage: ```python function = pn.widgets.Select(name='Function', options={'mean': np.mean, 'min': np.min, 'max': np.max}) color = pn.widgets.ColorPicker(name='Color', value='#000000') rule = pn.widgets.TextInput(name='Rule', value='7d') obj = (ds.groupby('lon', dynamic=True) .apply.reduce(lat=function) .apply(hv.Curve) .apply.opts(width=600, color=color, framewise=True) .apply(resample, rule=rule) ) hv_pane = pn.pane.HoloViews(obj) pn.Row( hv_pane[0], pn.Column(*hv_pane[1][0], function, color, rule) ) ``` So this shows pretty clearly how useful this kind of chaining/pipeline building can be, especially when built on top of an API like xarray which allows for very powerful data manipulation. I don't have enough of a perspective to say how feasible it would be to implement something like this that comprehensively wraps xarray's API but I'd certainly love to see it. Whether it is built on Panel (which I am of course partial to as the author) or ipywidgets or even supporting both. My main comments therefore are about the API, it is not clear to me based on what you have said so far which parts of the API are actually interactive, e.g. in this case:
Is only
but expanded to include support for discrete lists of items, explicit widgets, and so on. Hope that's at all helpful! I think the idea is really neat and it could be very powerful indeed. |
{ "total_count": 4, "+1": 4, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
552500673 |