question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow basic xarray commands to be applied to whole PredictionEnsemble object

See original GitHub issue

I think it would be extremely useful to be able to call something like ReferenceEnsemble.sel(time=slice(1980, 2000)) and have it apply to every product (e.g., reconstruction, data, uninitialized run).

Some commands I’d like to implement:

  • sel()
  • isel()
  • squeeze()
  • groupyby()
  • rolling()
  • resample()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aaronspringcommented, May 10, 2019

I had strong objections about introducing such things after two weeks.

0reactions
bradyrxcommented, May 14, 2019

@ahuang11 – thanks for the clarifications. I figured there were alleviations for all points but wanted to see what you had to say. I think accessor is the way to go, and maybe that’s the major focus for the v2 rollout that you and I can focus on. I am particularly happy to hear we can rewrite as cp = ClimPred(ds) for instance.

Yes, v2 sounds like a good target. I suppose I want to get this right ahead of time so it won’t be like a Python 2 to 3 transition if this package gets popular 😛

I agree 100%. This forced me to learn python classes anyhow so I’m not mad. Let’s put a pin in this for now and pick it up in a conference call following v1’s completion. For now, we can have the classes access our updated functions (which shouldn’t require change) and then will do a rewrite “early on” to switch to accessors.

For xr commands like .groupby(‘time.year’).mean(‘time’) or coarsen() I dont see any differences between perfect-model and hindcast type.

Agreed. My comment was more about comparisons and so on. But we can alleviate that by forcing a ds.type attribute on intiialization.

Good conversation! Excited to dig into this. Appropriately implementing this will put the package in the place I really want to see it… with smart easy-to-use objects and methods.

Read more comments on GitHub >

github_iconTop Results From Across the Web

xarray.DataArray
Coerces wrapped data and coordinates into numpy arrays, returning a DataArray. assign_attrs (*args, **kwargs). Assign new attrs to this object.
Read more >
xarray.apply_ufunc
Apply a vectorized function for unlabeled arrays on xarray objects. The function will be mapped over the data variable(s) of the input arguments...
Read more >
xarray.Dataset
Assign new data variables to a Dataset, returning a new object with all the original variables in ... Apply a function to each...
Read more >
Applying unvectorized functions with apply_ufunc - Xarray
Apply a vectorized function for unlabeled arrays on xarray objects. The function will be mapped over the data variable(s) of the input arguments...
Read more >
Data Structures - Xarray
xarray.DataArray is xarray's implementation of a labeled, multi-dimensional array. It has several key properties: ... Xarray uses dims and coords to enable its ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found