[Git][debian-gis-team/pysolid][upstream] New upstream version 0.3.1

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Mon Aug 21 21:36:27 BST 2023



Antonio Valentino pushed to branch upstream at Debian GIS Project / pysolid


Commits:
bf234de6 by Antonio Valentino at 2023-08-21T20:23:29+00:00
New upstream version 0.3.1
- - - - -


15 changed files:

- .circleci/config.yml
- .github/workflows/build-and-publish-to-pypi.yml
- README.md
- + docs/images/set_grid.png
- + docs/images/set_point_psd.png
- docs/logo.pptx → docs/images/set_point_ts.png
- + docs/requirements.txt
- − environment.yml
- pyproject.toml
- requirements.txt
- setup.py
- src/pysolid/grid.py
- src/pysolid/point.py
- src/pysolid/solid.for
- + tests/requirements.txt


Changes:

=====================================
.circleci/config.yml
=====================================
@@ -25,43 +25,40 @@ jobs:
     docker:
       - image: ubuntu:bionic
         environment:
-          CONDA_PREFIX: /root/tools/miniconda3
+          CONDA_PREFIX: /root/tools/mambaforge
+          PYSOLID_HOME: /root/tools/PySolid
         user: root
     working_directory: /root/tools/PySolid
     # Checkout the code as the first step. This is a dedicated CircleCI step.
     steps:
       - checkout
       - run:
-          name: Setting Environment with Miniconda
+          name: Setting Environment with Mambaforge
           command: |
             apt update
             apt-get update --yes && apt-get upgrade --yes
             apt-get install --yes wget git
-            # download and install miniconda3
+            # download and install mambaforge
             mkdir -p ${HOME}/tools
             cd ${HOME}/tools
-            wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
-            bash Miniconda3-latest-Linux-x86_64.sh -b -p ${HOME}/tools/miniconda3
-            ${HOME}/tools/miniconda3/bin/conda init bash
-            ${HOME}/tools/miniconda3/bin/conda config --add channels conda-forge
-            ${HOME}/tools/miniconda3/bin/conda install -c conda-forge --yes mamba
+            wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
+            bash Mambaforge-Linux-x86_64.sh -b -p ${HOME}/tools/mambaforge
+            ${HOME}/tools/mambaforge/bin/mamba init bash
+            # modify/export env var PATH to BASH_ENV to be shared across run steps
+            echo 'export PATH=${CONDA_PREFIX}/bin:${PATH}' >> ${BASH_ENV}
+
       - run:
           name: Installing PySolid
           no_output_timeout: 10m
           command: |
             export PYTHONUNBUFFERED=1
-            # setup environment variable
-            export PATH=${CONDA_PREFIX}/bin:${PATH}
-            # install dependencies
-            source activate root
-            mamba install --verbose --yes  fortran-compiler --file ${HOME}/tools/PySolid/requirements.txt
-            python -m pip install ${HOME}/tools/PySolid
+            # install dependencies and source code
+            mamba install --verbose --yes  fortran-compiler --file ${PYSOLID_HOME}/requirements.txt --file ${PYSOLID_HOME}/tests/requirements.txt
+            python -m pip install ${PYSOLID_HOME}
 
       - run:
-          name: Test
+          name: Unit Test
           command: |
-            # setup environment variables
-            export PATH=${CONDA_PREFIX}/bin:${PATH}
             # run tests
-            python ${HOME}/tools/PySolid/tests/point.py
-            python ${HOME}/tools/PySolid/tests/grid.py
+            python ${PYSOLID_HOME}/tests/point.py
+            python ${PYSOLID_HOME}/tests/grid.py


=====================================
.github/workflows/build-and-publish-to-pypi.yml
=====================================
@@ -43,7 +43,7 @@ jobs:
           echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg
 
       - name: Build wheels
-        uses: pypa/cibuildwheel at v2.12.1
+        uses: pypa/cibuildwheel at v2.14.1
         env:
           # Disable building for PyPy and 32bit.
           CIBW_SKIP: pp* *-win32 *-manylinux_i686


