Adapts tRIBS hydrolgic modeling data and workflows for Python applications.
-
Install ATCore:
git clone https://github.com/Aquaveo/tethysext-atcore.git cd tethysext-atcore tethys install -d -
Install the PDM dependency manager:
pip install pdm- Change into the
tribs-adapterand runpdm install:
If installing into an environment that has gdal already installed (e.g., conda environment with gdal from conda-forge):
pdm installOtherwise, you can include the optional gdal dependency when installing pdm:
pdm install -G gdalNote
pdm installinstalls the package as an editable package and installs dependencies AND dev dependencies but NOT optional dependencies.
- Set GEOSERVER_CLUSTER_PORTS environment variable.
If using a GeoServer setup different than the tethysplatform/geoserver Docker image, or using the tethysplatform/geoserver with less than 4 nodes, need to set GEOSERVER_CLUSTER_PORTS the port(s) of your GEOSERVER setup:
# Default ports
export GEOSERVER_CLUSTER_PORTS="[8081,8082,8083,8084]"
# Note: No trailing commas
export GEOSERVER_CLUSTER_PORTS="[8080]"- Set the FDB_ROOT_DIR environment variable(s).
Set the FDB_ROOT_DIR environment variable to the root directory where you want the file databases for projects to be stored. Ensure the app has read and write permissions to this directory.
export FDB_ROOT_DIR="/path/to/fdb_root_dir"If you need to specify a different path for the condor worker, set the CONDOR_FDB_ROOT_DIR environment variable. This is usually only necessary for production deployment where condor and the app are running in separate environments.
export CONDOR_FDB_ROOT_DIR="/path/to/condor_fdb_root_dir"- Install only test dependencies
pdm install -G test- Install only lint dependencies
pdm install -G lint- Install all dev dependencies (test & lint)
pdm install -G:all- Add a new dependency:
pdm add <package-name>- Add a new dev dependency:
pdm add -dG test <package-name>
pdm add -dG lint <package-name>- Add a new optional dependeny:
pdm add -G <group-name> <package-name>Important DO NOT REMOVE DEPENDENCIES USING
pdm removeWHEN IN A CONDA ENVIRONMENT. IT WILL ATTEMPT TO REMOVE ALL PACKAGES NOT LISTED AS DEPENDENCIES.
- Download the pyproj transformation grids:
See: https://pyproj4.github.io/pyproj/stable/transformation_grids.html
export PROJ_DOWNLOAD_DIR=$(python -c "import pyproj; print(pyproj.datadir.get_data_dir())")
wget --mirror https://cdn.proj.org/ -P ${PROJ_DOWNLOAD_DIR}The project is configured with several PDM convenience scripts:
# Run linter
pdm run lint
# Run formatter
pdm run format
# Run tests
pdm run test
# Run all checks
pdm run allThis package is configured to use yapf code formatting
- Install lint dependencies:
pdm install -G lint- Run code formatting from the project directory:
yapf --in-place --recursive --verbose .
# Short version
yapf -ir -vv .- Run linter from the project directory:
flake8 .NOTE The configuration for yapf and flake8 is in the
pyproject.toml.
This package is configured to use pytest for testing
- Install test dependencies:
pdm install -G test- Run tests from the project directory:
pytestNOTE The configuration for pytest and coverage is in the
pyproject.toml.