This Python script automates downloading data from CHORDS portals via API. Supports CSV export chords_local_download.py or Pandas DataFrames chords_dataframes.py.
NOTE: Columns are named by their shortname. To see the full sensor name, reference
the associated CHORDS website.
- Python 3.8+
- CHORDS account with API key and download privileges
- Clone/download this repo
- Open terminal in project root
- Create & activate virtual environment
PCmacOS/Linuxpython -m venv .venv .\.venv\Scripts\Activate.ps1python3 -m venv .venv source .venv/bin/activate - Install dependencies
pip install -r requirements.txt - Edit
src/chords_downloader/main.pywith yourPORTAL_NAME(see list of available portals below)INSTRUMENT_IDS(unique ID's from CHORDS portal)USER_EMAILandAPI_KEYSTART/ENDtimestamps
- Run
python src/chords_downloader/main.py
You can execute the script in the IDE or from the CLI with the following command:chords-download
For Windows, set the execution policy by running the following ONCE as administrator:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserCreate and activate the virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Install dependencies:
pip install requests numpy pandas pytestVerify installation:
requests --version
numpy --version
pandas --version
pytest --versionFor macOS/Linux, set up a virtual environment and activate it:
python -m venv .venv
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtVerify installation:
requests --version
numpy --version
pandas --version
pytest --version3D-PAWS|https:\\3d.chordsrt.comBarbados|https:\\3d-barbados.chordsrt.comTrinidad|https:\\3d-trinidad.chordsrt.comDominican-Republic|https:\\3d-dr.icdp.ucar.eduCalibration|https:\\3d-calibration.chordsrt.comFEWSNET|https:\\3d-fewsnet.icdp.ucar.eduKenya|https:\\3d-kenya.chordsrt.comZimbabwe|https:\\3d-zimbabwe.icdp.ucar.eduArgentina|https:\\3d-argentina.icdp.ucar.eduIITM|https:\\3d-iitm.icdp.ucar.eduFiji|http:\\3d-fiji.icdp.ucar.eduBahamas|http:\\3d-bahamas.icdp.ucar.eduMalawi|http:\\3d-malawi.icdp.ucar.eduJamaica|http:\\3d-jamaica.icdp.ucar.eduEthiopia|http:\\3d-ethiopia.icdp.ucar.eduSomalia|http:\\3d-somalia.icdp.ucar.edu
See Windows-specific setup tips here:
https://drive.google.com/file/d/1TsTg8LvilrUqBZpj7nq3RsUV5CsSwjB_/view?usp=drive_link
Run the following to test changes:
pytest -v