=====================================
README.md
=====================================
@@ -1,8 +1,8 @@
 [![Language](https://img.shields.io/badge/python-3.8%2B-blue.svg?style=flat-square)](https://www.python.org/)
-[![CircleCI](https://img.shields.io/circleci/build/github/insarlab/PySolid.svg?logo=circleci&label=test&style=flat-square)](https://circleci.com/gh/insarlab/PySolid)
-[![Version](https://img.shields.io/github/v/release/insarlab/PySolid?color=brightgreen&label=version&style=flat-square)](https://github.com/insarlab/PySolid/releases)
-[![Conda Download](https://img.shields.io/conda/dn/conda-forge/pysolid?color=green&style=flat-square)](https://anaconda.org/conda-forge/pysolid)
-[![License](https://img.shields.io/badge/license-GPLv3+-yellow.svg?style=flat-square)](https://github.com/insarlab/PySolid/blob/main/LICENSE)
+[![CircleCI](https://img.shields.io/circleci/build/github/insarlab/PySolid.svg?logo=circleci&label=tests&style=flat-square)](https://circleci.com/gh/insarlab/PySolid)
+[![Conda Download](https://img.shields.io/conda/dn/conda-forge/pysolid?color=green&label=conda%20downloads&style=flat-square)](https://anaconda.org/conda-forge/pysolid)
+[![Version](https://img.shields.io/github/v/release/insarlab/PySolid?color=yellow&label=version&style=flat-square)](https://github.com/insarlab/PySolid/releases)
+[![License](https://img.shields.io/badge/license-GPLv3+-blue.svg?style=flat-square)](https://github.com/insarlab/PySolid/blob/main/LICENSE)
 [![Citation](https://img.shields.io/badge/doi-10.1109%2FTGRS.2022.3168509-blue?style=flat-square)](https://doi.org/10.1109/TGRS.2022.3168509)
 
 ## PySolid
@@ -42,14 +42,14 @@ git clone https://github.com/insarlab/PySolid.git
 
 ```bash
 # option 1: use conda to install dependencies into an existing, activated environment
-conda install -c conda-forge fortran-compiler --file PySolid/requirements.txt
+conda install -c conda-forge fortran-compiler --file PySolid/requirements.txt --file PySolid/tests/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 --file PySolid/tests/requirements.txt
 conda activate pysolid
 
 # option 3: have a Fortran compiler already installed and use pip to install the rest dependencies
-python -m pip install -r PySolid/requirements.txt
+python -m pip install -r PySolid/requirements.txt -r PySolid/tests/requirements.txt
 ```
 
 ##### c. Install PySolid
@@ -112,8 +112,8 @@ pysolid.plot_power_spectral_density4tides(tide_u, sample_spacing=step_sec)
 ```
 
 <p align="left">
-  <img width="600" src="https://yunjunzhang.files.wordpress.com/2021/01/set_ts_up-1.png">
-  <img width="600" src="https://yunjunzhang.files.wordpress.com/2021/01/set_psd-1.png">
+  <img width="600" src="./docs/images/set_point_ts.png">
+  <img width="600" src="./docs/images/set_point_psd.png">
 </p>
 
 #### 2.2 Grid Mode [[notebook](./docs/plot_grid_SET.ipynb)]
@@ -152,10 +152,10 @@ tide_los = (  tide_e * np.sin(inc_angle) * np.sin(az_angle) * -1
 ```
 
 <p align="left">
-  <img width="800" src="https://yunjunzhang.files.wordpress.com/2021/01/set_grid-3.png">
+  <img width="800" src="./docs/images/set_grid.png">
 </p>
 
 ### 3. Citing this work
 
-+   Yunjun, Z., Fattahi, H., Pi, X., Rosen, P., Simons, M., Agram, P., & Aoki, Y. (2022). Range Geolocation Accuracy of C-/L-band SAR and its Implications for Operational Stack Coregistration. _IEEE Trans. Geosci. Remote Sens., 60_, 1-19, doi:[10.1109/TGRS.2022.3168509](https://doi.org/10.1109/TGRS.2022.3168509), [arXiv](https://doi.org/10.31223/X5F641), [data](https://zenodo.org/record/6360749), [notebooks](https://github.com/yunjunz/2022-Geolocation).
++   Yunjun, Z., Fattahi, H., Pi, X., Rosen, P., Simons, M., Agram, P., & Aoki, Y. (2022). Range Geolocation Accuracy of C-/L-band SAR and its Implications for Operational Stack Coregistration. _IEEE Trans. Geosci. Remote Sens., 60_, 5227219. [ [doi](https://doi.org/10.1109/TGRS.2022.3168509) \| [arxiv](https://doi.org/10.31223/X5F641) \| [data](https://doi.org/10.5281/zenodo.6360749) \| [notebook](https://github.com/yunjunz/2022-Geolocation) ]
 +   Milbert, D. (2018), "solid: Solid Earth Tide", [Online]. Available: http://geodesyworld.github.io/SOFTS/solid.htm. Accessd on: 2020-09-06.


=====================================
docs/images/set_grid.png
=====================================
Binary files /dev/null and b/docs/images/set_grid.png differ


=====================================
docs/images/set_point_psd.png
=====================================
Binary files /dev/null and b/docs/images/set_point_psd.png differ


=====================================
docs/logo.pptx → docs/images/set_point_ts.png
=====================================
Binary files a/docs/logo.pptx and b/docs/images/set_point_ts.png differ


=====================================
docs/requirements.txt
=====================================
@@ -0,0 +1,4 @@
+# extra dependencies required for running notebooks
+cartopy
+matplotlib
+mintpy


=====================================
environment.yml deleted
=====================================
@@ -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


=====================================
pyproject.toml
=====================================
@@ -6,14 +6,14 @@ build-backend = "setuptools.build_meta"
 name = "pysolid"
 description = "A Python wrapper for solid to compute solid Earth tides"
 authors = [
-    {name="Zhang Yunjun", email="yunjunzgeo at gmail.com"},
+    {name="Zhang Yunjun", email="yunjunz at outlook.com"},
     {name="Dennis Milbert"},
 ]
 readme = "README.md"
 requires-python = ">=3.8"
 keywords = ["solid Earth tides", "deformation", "geodesy", "geophysics"]
 license = {text = "GPL-3.0-or-later"}
-classifiers=[
+classifiers = [
     "Development Status :: 4 - Beta",
     "Intended Audience :: Science/Research",
     "Topic :: Scientific/Engineering",
@@ -21,13 +21,11 @@ classifiers=[
     "Operating System :: OS Independent",
     "Programming Language :: Python :: 3",
 ]
-dependencies = [
-    "numpy",
-    "scipy",
-    "matplotlib",
-    "scikit-image",
-]
-dynamic = ["version"]
+
+# see section: setuptools_scm
+# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata
+# dependencies will be read from text files
+dynamic = ["version", "dependencies", "optional-dependencies"]
 
 [project.urls]
 "Homepage" = "https://github.com/insarlab/PySolid"
@@ -37,6 +35,16 @@ dynamic = ["version"]
 include-package-data = true
 zip-safe = false
 
+[tool.setuptools.dynamic]
+dependencies = { file = ["requirements.txt"] }
+
+# extra requirements: `pip install pysolid[docs]` or `pip install .[docs,test]`
+# note: the [docs] syntax requires setuptools>=64.0, thus, not working yet.
+[tool.setuptools.dynamic.optional-dependencies.docs]
+file = ["docs/requirements.txt"]
+[tool.setuptools.dynamic.optional-dependencies.test]
+file = ["tests/requirements.txt"]
+
 [tool.setuptools.packages.find]
 where = ["src"]
 


=====================================
requirements.txt
=====================================
@@ -1,8 +1,6 @@
 # for running
 numpy
 scipy
-matplotlib
-scikit-image
 # for packaging and installation
 #fortran-compiler   # Fortran compiler across platforms through conda-forge channel
 pip


=====================================
setup.py
=====================================
@@ -18,7 +18,7 @@ setup(
     long_description=readme(),
     long_description_content_type="text/markdown",
     author="Zhang Yunjun, Dennis Milbert",
-    author_email="yunjunzgeo at gmail.com",
+    author_email="yunjunz at outlook.com",
     license="GPL-3.0-or-later",
     license_files=("LICENSE",),
 
@@ -42,8 +42,6 @@ setup(
     install_requires=[
         "numpy",
         "scipy",
-        "matplotlib",
-        "scikit-image",
     ],
 
     # package discovery


=====================================
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:


=====================================
src/pysolid/point.py
=====================================
@@ -16,8 +16,6 @@ import datetime as dt
 import os
 
 import numpy as np
-from matplotlib import pyplot as plt, ticker, dates as mdates
-from scipy import signal
 
 
 ## Tidal constituents
@@ -94,10 +92,10 @@ def calc_solid_earth_tides_point(lat, lon, dt0, dt1, step_sec=60, display=False,
     """
 
     print('PYSOLID: calculate solid Earth tides in east/north/up direction')
-    print('PYSOLID: lot/lon: {}/{} degree'.format(lat, lon))
-    print('PYSOLID: start UTC: {}'.format(dt0.isoformat()))
-    print('PYSOLID: end   UTC: {}'.format(dt1.isoformat()))
-    print('PYSOLID: time step: {} seconds'.format(step_sec))
+    print(f'PYSOLID: lot/lon: {lat}/{lon} degree')
+    print(f'PYSOLID: start UTC: {dt0.isoformat()}')
+    print(f'PYSOLID: end   UTC: {dt1.isoformat()}')
+    print(f'PYSOLID: time step: {step_sec} seconds')
 
     dt_out = []
     tide_e = []
@@ -108,7 +106,7 @@ def calc_solid_earth_tides_point(lat, lon, dt0, dt1, step_sec=60, display=False,
     for i in range(ndays):
         di = dt0.date() + dt.timedelta(days=i)
         if verbose:
-            print('SOLID  : {} {}/{} ...'.format(di.isoformat(), i+1, ndays))
+            print(f'SOLID  : {di.isoformat()} {i+1}/{ndays} ...')
 
         # calc tide_u/n/u for the whole day
         (dt_outi,
@@ -185,6 +183,8 @@ def calc_solid_earth_tides_point_per_day(lat, lon, date_str, step_sec=60):
 def plot_solid_earth_tides_point(dt_out, tide_e, tide_n, tide_u, lalo=None,
                                  out_fig=None, save=False, display=True):
     """Plot the solid Earth tides at one point."""
+    from matplotlib import pyplot as plt, dates as mdates
+
     # plot
     fig, axs = plt.subplots(nrows=3, ncols=1, figsize=[6, 4], sharex=True)
     for ax, data, label in zip(axs.flatten(),
@@ -227,6 +227,9 @@ def plot_power_spectral_density4tides(tide_ts, sample_spacing, out_fig=None, fig
     """Plot the power spectral density (PSD) of tides time-series.
     Note: for accurate PSD analysis, a long time-series, e.g. one year, is recommended.
     """
+    from matplotlib import pyplot as plt, ticker
+    from scipy import signal
+
     ## calc PSD
     freq, psd = signal.periodogram(tide_ts, fs=1/sample_spacing, scaling='density')
     # get rid of zero in the first element


=====================================
src/pysolid/solid.for
=====================================
@@ -1559,9 +1559,9 @@
 
       implicit double precision(a-h,o-z)
       double precision tsec
-      !*** upper limit, leap second table, 2023dec28
+      !*** upper limit, leap second table, 2024jun28
       !*** lower limit, leap second table, 1972jan01
-      parameter(MJDUPPER=60306)
+      parameter(MJDUPPER=60489)
       parameter(MJDLOWER=41317)
 
       !*** leap second table limit flag
@@ -1642,7 +1642,7 @@
 ***** other leap second references at:
 ***** http://hpiers.obspm.fr/eoppc/bul/bulc/Leap_Second_History.dat
 ***** http://hpiers.obspm.fr/eoppc/bul/bulc/bulletinc.dat
-***** File expires on 28 December 2023
+***** File expires on 28 June 2024
 
 *** test against newest leaps first
 


=====================================
tests/requirements.txt
=====================================
@@ -0,0 +1,2 @@
+# extra dependency required for testing
+matplotlib



View it on GitLab: https://salsa.debian.org/debian-gis-team/pysolid/-/commit/bf234de63766b1acef40bd8f69ccd399e411a7a5

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pysolid/-/commit/bf234de63766b1acef40bd8f69ccd399e411a7a5
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20230821/4fca8c0d/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list