From a66dc5320c1f140c7efe92eb953e9ce828d11c8a Mon Sep 17 00:00:00 2001
From: Narayana Rao Bhogapurapu <narayanarao.bhogapurapu@gmail.com>
Date: Thu, 3 Oct 2024 19:10:52 -0700
Subject: [PATCH] Update build.sh

---
 build.sh | 72 ++++++++++++++++++++++++--------------------------------
 1 file changed, 31 insertions(+), 41 deletions(-)

diff --git a/build.sh b/build.sh
index 0a4223d..7f29c58 100644
--- a/build.sh
+++ b/build.sh
@@ -2,58 +2,48 @@
 
 set -xeuo pipefail
 
+# Get the base directory of the script
 basedir=$(dirname "$(readlink -f "$0")")
 
-# Make sure conda is updated to a version that supports the --no-capture-output option
+# 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"
-conda install -y -n base -c conda-forge gdal
-pip install pandas scikit-image empatches scikit-learn scipy numpy matplotlib tqdm futures
 
-# pip install Pyarrow
-# pip install --upgrade numpy
+# Install essential packages in the base environment
+conda install -y -n base -c conda-forge gdal
 
+# Install Python packages using pip
+pip install pandas scikit-image empatches scikit-learn scipy numpy matplotlib tqdm futures
 
-# Create conda env containing only conda-lock
+# Create a new conda environment for your project (uncomment if needed)
 # conda create -y -n ich gdal matplotlib scipy scikit-image tqdm pandas
 
-# Install dependencies from lock file for speed and reproducibility
+# Install dependencies from lock file for speed and reproducibility (uncomment if needed)
 # conda-lock install -n ich "${basedir}/environment/conda-lock.yml"
 
-# Install maap-py, since it cannot be specified in the lock file
+# 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"
 
+# 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}"
 
-# Fail build if finicky mix of fiona and gdal isn't correct, so that we don't
-# have to wait to execute a DPS job to find out.
-# conda run --no-capture-output -n ich python -c '
-# from osgeo import gdal
-# import warnings
-# import argparse,os,sys,warnings
-
-# import numpy as np, pandas as pd
-# from osgeo import gdal
-# from scipy import interpolate
-# import matplotlib.pyplot as plt
-# from matplotlib import cm
-# from matplotlib.colors import Normalize 
-
-# from scipy.stats import linregress
-# from skimage.util.shape import view_as_blocks
-# from mpl_toolkits.axes_grid1 import make_axes_locatable
-# from scipy.interpolate import griddata
-# from tqdm import tqdm
-# from scipy.interpolate import interpn
-# gdal.UseExceptions()
-# warnings.filterwarnings("ignore")
-# warnings.filterwarnings("error")
-# np.seterr(divide="ignore", invalid="ignore")
-
-
-# # Make sure pip install worked
-# from maap.maap import MAAP
-
-# warnings.filterwarnings("ignore", message=".*initial implementation of Parquet.*")
-
-
-# '
+# Verify the GDAL installation and other package availability
+conda run --no-capture-output -n ich python -c '
+try:
+    from osgeo import gdal
+    import warnings
+    import argparse
+    import os
+    import sys
+    from skimage.util.shape import view_as_blocks
+    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
+    print("All modules imported successfully.")
+except ImportError as e:
+    print(f"Import error: {e}")
+    sys.exit(1)
+'
+
+# Optionally, you can include additional checks or commands below
+# For example, checking for specific versions of packages or running a test script.
-- 
GitLab