Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/johntruckenbrodt/pyroSAR in…
Browse files Browse the repository at this point in the history
…to feature/coherence_gamma
  • Loading branch information
johntruckenbrodt committed Jun 18, 2024
2 parents 7934386 + a044cf1 commit 8f3ef92
Show file tree
Hide file tree
Showing 31 changed files with 985 additions and 463 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: conda build

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_PASSWORD: Password12!
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: '3.10'
- name: install ESA SNAP
run: |
wget -nv https://download.esa.int/step/snap/10_0/installers/esa-snap_sentinel_linux-10.0.0.sh
bash esa-snap_sentinel_linux-10.0.0.sh -q -dir $GITHUB_ACTION_PATH/esa-snap
- name: Set paths and variables
run: |
echo "$CONDA/bin" >> $GITHUB_PATH
echo "$GITHUB_ACTION_PATH/esa-snap/bin" >> $GITHUB_PATH
echo "PROJ_DATA=$CONDA/share/proj" >> $GITHUB_ENV
- name: Install dependencies
run: |
: # https://github.com/conda/conda/issues/13560#issuecomment-1992720842
conda install -y python=3.10
conda env update --file environment.yml --name base
- name: Lint with flake8
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install package
run: |
pip install .
- name: Test with pytest
run: |
conda install pytest coverage
coverage run -m pytest
env:
PGUSER: postgres
PGPASSWORD: Password12!
- name: Publish to coveralls.io
uses: coverallsapp/github-action@v2
with:
github-token: ${{ github.token }}
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [ published ]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
- TESTDATA_DIR=$HOME/testdata
- PGUSER=travis
- PGPASSWORD=Password12!
- SNAP_VERSION=9
- SNAP_VERSION=10

addons:
postgresql: '14'
Expand All @@ -31,11 +31,11 @@ services:
- postgresql

python:
- '3.7'
- '3.10'

before_install:
- export SNAP_INSTALLER=esa-snap_sentinel_unix_"$SNAP_VERSION"_0_0.sh
- wget -O $SNAP_INSTALLER https://download.esa.int/step/snap/"$SNAP_VERSION".0/installers/"$SNAP_INSTALLER"
- export SNAP_INSTALLER=esa-snap_sentinel_linux-"$SNAP_VERSION".0.0.sh
- wget -O $SNAP_INSTALLER https://download.esa.int/step/snap/"$SNAP_VERSION"_0/installers/"$SNAP_INSTALLER"
- bash $SNAP_INSTALLER -q
- export PATH=$PATH:/opt/snap/bin

Expand All @@ -60,6 +60,3 @@ script:

after_success:
- coveralls

notifications:
slack: pyrosar:bs03zodEkRSYr8MN5HrgfSeB
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2023, the pyroSAR Developers.
# Copyright (c) 2014-2024, the pyroSAR Developers.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
<h3 align="center">A Python Framework for Large-Scale SAR Satellite Data Processing</h3>

<p align="center">
<a href='https://app.travis-ci.com/johntruckenbrodt/pyroSAR'>
<img src='https://app.travis-ci.com/johntruckenbrodt/pyroSAR.svg?branch=master' alt='Travis Status'></a>
<a href='https://ci.appveyor.com/project/johntruckenbrodt/pyrosar'>
<img src='https://ci.appveyor.com/api/projects/status/won0layps8mkss9h/branch/master?svg=true' alt='AppVeyor Status' /></a>
<a href='https://coveralls.io/github/johntruckenbrodt/pyroSAR?branch=master'>
<img src='https://coveralls.io/repos/github/johntruckenbrodt/pyroSAR/badge.svg?branch=master' alt='Coveralls Status' /></a>
<a href='https://github.com/johntruckenbrodt/pyroSAR/actions/workflows/python-package-conda.yml'>
<img src='https://github.com/johntruckenbrodt/pyroSAR/actions/workflows/python-package-conda.yml/badge.svg' alt='Travis Status'></a>
<a href='https://coveralls.io/github/johntruckenbrodt/pyroSAR?branch=main'>
<img src='https://coveralls.io/repos/github/johntruckenbrodt/pyroSAR/badge.svg?branch=main' alt='Coveralls Status' /></a>
<a href='https://pyrosar.readthedocs.io/en/latest/?badge=latest'>
<img src='https://readthedocs.org/projects/pyrosar/badge/?version=latest' alt='Documentation Status' /></a>
<a href='https://badge.fury.io/py/pyroSAR'>
Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ environment:
SNAP_INSTALL: C:\projects\snap
PGUSER: postgres
PGPASSWORD: Password12!
SNAP_VERSION: 9
SNAP_INSTALLER: esa-snap_sentinel_windows-x64_%SNAP_VERSION%_0_0.exe
SNAP_VERSION: 10
SNAP_INSTALLER: esa-snap_sentinel_windows-%SNAP_VERSION%.0.0.exe

platform:
- x64
Expand Down Expand Up @@ -48,7 +48,7 @@ install:
- conda config --add channels conda-forge

