[Git][debian-gis-team/pysolid][upstream] New upstream version 0.3.3
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sun Jun 30 11:59:10 BST 2024
Antonio Valentino pushed to branch upstream at Debian GIS Project / pysolid
Commits:
19cfb8ed by Antonio Valentino at 2024-06-30T10:09:47+02:00
New upstream version 0.3.3
- - - - -
12 changed files:
- .circleci/config.yml
- + .github/release.yml
- .github/workflows/build-and-publish-to-pypi.yml
- .gitignore
- + CMakeLists.txt
- README.md
- pyproject.toml
- − setup.py
- src/pysolid/point.py
- tests/grid.py
- tests/point.py
- tests/requirements.txt
Changes:
=====================================
.circleci/config.yml
=====================================
@@ -23,9 +23,9 @@ jobs:
# The executor is the environment in which the steps below will be executed - below will use a python 3.9 container
# Change the version below to your required version of python
docker:
- - image: ubuntu:bionic
+ - image: cimg/base:current
environment:
- CONDA_PREFIX: /root/tools/mambaforge
+ CONDA_PREFIX: /root/tools/miniforge
PYSOLID_HOME: /root/tools/PySolid
user: root
working_directory: /root/tools/PySolid
@@ -33,17 +33,17 @@ jobs:
steps:
- checkout
- run:
- name: Setting Environment with Mambaforge
+ name: Setting Environment with Miniforge
command: |
apt update
apt-get update --yes && apt-get upgrade --yes
apt-get install --yes wget git
- # download and install mambaforge
+ # download and install miniforge
mkdir -p ${HOME}/tools
cd ${HOME}/tools
- 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
+ wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
+ bash Miniforge3-Linux-x86_64.sh -b -p ${HOME}/tools/miniforge
+ ${HOME}/tools/miniforge/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}
=====================================
.github/release.yml
=====================================
@@ -0,0 +1,7 @@
+# .github/release.yml
+
+changelog:
+ exclude:
+ authors:
+ - dependabot
+ - pre-commit-ci
=====================================
.github/workflows/build-and-publish-to-pypi.yml
=====================================
@@ -16,21 +16,22 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-20.04, macos-11] #windows-2019
+ # skip building wheel for windows as it's not working yet
+ os: [ubuntu-latest, macos-13] #windows-2019
steps:
- uses: actions/checkout at v4
with:
fetch-depth: 0
- - name: Provide gfortran (macOS)
+ - name: Provide gfortran (macOS-13)
if: runner.os == 'macOS'
run: |
# https://github.com/actions/virtual-environments/issues/2524
# https://github.com/cbg-ethz/dce/blob/master/.github/workflows/pkgdown.yaml
- sudo ln -s /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
+ sudo ln -s /usr/local/bin/gfortran-13 /usr/local/bin/gfortran
sudo mkdir /usr/local/gfortran
- sudo ln -s /usr/local/Cellar/gcc at 11/*/lib/gcc/11 /usr/local/gfortran/lib
+ sudo ln -s /usr/local/Cellar/gcc at 13/*/lib/gcc/13 /usr/local/gfortran/lib
gfortran --version
- name: Provide gfortran (Windows)
@@ -43,19 +44,20 @@ jobs:
echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg
- name: Build wheels
- uses: pypa/cibuildwheel at v2.14.1
+ uses: pypa/cibuildwheel at v2.19.1
env:
# Disable building for PyPy and 32bit.
CIBW_SKIP: pp* *-win32 *-manylinux_i686
- # Fix error for python 3.11 on macOS
- CIBW_ENVIRONMENT_MACOS: SETUPTOOLS_USE_DISTUTILS=stdlib
+ CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET="13.0"
+ CIBW_BEFORE_BUILD_MACOS: python -m pip install --upgrade pip
# Package the DLL dependencies in the wheel for windows (done by default for the other platforms).
# delvewheel cannot mangle the libraries, stripping does not work.
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel show {wheel} && delvewheel repair -w {dest_dir} {wheel} --no-mangle-all"
- - uses: actions/upload-artifact at v3
+ - uses: actions/upload-artifact at v4
with:
+ name: artifact-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
@@ -69,8 +71,9 @@ jobs:
- name: Build sdist
run: pipx run build --sdist
- - uses: actions/upload-artifact at v3
+ - uses: actions/upload-artifact at v4
with:
+ name: artifact-source
path: dist/*.tar.gz
upload_pypi:
@@ -79,20 +82,23 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'insarlab' && github.event_name == 'push'
steps:
- - uses: actions/download-artifact at v3
+ - uses: actions/download-artifact at v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
- name: artifact
path: dist
+ pattern: artifact-*
+ merge-multiple: true
+ - name: Display structure of downloaded files
+ run: ls -R dist
- name: Publish developed version 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish at release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
- repository_url: https://test.pypi.org/legacy/
- skip_existing: false
+ repository-url: https://test.pypi.org/legacy/
+ skip-existing: false
verbose: true
- name: Publish released version 📦 to PyPI
=====================================
.gitignore
=====================================
@@ -131,3 +131,6 @@ dmypy.json
# Pyre type checker
.pyre/
+
+# Scikit-build temp directory
+/_skbuild/
=====================================
CMakeLists.txt
=====================================
@@ -0,0 +1,37 @@
+# Based on:
+# https://github.com/scikit-build/scikit-build-core/tree/main/docs/examples/getting_started/fortran
+
+cmake_minimum_required(VERSION 3.17.2...3.29)
+project(${SKBUILD_PROJECT_NAME} LANGUAGES C Fortran)
+
+find_package(
+ Python
+ COMPONENTS Interpreter Development.Module NumPy
+ REQUIRED)
+
+# F2PY headers
+execute_process(
+ COMMAND "${PYTHON_EXECUTABLE}" -c
+ "import numpy.f2py; print(numpy.f2py.get_include())"
+ OUTPUT_VARIABLE F2PY_INCLUDE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+add_library(fortranobject OBJECT "${F2PY_INCLUDE_DIR}/fortranobject.c")
+target_link_libraries(fortranobject PUBLIC Python::NumPy)
+target_include_directories(fortranobject PUBLIC "${F2PY_INCLUDE_DIR}")
+set_property(TARGET fortranobject PROPERTY POSITION_INDEPENDENT_CODE ON)
+
+add_custom_command(
+ OUTPUT solidmodule.c solid-f2pywrappers.f
+ DEPENDS src/pysolid/solid.for
+ VERBATIM
+ COMMAND "${Python_EXECUTABLE}" -m numpy.f2py
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/pysolid/solid.for" -m solid --lower)
+
+python_add_library(
+ solid MODULE "${CMAKE_CURRENT_BINARY_DIR}/solidmodule.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/solid-f2pywrappers.f"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/pysolid/solid.for" WITH_SOABI)
+target_link_libraries(solid PRIVATE fortranobject)
+
+install(TARGETS solid DESTINATION pysolid)
=====================================
README.md
=====================================
@@ -13,7 +13,7 @@ This is research code provided to you "as is" with NO WARRANTIES OF CORRECTNESS.
### 1. Install
-PySolid is available on the [conda-forge](https://anaconda.org/conda-forge/pysolid) channel and the main archive of the [Debian](https://tracker.debian.org/pkg/pysolid) GNU/Linux OS. The released version can be install via `conda` as:
+PySolid is available on the [conda-forge](https://anaconda.org/conda-forge/pysolid) channel and the main archive of the [Debian](https://tracker.debian.org/pkg/pysolid) GNU/Linux OS. The released version can be installed via `conda` as:
```shell
# run "conda update pysolid" to update the installed version
@@ -59,8 +59,6 @@ python -m pip install -r PySolid/requirements.txt -r PySolid/tests/requirements.
python -m pip install PySolid
# option 2: use pip to install pysolid in develop mode (editable) into the current environment
-# setting an environmental variable as below is required for editable installs via pyproject.toml
-export SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
python -m pip install -e PySolid
# option 3: manually compile the Fortran code and setup environment variable
=====================================
pyproject.toml
=====================================
@@ -1,6 +1,6 @@
[build-system]
-requires = ["setuptools<60.0", "setuptools_scm[toml]>=6.2", "numpy<1.23.0", "wheel"]
-build-backend = "setuptools.build_meta"
+requires = ["cmake", "scikit-build-core", "setuptools", "setuptools_scm[toml]>=6.2", "numpy", "wheel"]
+build-backend = "scikit_build_core.build"
[project]
name = "pysolid"
@@ -11,6 +11,11 @@ authors = [
]
readme = "README.md"
requires-python = ">=3.8"
+dependencies = [
+ "numpy",
+ "scipy",
+]
+
keywords = ["solid Earth tides", "deformation", "geodesy", "geophysics"]
license = {text = "GPL-3.0-or-later"}
classifiers = [
@@ -25,7 +30,7 @@ classifiers = [
# 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"]
+dynamic = ["version"]
[project.urls]
"Homepage" = "https://github.com/insarlab/PySolid"
@@ -35,16 +40,6 @@ dynamic = ["version", "dependencies", "optional-dependencies"]
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"]
@@ -54,3 +49,6 @@ pysolid = ["*.for"]
[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "no-local-version"
+
+[tool.scikit-build]
+metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
=====================================
setup.py deleted
=====================================
@@ -1,61 +0,0 @@
-# Author: Zhang Yunjun, Jan 2021
-# Copyright 2020, by the California Institute of Technology.
-
-# always prefer setuptools over distutils
-import setuptools
-from numpy.distutils.core import setup, Extension
-
-# read the contents of README file
-def readme():
- with open("README.md") as f:
- return f.read()
-
-setup(
- ## add the following redundant setup for setuptools<60, the latter is required for numpy.distutils
- name="pysolid",
- description="A Python wrapper for solid to compute solid Earth tides",
- url="https://github.com/insarlab/PySolid",
- long_description=readme(),
- long_description_content_type="text/markdown",
- author="Zhang Yunjun, Dennis Milbert",
- author_email="yunjunz at outlook.com",
- license="GPL-3.0-or-later",
- license_files=("LICENSE",),
-
- classifiers=[
- "Development Status :: 4 - Beta",
- "Intended Audience :: Science/Research",
- "Topic :: Scientific/Engineering",
- "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
- "Operating System :: OS Independent",
- "Programming Language :: Python :: 3",
- ],
- keywords="solid Eartth tides, deformation, geodesy, geophysics",
-
- project_urls={
- "Bug Reports": "https://github.com/insarlab/PySolid/issues",
- "Source": "https://github.com/insarlab/PySolid",
- },
-
- # dependencies
- python_requires=">=3.8",
- install_requires=[
- "numpy",
- "scipy",
- ],
-
- # package discovery
- packages=setuptools.find_packages("src"), # include all packages under src
- package_dir={"": "src"}, # tell distutils packages are under src
-
- # data files
- include_package_data=True,
- package_data={
- "pysolid": ["solid.for"],
- },
-
- ## fortran extensions to build with numpy.f2py
- ext_modules=[
- Extension(name="pysolid.solid", sources=["src/pysolid/solid.for"])
- ],
-)
=====================================
src/pysolid/point.py
=====================================
@@ -62,7 +62,7 @@ TIDES = (
Tag('Shallow water terdiurnal' , r'$MK_3$' , 8.177140247, 44.0251729, 365.555, 8 ),
Tag('Shallow water overtides of principal solar', r'$S_4$' , 6.0 , 60.0 , 491.555, 9 ),
Tag('Shallow water quarter diurnal' , r'$MN_4$' , 6.269173724, 57.4238337, 445.655, 10),
- Tag('Shallow water overtides of principal solar', r'$S_6$' , 4.0 , 90.0 , np.NaN , 12),
+ Tag('Shallow water overtides of principal solar', r'$S_6$' , 4.0 , 90.0 , np.nan , 12),
Tag('Lunar terdiurnal' , r'$M_3$' , 8.280400802, 43.4761563, 355.555, 32),
Tag('Shallow water terdiurnal' , '2"MK'+r'$_3$', 8.38630265 , 42.9271398, 345.555, 34),
Tag('Shallow water eighth diurnal' , r'$M_8$' , 3.105150301, 115.9364166, 855.555, 36),
@@ -203,6 +203,7 @@ def plot_solid_earth_tides_point(dt_out, tide_e, tide_n, tide_u, lalo=None,
if lalo:
axs[0].set_title('solid Earth tides at (N{}, E{})'.format(lalo[0], lalo[1]), fontsize=12)
fig.tight_layout()
+ fig.align_ylabels()
# output
if out_fig:
=====================================
tests/grid.py
=====================================
@@ -7,6 +7,8 @@ import os
import sys
import datetime as dt
+import numpy as np
+
import pysolid
@@ -27,11 +29,42 @@ if __name__ == '__main__':
'Y_STEP' : -0.000833333,
}
+ # reference
+ # calculated based on version 0.3.2.post6 on Jun 24, 2024
+ # env: macOS with python-3.10, numpy-1.24
+ # install: manual compilation via f2py
+ tide_e_80_100 = np.array(
+ [[0.01628786, 0.01630887, 0.01633078, 0.01635247, 0.01637394],
+ [0.01633248, 0.01635348, 0.01637538, 0.01639706, 0.01641851],
+ [0.01638009, 0.01640107, 0.01642296, 0.01644462, 0.01646606],
+ [0.01642767, 0.01644864, 0.01647052, 0.01649217, 0.01651359],
+ [0.01647523, 0.01649619, 0.01651805, 0.01653968, 0.01656109]],
+ )
+ tide_n_80_100 = np.array(
+ [[-0.02406203, -0.02412341, -0.02418807, -0.02425273, -0.0243174 ],
+ [-0.02407558, -0.02413699, -0.02420168, -0.02426637, -0.02433107],
+ [-0.02408992, -0.02415136, -0.02421608, -0.02428081, -0.02434554],
+ [-0.02410413, -0.0241656 , -0.02423036, -0.02429511, -0.02435988],
+ [-0.02411821, -0.02417972, -0.0242445 , -0.02430929, -0.02437408]],
+ )
+ tide_u_80_100 = np.array(
+ [[-0.05548462, -0.05533455, -0.05517631, -0.05501789, -0.05485928],
+ [-0.05529561, -0.0551451 , -0.05498639, -0.0548275 , -0.05466843],
+ [-0.05509374, -0.05494276, -0.05478355, -0.05462417, -0.05446461],
+ [-0.05489176, -0.05474031, -0.05458061, -0.05442073, -0.05426067],
+ [-0.05468968, -0.05453776, -0.05437757, -0.05421719, -0.05405664]],
+ )
+
# calculate
(tide_e,
tide_n,
tide_u) = pysolid.calc_solid_earth_tides_grid(dt_obj, atr, verbose=True)
+ # compare
+ assert np.allclose(tide_e[::80, ::100], tide_e_80_100)
+ assert np.allclose(tide_n[::80, ::100], tide_n_80_100)
+ assert np.allclose(tide_u[::80, ::100], tide_u_80_100)
+
# plot
out_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pic'))
os.makedirs(out_dir, exist_ok=True)
=====================================
tests/point.py
=====================================
@@ -7,6 +7,8 @@ import os
import sys
import datetime as dt
+import numpy as np
+
import pysolid
@@ -18,8 +20,37 @@ if __name__ == '__main__':
# prepare inputs
lat, lon = 34.0, -118.0 # Los Angles, CA
- dt_obj0 = dt.datetime(2020, 11, 1, 4, 0, 0)
- dt_obj1 = dt.datetime(2020, 12, 31, 2, 0, 0)
+ dt_obj0 = dt.datetime(2020, 11, 5, 12, 0, 0)
+ dt_obj1 = dt.datetime(2020, 12, 31, 0, 0, 0)
+
+ # reference
+ # calculated based on version 0.3.2.post6 on Jun 24, 2024
+ # env: macOS with python-3.10, numpy-1.24
+ # install: manual compilation via f2py
+ dt_out_8000 = np.array(
+ [dt.datetime(2020, 11, 5, 12, 0),
+ dt.datetime(2020, 11, 11, 1, 20),
+ dt.datetime(2020, 11, 16, 14, 40),
+ dt.datetime(2020, 11, 22, 4, 0),
+ dt.datetime(2020, 11, 27, 17, 20),
+ dt.datetime(2020, 12, 3, 6, 40),
+ dt.datetime(2020, 12, 8, 20, 0),
+ dt.datetime(2020, 12, 14, 9, 20),
+ dt.datetime(2020, 12, 19, 22, 40),
+ dt.datetime(2020, 12, 25, 12, 0)], dtype=object,
+ )
+ tide_e_8000 = np.array(
+ [-0.02975027, 0.04146837, -0.02690945, -0.00019223, 0.01624152,
+ 0.0532655 , -0.02140918, -0.05554432, 0.01371739, -0.00516968],
+ )
+ tide_n_8000 = np.array(
+ [-0.01275229, -0.02834036, 0.00886857, -0.03247227, -0.05237735,
+ -0.00590791, -0.01990448, -0.01964124, -0.04439581, -0.00410378],
+ )
+ tide_u_8000 = np.array(
+ [ 0.16008235, -0.05721991, -0.15654693, -0.00041214, 0.03041098,
+ 0.13082217, -0.1006462 , 0.24870719, -0.02648802, -0.08420228],
+ )
# calculate
(dt_out,
@@ -27,6 +58,12 @@ if __name__ == '__main__':
tide_n,
tide_u) = pysolid.calc_solid_earth_tides_point(lat, lon, dt_obj0, dt_obj1, verbose=False)
+ # compare
+ assert all(dt_out[::8000] == dt_out_8000)
+ assert np.allclose(tide_e[::8000], tide_e_8000)
+ assert np.allclose(tide_n[::8000], tide_n_8000)
+ assert np.allclose(tide_u[::8000], tide_u_8000)
+
# plot
out_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pic'))
os.makedirs(out_dir, exist_ok=True)
=====================================
tests/requirements.txt
=====================================
@@ -1,5 +1,6 @@
# for packaging and installation
#fortran-compiler # Fortran compiler across platforms through conda-forge channel
+meson
pip
setuptools_scm>=6.2
# for testing
View it on GitLab: https://salsa.debian.org/debian-gis-team/pysolid/-/commit/19cfb8ede678d5251437b3abba8220922040ca82
--
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/debian-gis-team/pysolid/-/commit/19cfb8ede678d5251437b3abba8220922040ca82
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/20240630/d0d3855d/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list