OpenDrift / trajan

Trajectory analysis package for simulated and observed trajectories
https://opendrift.github.io/trajan/
GNU General Public License v2.0
11 stars 5 forks source link

allow different kinds of plots #87

Closed jerabaul29 closed 3 months ago

jerabaul29 commented 6 months ago

@gauteh one thing I was wondering: as we add more kinds of data in addition to trajectory (e.g., spectra, temperature, salinity, etc), could / should we also provide dedicated plotting methods for these, and if so how?

For example, when wave data / spectra are produced, it is quite convenient to plot the spectrograms and / or Tp and Hs. Do you think we could / should implement ways to plot these easily? Tp and Hs are simple as they are just curves, but for example for spectrograms I have functions that include a bit of logics that would be nice to "factorize".

If this makes sense / is of interest, we can discuss how to make this work best :) .

gauteh commented 6 months ago

Hi, yes, I think we should be pragmatic. Waves and trajectories often co-exist. I assume this doesn't work with the standard xarray package? Maybe that is even where it would fit better, but we can have it in trajan until it goes in there. For xarray it would be:

ds.hm0.plot()
ds.sel(time=t0).E.plot()
jerabaul29 commented 3 months ago

Sorry for the late response on my end :) .

See the PR #94 for what I meant, i.e. plots for more "complex" things to plot, i.e. a spectrum for a file containing several buoys for example. I think this is quite convenient (at least, this is the kind of things I use all the time).

I wonder (but this can be a later refactoring if we go for it) if it could be useful to start grouping plot functionalities if we start extending trajan (for now we have GPS, which is anyways going to be needed for drifters, and waves; but having just these 2 is a bit arbitrary, maybe we would want more than just waves in addition to GPS in the future?)?

I.e. would it make sense with something that would look like:

ds.traj.plot()
ds.waves.plot_spectra()

Maybe this is a bad idea though: just brainstorming :) .

jerabaul29 commented 3 months ago

Reading your comment on the PR this confirms you think this is a good idea too :) . Then closing this issue, I will continue on the PR :) .