# install ESA SNAP
- appveyor DownloadFile https://download.esa.int/step/snap/%SNAP_VERSION%.0/installers/%SNAP_INSTALLER%
- appveyor DownloadFile https://download.esa.int/step/snap/%SNAP_VERSION%_0/installers/%SNAP_INSTALLER%
- start %SNAP_INSTALLER% -q -dir %SNAP_INSTALL%

- set PATH=%PATH%;%SNAP_INSTALL%\bin
Expand Down
42 changes: 42 additions & 0 deletions docs/source/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1014,3 +1014,45 @@ Drivers
Auxiliary Data Handling
-----------------------
- method :meth:`pyroSAR.S1.OSV.catch`: fixed bug in finding files starting in previous month

0.25.0 | 2024-04-16
===================

Drivers
-------
- class :class:`pyroSAR.drivers.Archive`:

+ replaced column `bbox` with `geometry`; requires database migration
+ method :meth:`~pyroSAR.drivers.Archive.export2shp`: improved column name laundering

SNAP API
--------
- function :func:`pyroSAR.snap.auxil.gpt`: fixed bug that occurred during removal of BNR node

Ancillary Tools
---------------
- new classes :class:`pyroSAR.ancillary.Lock` and :class:`pyroSAR.ancillary.LockCollection`
for custom file/folder locking

Auxiliary Data Handling
-----------------------

changes to Sentinel-1 OSV data handling:

- function :meth:`pyroSAR.auxdata.dem_create`:

+ make use of new classes :class:`~pyroSAR.ancillary.Lock` and :class:`~pyroSAR.ancillary.LockCollection`
for DEM download and mosaic creation (new argument `lock_timeout`)
+ check whether all VRT source files exist

0.26.0 | 2024-05-15
===================

SNAP API
--------
- compatibility with SNAP 10.
- completely revised configuration mechanisms. See

+ :doc:`/general/configuration`
+ :class:`pyroSAR.examine.ExamineSnap`
+ :class:`pyroSAR.examine.SnapProperties`
2 changes: 2 additions & 0 deletions docs/source/api/ancillary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ Ancillary Functions
multilook_factors
parse_datasetname
seconds
Lock
LockCollection
23 changes: 23 additions & 0 deletions docs/source/general/configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#############
Configuration
#############

pyroSAR stores configuration under `$HOME/.pyrosar`.
It contains a file `config.ini` which stores installation paths of SNAP and GAMMA.
The installations are first identified by running the respective `Examine*` class (e.g. :class:`~pyroSAR.examine.ExamineSnap`):

.. code-block:: python
from pyroSAR.examine import ExamineSnap
config = ExamineSnap()
SNAP configuration can also be modified with this class, either by the object properties `userpath` and `auxdatapath` or by the underlying :class:`~pyroSAR.examine.SnapProperties` object:

.. code-block:: python
config.userpath = '/path/to/snap/data'
config.snap_properties['snap.userdir'] = '/path/to/snap/data'
The values are directly written to either `snap.auxdata.properties` or `snap.properties` under `$HOME/.snap/etc`.
The content of these files will override that in the files found under `etc` in the SNAP installation folder.
Setting a parameter to `None` will comment out the value in the respective file.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ General Topics

general/installation
general/filenaming
general/configuration
general/OSV
general/DEM
general/snap
Expand Down
3 changes: 2 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python>=3.6
- python>=3.8,<3.11
- progressbar2
- numpy
- spatialist>=0.12.1
Expand All @@ -17,6 +17,7 @@ dependencies:
- pillow
- lxml
- packaging
- libspatialite>=5.1.0
- coveralls
- coverage
- pytest
1 change: 1 addition & 0 deletions environment-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python>=3.8,<3.11
- matplotlib
- numpy
- sphinx<7.0 # https://github.com/readthedocs/sphinx_rtd_theme/issues/1463
Expand Down
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python>=3.6
- python>=3.8,<3.11 # https://github.com/kvesteri/sqlalchemy-utils/issues/716
- progressbar2
- numpy
- spatialist>=0.12.1
Expand All @@ -17,3 +17,4 @@ dependencies:
- pillow
- lxml
- packaging
- libspatialite>=5.1.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"]
[project]
name = "pyroSAR"
description = "a framework for large-scale SAR satellite data processing"
requires-python = ">=3.6"
requires-python = ">=3.8,<3.11"
license = { file = "LICENSE.txt" }
maintainers = [
{ name = "John Truckenbrodt", email = "[email protected]" }
Expand Down
2 changes: 1 addition & 1 deletion pyroSAR/S1/polysimplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def __init__(self, geom, precision=None, return_GDAL=True):
name = geom.geom_type.upper()
self.Geometry = lambda w: fromstr(w)
self.pts = np.array(geom.tuple)
elif isinstance(geom, unicode) or isinstance(geom, str):
elif isinstance(geom, str) or isinstance(geom, bytes):
# assume wkt
# for WKT
def str2tuple(q):
Expand Down
22 changes: 7 additions & 15 deletions pyroSAR/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
from .drivers import *
import sys
from . import ancillary, drivers

if sys.version_info >= (3, 8):
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass
else:
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass
Loading

0 comments on commit 8f3ef92

Please sign in to comment.