diff --git a/README.md b/README.md index b740428..d7af653 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ git clone https://github.com/insarlab/PySolid.git # option 1: use conda to install dependencies into an existing, activated environment conda install -c conda-forge fortran-compiler --file PySolid/requirements.txt -# option 2: use conda to create a new environment named "pysolid" -conda env create -f PySolid/environment.yml +# option 2: use conda to install dependencies into a new environment, e.g. named "pysolid" +conda create --name pysolid fortran-compiler --file PySolid/requirements.txt conda activate pysolid # option 3: have a Fortran compiler already installed and use pip to install the rest dependencies diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 8f069af..0000000 --- a/environment.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: pysolid -channels: - - conda-forge - - defaults -dependencies: - - python>=3.8 - # for running - - numpy - - scipy - - matplotlib - - scikit-image - # for packaging and installation - - fortran-compiler # Fortran compiler across platforms through conda-forge channel - - pip - - setuptools - - setuptools_scm - - wheel diff --git a/pyproject.toml b/pyproject.toml index 7c153c9..ba9fb9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,6 @@ dependencies = [ "numpy", "scipy", "matplotlib", - "scikit-image", ] dynamic = ["version"] diff --git a/requirements.txt b/requirements.txt index 2a32a24..6ae98e6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ numpy scipy matplotlib -scikit-image # for packaging and installation #fortran-compiler # Fortran compiler across platforms through conda-forge channel pip diff --git a/setup.py b/setup.py index e6d254e..20ed3f4 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,6 @@ def readme(): "numpy", "scipy", "matplotlib", - "scikit-image", ], # package discovery diff --git a/src/pysolid/grid.py b/src/pysolid/grid.py index b81133d..39d3a2e 100644 --- a/src/pysolid/grid.py +++ b/src/pysolid/grid.py @@ -14,7 +14,7 @@ import os import numpy as np -from skimage.transform import resize +from scipy import ndimage ################################## Earth tides - grid mode ################################### @@ -79,13 +79,16 @@ def calc_solid_earth_tides_grid(dt_obj, atr, step_size=1e3, display=False, verbo lon0, lon_step, width) # resample to the input size + # via scipy.ndimage.zoom or skimage.transform.resize if num_step > 1: + in_shape = tide_e.shape out_shape = (int(atr['LENGTH']), int(atr['WIDTH'])) vprint('PYSOLID: resize data to the shape of {} using order-1 spline interpolation'.format(out_shape)) - kwargs = dict(order=1, mode='edge', anti_aliasing=True, preserve_range=True) - tide_e = resize(tide_e, out_shape, **kwargs) - tide_n = resize(tide_n, out_shape, **kwargs) - tide_u = resize(tide_u, out_shape, **kwargs) + + enu = np.stack([tide_e, tide_n, tide_u]) + zoom_factors = [1, *np.divide(out_shape, in_shape)] + kwargs = dict(order=1, mode="nearest", grid_mode=True) + tide_e, tide_n, tide_u = ndimage.zoom(enu, zoom_factors, **kwargs) # plot if display: