Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update requirements and python3 instructions #92

Merged
merged 25 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
strategy:
matrix:
python-version: [3.7]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ help:
@echo " createdb: create PostgreSQL database"
@echo " dropdb: drop PostgreSQL database"
@echo " setup: create models and search index"
@echo " setup_data: download core metadata
@echo " setup_data: download core metadata"
@echo " teardown: delete models and search index"
@echo " test: run tests"
@echo " coverage: run code coverage"
Expand Down Expand Up @@ -92,7 +92,7 @@ init:
woudc-data-registry admin init -d $(DATA)

package:
python setup.py sdist bdist_wheel
python3 setup.py sdist bdist_wheel

setup:
woudc-data-registry admin registry setup
Expand All @@ -107,6 +107,6 @@ teardown:
woudc-data-registry admin search teardown

test:
python setup.py test
python3 setup.py test

.PHONY: clean coverage createdb dropdb flake8 help init package setup setup_data teardown test
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ are automatically installed during installation.
python3 -m venv --system-site-packages woudc-data-registry
cd woudc-data-registry
source bin/activate
cd ..

# clone woudc-extcsv and install
git clone https://github.com/woudc/woudc-extcsv.git
cd woudc-extcsv
pip install -r requirements.txt
python setup.py install
python3 setup.py install
cd ..

# clone codebase and install
git clone https://github.com/woudc/woudc-data-registry.git
cd woudc-data-registry
python setup.py build
python setup.py install
python3 setup.py build
python3 setup.py install
# for PostgreSQL backends
pip install -r requirements-pg.txt

Expand All @@ -69,10 +70,6 @@ woudc-data-registry admin registry setup
woudc-data-registry admin search setup

# load core metadata

# fetch WMO country list
mkdir data
curl -o data/wmo-countries.json https://www.wmo.int/cpdb/data/membersandterritories.json
woudc-data-registry admin init -d data/

# cleanups
Expand Down Expand Up @@ -104,35 +101,35 @@ eval "$(_WOUDC_DATA_REGISTRY_COMPLETE=source woudc-data-registry)"
# list all instances of foo (where foo is one of:
# project|dataset|contributor|country|station|instrument|deployment)
woudc-data-registry <foo> list
e.g.
# e.g.
woudc-data-registry contributor list

# show a specific instance of foo with a given registry identifier
woudc-data-registry <foo> show <identifier>
e.g.
# e.g.
woudc-data-registry station show 023
woudc-data-registry instrument show ECC:2Z:4052:002:OzoneSonde

# add a new instance of foo (contributor|country|station|instrument|deployment)
woudc-data-registry <foo> add <options>
e.g.
# e.g.
woudc-data-registry deployment add -s 001 -c MSC:WOUDC
woudc-data-registry contributor add -id foo -n "Contributor name" -c Canada -w IV -u https://example.org -e you@example.org -f foouser -g -75,45

# update an existing instance of foo with a given registry identifier
woudc-data-registry <foo> update -id <identifier> <options>
e.g.
# e.g.
woudc-data-registry station update -n "New station name"
woudc-data-registry deployment update --end-date 'Deployment end date'

# delete an instance of foo with a given registry identifier
woudc-data-registry <foo> delete <identifier>
e.g.
# e.g.
woudc-data-registry deployment delete 018:MSC:WOUDC

# for more information about options on operation (add|update):
woudc-data-registry <foo> <operation> --help
e.g.
# e.g.
woudc-data-registry instrument update --help
```

Expand Down Expand Up @@ -223,18 +220,18 @@ pip install -r requirements-dev.txt
# build local copy of https://woudc.github.io/woudc-data-registry
cd docs
make html
python -m http.server # view on http://localhost:8000/
python3 -m http.server # view on http://localhost:8000/
```

#### Running Tests

```bash
# run tests like this:
cd woudc_data_registry/tests
python test_data_registry.py
python3 test_data_registry.py

# or this:
python setup.py test
python3 setup.py test

# measure code coverage
coverage run --source=woudc_data_registry -m unittest woudc_data_registry.tests.test_data_registry
Expand Down
84 changes: 45 additions & 39 deletions data-registry-ingest.sh
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
# The purpose of this script is to ingest all of the operational WOUDC Archive datasets and rename the generated ingest reports to avoid overwriting
# Inital setup and table initialization of WOUDC Data Registry is required to run this script
# Replace YYYY-MM-DD with today's date before proceeding

woudc-data-registry data ingest /path/to/TotalOzone_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/TotalOzone_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/TotalOzone_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/TotalOzone_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/TotalOzone_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/TotalOzone_1.0_1_run_report

woudc-data-registry data ingest /path/to/TotalOzone_2.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/TotalOzone_2.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/TotalOzone_2.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/TotalOzone_2.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/TotalOzone_2.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/TotalOzone_2.0_1_run_report

woudc-data-registry data ingest /path/to/Broad-band_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/Broad-band_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/Broad-band_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/Broad-band_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/Broad-band_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/Broad-band_1.0_1_run_report

woudc-data-registry data ingest /path/to/Broad-band_2.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/Broad-band_2.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/Broad-band_2.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/Broad-band_2.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/Broad-band_2.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/Broad-band_2.0_1_run_report

woudc-data-registry data ingest /path/to/Lidar_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/Lidar_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/Lidar_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/Lidar_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/Lidar_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/Lidar_1.0_1_run_report

woudc-data-registry data ingest /path/to/Multi-band_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/Multi-band_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/Multi-band_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/Multi-band_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/Multi-band_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/Multi-band_1.0_1_run_report

woudc-data-registry data ingest /path/to/RocketSonde_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/RocketSonde_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/RocketSonde_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/RocketSonde_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/RocketSonde_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/RocketSonde_1.0_1_run_report

woudc-data-registry data ingest /path/to/OzoneSonde_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/OzoneSonde_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/OzoneSonde_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/OzoneSonde_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/OzoneSonde_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/OzoneSonde_1.0_1_run_report

woudc-data-registry data ingest /path/to/TotalOzoneObs_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/TotalOzoneObs_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/TotalOzoneObs_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/TotalOzoneObs_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/TotalOzoneObs_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/TotalOzoneObs_1.0_1_run_report

woudc-data-registry data ingest /path/to/Spectral_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/Spectral_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/Spectral_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/Spectral_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/Spectral_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/Spectral_1.0_1_run_report

woudc-data-registry data ingest /path/to/Spectral_2.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/Spectral_2.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/Spectral_2.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/Spectral_2.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/Spectral_2.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/Spectral_2.0_1_run_report

woudc-data-registry data ingest /path/to/UmkehrN14_1.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/UmkehrN14_1.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/UmkehrN14_1.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/UmkehrN14_1.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/UmkehrN14_1.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/UmkehrN14_1.0_1_run_report

woudc-data-registry data ingest /path/to/UmkehrN14_2.0_1 -y -r /path/to/operator/report
mv /path/to/operator/report/operator-report.csv /path/to/operator/report/UmkehrN14_2.0_1.csv
mv /path/to/operator/report/run_report /path/to/operator/report/UmkehrN14_2.0_1_run_report
woudc-data-registry data ingest /apps/data/web/woudc-archive/Archive-NewFormat/UmkehrN14_2.0_1 -y -r /apps/data/wdr-ingest/YYYY-MM-DD
mv /apps/data/wdr-ingest/YYYY-MM-DD/operator-report.csv /apps/data/wdr-ingest/YYYY-MM-DD/UmkehrN14_2.0_1.csv
mv /apps/data/wdr-ingest/YYYY-MM-DD/run_report /apps/data/wdr-ingest/YYYY-MM-DD/UmkehrN14_2.0_1_run_report

## Table generation process into registry for totalozone, uv-index and ozonesonde
woudc-data-registry product totalozone generate -y /apps/data/web/woudc-archive/Archive-NewFormat/
woudc-data-registry product uv-index generate -y /apps/data/web/woudc-archive/Archive-NewFormat/
woudc-data-registry product ozonesonde generate -y /apps/data/web/woudc-archive/Archive-NewFormat/
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Source: woudc-data-registry
Section: python
Priority: optional
Maintainer: WOUDC <ec.woudc.ec@canada.ca>
Build-Depends: debhelper (>= 9), python3, python3-setuptools
Build-Depends: debhelper (>= 9), python3 (>= 3.8.10), python3-setuptools
Standards-Version: 3.9.5
X-Python-Version: >= 3.4
X-Python-Version: >= 3.8
Vcs-Git: https://github.com/woudc/woudc-data-registry.git

Package: woudc-data-registry
Architecture: all
Depends: elasticsearch (>=5.5.0), postgresql, python3-click, python-elasticsearch, python3-psycopg2, python3-requests, python3-sqlalchemy, woudc-extcsv
Depends: elasticsearch (>= 8.12.0), postgresql, python3-click, python3-elasticsearch, python3-psycopg2, python3-requests, python3-sqlalchemy, woudc-extcsv
Homepage: https://woudc.org
Description: WOUDC Data Registry is a platform that manages Ozone and
Ultraviolet Radiation data in support of the World Ozone and Ultraviolet
Expand Down
19 changes: 11 additions & 8 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,31 @@ export WDR_DB_USERNAME=postgres
export WDR_DB_PASSWORD=postgres
export PGPASSWORD=$WDR_DB_PASSWORD

# SQLite
# alternative SQLite
export WDR_DB_TYPE=sqlite
export WDR_DB_NAME=test.db

## search index configuration
export WDR_SEARCH_TYPE=elasticsearch
export WDR_SEARCH_INDEX_BASENAME=woudc-data-registry
export WDR_SEARCH_URL=http://localhost:9200/
export WDR_SEARCH_USERNAME=elasticsearch
export WDR_SEARCH_PASSWORD=elasticsearch
export WDR_SEARCH_INDEX_BASENAME=woudc_data_registry
export WDR_SEARCH_USERNAME=elastic
export WDR_SEARCH_PASSWORD=<secret>
export WDR_SEARCH_URL=https://${WDR_SEARCH_USERNAME}:${WDR_SEARCH_PASSWORD}@woudc-geo-dev3.cmc.ec.gc.ca/elasticsearch/
# export WDR_SEARCH_URL=http://username:password@localhost:9200/

## waf configuration
export WDR_WAF_BASEURL=https://woudc.org/archive/
export WDR_WAF_BASEDIR=/tmp

# table configurations
# table configurations; optional: WDR_TABLE_SCHEMA, WDR_TABLE_CONFIG
export WDR_TABLE_SCHEMA=/path/to/data/tables-schema.json
export WDR_TABLE_CONFIG=/path/to/data/migrate/tables-backfilling.yml
export WDR_ERROR_CONFIG=/path/to/data/errors.csv
export WDR_ALIAS_CONFIG=/path/to/data/aliases.yml
export WDR_EXTRA_CONFIG=/path/to/data/extra-options.yml

# UV Index formula table configuration
export WDR_UV_INDEX_FORMULA_LOOKUP=/path/to/data/uv-index-formula-lookup.csv

# enable shell autocompletion
eval "$(_WOUDC_DATA_REGISTRY_COMPLETE=source woudc-data-registry)"
# enable shell autocompletion - optional
# eval "$(_WOUDC_DATA_REGISTRY_COMPLETE=source woudc-data-registry)"
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Instructions
| pip install -r requirements.txt # Core dependencies
| pip install -r requirements-pg.txt # For PostgreSQL backends
|
| python setup.py build
| python setup.py install
| python3 setup.py build
| python3 setup.py install

* Set up the project::
| . /path/to/environment/config.env # Set environment variables
Expand Down
Loading
Loading