ec-jrc/Thalassa

Time series of model results at any given points

saeed-moghimi-noaa opened this issue · 6 comments

Time series of model results at any given points

@wzhengui @pmav99

  • @pmav99 to share notebook with @wzhengui
  • Use from Jupyter to work on api.py
  • Fix point (lon and lat) in text box
  • Edit in ui part (text box to get the lon and lat
  • plot timeserie underneath

Next step:

  • Dynamic point from mouse click to plot timeseries

I pushed v0.2 to master.

@wzhengui a couple of remarks:

  • There is a link to the sample file I have been using while developing in the README.
  • The readme has installation instructions. Practically speaking you only need Python + Proj < 8. The rest are python dependencies which you should be able to install from PyPI.
  • I think I remember that in the demo you showed us earlier you were using python 3.7. We've only tested thalassa with python 3.8 and 3.9. In case you can't use a newer version, feel free to make any changes you need (tip: start by updating pyproject.toml and running poetry update)

I had a look and I think that one way we could retrieve the coordinates of the point where the user clicked inside the figure would be to use Annotators:

import holoviews as hv
import numpy as np
import panel as pn

hv.extension('bokeh')

points = hv.Points(
    [
        (0.0, 0.0), 
        (200000.0, 2000000.0)
    ]
)
.opts(size=10, min_height=500)

annotator = hv.annotate.instance()

layout = annotator(
    hv.element.tiles.Wikipedia() * points,
    annotations=['Label'],
    name="Point Annotations"
)
layout

If I understand this correctly, the annotator() object enables an additional button (the fourth one in the image below) to the toolbox of the figure which allows us to create/move/delete/select/deselect points. The exact semantics are explained in the docs.

image

After some points have been created, we can retrieve the coordinates of the created/selected points with:

annotator.annotated.dframe()
annotator.selected.dframe()

There is one caveat though. Annotators are supported for geoviews objects too (docs), but they are currently broken: holoviz/geoviews#526

This is a problem for us since our tests showed that mixing holoviews and geoviews objects results in performance penalties.

@wzhengui, please update this issue if you completed this task, and when it's in Thalassa main, thank you.