Skip to content
Snippets Groups Projects
build.sh 2.06 KiB
Newer Older
#!/usr/bin/env bash

set -xeuo pipefail

Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Get the base directory of the script
basedir=$(dirname "$(readlink -f "$0")")

Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed

Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Ensure conda is updated to a version that supports the --no-capture-output option
# conda install -y -n base -c conda-forge "conda>=4.13.0"
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
echo installing ich environment...
conda env create --name ich-env -f ${basedir}/environments/ich-env.yml

# Install the maap.py environment
echo installing maap-py...
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
source activate ich-env
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
git clone --single-branch --branch v4.1.0 https://github.com/MAAP-Project/maap-py.git
cd maap-py
pip install -e .
echo installed maap-py package!

Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Install essential packages in the base environment
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# conda install -y -n base -c conda-forge gdal
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# conda install -y gdal libgdal
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Install Python packages using pip
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# pip install pandas scikit-image empatches scikit-learn scipy numpy matplotlib tqdm futures
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Create a new conda environment for your project (uncomment if needed)
# conda create -y -n ich gdal matplotlib scipy scikit-image tqdm pandas
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Install dependencies from lock file for speed and reproducibility (uncomment if needed)
# conda-lock install -n ich "${basedir}/environment/conda-lock.yml"
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Install additional packages that can't be specified in the lock file (uncomment if needed)
# conda env update -n ich --file "${basedir}/environments/environment-maappy.yml"
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Install the current project in editable mode (uncomment if needed)
# conda run --no-capture-output -n ich PIP_REQUIRE_VENV=0 python -m pip install -e "${basedir}"
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# Verify the GDAL installation and other package availability
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
conda run --no-capture-output -n ich-env python -c '
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
try:
    from osgeo import gdal
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
    import warnings
    import argparse
    import os
    import sys
    # from skimage.util.shape import view_as_blocks
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
    from mpl_toolkits.axes_grid1 import make_axes_locatable
    from scipy.interpolate import griddata
    from tqdm import tqdm
    from concurrent.futures import ProcessPoolExecutor, as_completed
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
    print("All modules imported successfully.")
except ImportError as e:
    print(f"Import error: {e}")
    sys.exit(1)
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
# '