xcube-dev / xcube

xcube is a Python package for generating and exploiting data cubes powered by xarray, dask, and zarr.
https://xcube.readthedocs.io/
MIT License
201 stars 20 forks source link

New server `statistics` endpoint #998

Closed forman closed 5 months ago

forman commented 5 months ago

Added new statistics API to xcube server. The service computes basic statistical values and a histogram for given data variable, time stamp, and a GeoJSON geometry. Its endpoint is: /statistics/{datasetId}/{varName}?time={time}. Geometry is passed as request body in form of a GeoJSON geometry object.

To verify:

  1. In xcube project folder, run xcube server with the demo configuration: xcube --loglevel=INFO --traceback serve --traceperf -vvv -c examples/serve/demo/config.yml
  2. Open http://127.0.0.1:8080/openapi.html to verify the API is there
  3. Open http://127.0.0.1:8080/viewer and try the new Statisticstab in the right sidebar.

The current state of https://github.com/xcube-dev/xcube-viewer/pull/357 has been bundled in this PR.

Checklist:

konstntokas commented 5 months ago

Screenshot from 2024-06-04 11-32-05 FYI (not super important): When selecting the range of the histogram, when the upper bound is close to the maximal value, the value disappears at the right edge.

forman commented 5 months ago

When selecting the range of the histogram, when the upper bound is close to the maximal value, the value disappears at the right edge.

Yes, I know. I will fix that, if at all, another time. It requires extra padding to the right if will take away space for the chart.

forman commented 5 months ago

Further, the new functionalities could be added to the docs/source/viewer.rst so the new functionalities regarding statistics are added to the documentation. Maybe we could do that in another PR.

@konstntokas Yes. But we wont do that in the RST. Instead, we'll set up an entirely new and dedicated doc site for the viewer.

forman commented 5 months ago

I will fix that, if at all, another time.

Done!