diff --git a/dev-environment.yml b/dev-environment.yml index 1af2e11b..cc250f91 100644 --- a/dev-environment.yml +++ b/dev-environment.yml @@ -40,7 +40,10 @@ dependencies: # - richdem - pip: - - noisyopt - scikit-gstat>=1.0.11 - -e ./ + + # Development-specific + - noisyopt + # - git+https://github.com/GlacioHack/GeoUtils.git diff --git a/environment.yml b/environment.yml index 4d3f90ec..377bec35 100644 --- a/environment.yml +++ b/environment.yml @@ -22,7 +22,6 @@ dependencies: - pip - pip: - - noisyopt - scikit-gstat>=1.0.11 diff --git a/xdem/coreg/affine.py b/xdem/coreg/affine.py index e88a538c..d77cdc95 100644 --- a/xdem/coreg/affine.py +++ b/xdem/coreg/affine.py @@ -19,7 +19,6 @@ import scipy.ndimage import scipy.optimize from geoutils.raster import RasterType, get_array_and_mask -from noisyopt import minimizeCompass from tqdm import trange from xdem._typing import NDArrayf @@ -41,6 +40,13 @@ except ImportError: _HAS_P3D = False +try: + from noisyopt import minimizeCompass + + _has_noisyopt = True +except ImportError: + _has_noisyopt = False + ###################################### # Generic functions for affine methods ###################################### @@ -950,6 +956,9 @@ def _fit_pts_func( """ + if not _has_noisyopt: + raise ValueError("Optional dependency needed. Install 'noisyopt'") + # downsampling if downsampling != None if self.downsampling and len(ref_dem) > self.downsampling: ref_dem = ref_dem.sample(frac=self.downsampling / len(ref_dem), random_state=42).copy()