Hydrocron is an API that repackages hydrology datasets from the Surface Water and Ocean Topography (SWOT) satellite into formats that make time-series analysis easier, including GeoJSON and CSV. To use Hydrocron, see the official documentation with examples and tutorials here: https://podaac.github.io/hydrocron/intro.html
The following sections of this readme describe how to install and run a development version of Hydrocron locally on your own computer. This is not recommended if you just want to access SWOT data through Hydrocron. To access data, see the documentation linked above.
To contribute to the development of Hydrocron, see the contributing guidelines and browse the open issues.
NOTE: the following instructions for installing and running a local version of Hydrocron are out of date, and may result in a broken install. We are aware of the issue and working on restoring local development functionality. Please open a new issue or ask a question on the PO.DAAC forum if you need to run a local installation.
Python 3.10+
- Build or pull the hydrocron docker image
- Run docker compose to launch dynamodb local and hydrocron local
- Load test data into dynamodb local
- Execute sample requests
Build the docker container:
docker build . -f docker/Dockerfile -t hydrocron:latest
Pull a pre-built image from https://github.com/podaac/hydrocron/pkgs/container/hydrocron:
docker pull ghcr.io/podaac/hydrocron:latest
Launch dynamodb local on port 8000 and hyrdrocron on port 9000
docker-compose up
If you have not setup a python environment yet, use poetry to first initialize the virtual environment.
poetry install
This will load the data in test/data
into the local dynamo db instance.
python tests/load_data_local.py
NOTE - By default data will be removed when the container is stopped. There are some commented lines in docker-compose.yml
that can be used to allow the data to persist across container restarts if desired.
The docker container is running a lambda container image. By posting data to port 9000, the lambda handler will be invoked and will return results from the loaded test data. For example:
curl --location 'http://localhost:9000/2015-03-31/functions/function/invocations' \
--header 'Content-Type: application/json' \
--data '{
"body":{
"feature": "Reach",
"reach_id": "71224100223",
"start_time": "2022-08-04T00:00:00+00:00",
"end_time": "2022-08-23T00:00:00+00:00",
"output": "csv",
"fields": "feature_id,time_str,wse"
}
}'
Instructions for loading the database with data from CMR instead of the single test granule, are described in hydrocron_db/LOAD_DATA_README.md