ldcpy icon indicating copy to clipboard operation
ldcpy copied to clipboard

Feature Request: Decouple computational tasks from plotting tasks

Open andersy005 opened this issue 3 years ago • 1 comments

Currently, most of the plotting routines involve doing some computation internally before plotting the results. This approach seems to work fine when dealing with small datasets. However, it becomes a bottleneck when working with large datasets because in some cases we have to recompute the same results to visualize a different slice of the data. Also, the coupling between plotting and computation prevents us from taking full advantage of dask' lazy evaluation philosophy.

Would it be useful to decouple the plotting tasks from the computational tasks? In other words, can we

  • manage all the computational tasks in standalone objects such as the ones found in metrics.py
  • Rewrite metrics objects so as to behave like xarray objects which can be extended via accessors: https://xarray.pydata.org/en/stable/internals.html#extending-xarray. With this approach, we would have something along these lines:
metrics_object.ldcpy.plot(......)

instead of

ldcpy.plot(col_ds, "TS", sets=["orig"], metric="mean", plot_type="spatial")

Right now I don't have all the details for this proposal ironed out, but as I work on #180, I am going to try to put together a minimal example that shows how this would work, and I will post an update here

andersy005 avatar Oct 16 '20 19:10 andersy005