Skip to content

FMT: run black on codebase, add to pre-commit #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ body:
id: description
attributes:
label: Describe the feature request
description: A clear and concise description of your request.
description: A clear and concise description of your request.
placeholder: Tell us what you want
value: "I need or want [...]"
validations:
Expand Down
28 changes: 23 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
autofix_prs: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
args: [--allow-multiple-documents]
- id: debug-statements
- id: end-of-file-fixer
- id: file-contents-sorter
files: (requirements.txt)$
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: "25.1.0"
hooks:
- id: black
args: [--preview, --enable-unstable-feature, string_processing]
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ python:
- method: pip
path: .
extra_requirements:
- docs
- docs
2 changes: 1 addition & 1 deletion build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ set -ex

docker build --rm --force-rm --network host -t $REPO/$IMAGE:$TAG -f docker/Dockerfile.isce3_builder .

docker save $REPO/$IMAGE:$TAG > docker/dockerimg_cslc_s1_${TAG}.tar
docker save $REPO/$IMAGE:$TAG > docker/dockerimg_cslc_s1_${TAG}.tar
1 change: 0 additions & 1 deletion docker/specfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,3 @@ https://conda.anaconda.org/conda-forge/linux-64/scikit-learn-1.3.0-py311hc009520
https://conda.anaconda.org/conda-forge/noarch/mapclassify-2.5.0-pyhd8ed1ab_1.conda
https://conda.anaconda.org/conda-forge/noarch/geopandas-0.13.2-pyhd8ed1ab_1.conda
https://conda.anaconda.org/conda-forge/noarch/dem_stitcher-2.5.0-pyhd8ed1ab_0.conda

16 changes: 8 additions & 8 deletions docker/specfile_isce3_builder
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
@EXPLICIT
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/_sysroot_linux-64_curr_repodata_hack-3-h69a702a_13.conda
https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2023.7.22-hbcca054_0.conda
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
@EXPLICIT
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/_sysroot_linux-64_curr_repodata_hack-3-h69a702a_13.conda
https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2023.7.22-hbcca054_0.conda
https://conda.anaconda.org/conda-forge/noarch/font-ttf-dejavu-sans-mono-2.37-hab24e00_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/font-ttf-inconsolata-3.000-h77eed37_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/font-ttf-source-code-pro-2.038-h77eed37_0.tar.bz2
Expand Down Expand Up @@ -259,4 +259,4 @@ https://conda.anaconda.org/conda-forge/linux-64/scikit-learn-1.3.0-py39hc236052_
https://conda.anaconda.org/conda-forge/noarch/mapclassify-2.5.0-pyhd8ed1ab_1.conda
https://conda.anaconda.org/conda-forge/linux-64/pysolid-0.3.0-py39hf62ee64_0.conda
https://conda.anaconda.org/conda-forge/noarch/geopandas-0.13.2-pyhd8ed1ab_1.conda
https://conda.anaconda.org/conda-forge/noarch/dem_stitcher-2.5.0-pyhd8ed1ab_0.conda
https://conda.anaconda.org/conda-forge/noarch/dem_stitcher-2.5.0-pyhd8ed1ab_0.conda
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ dependencies:
- rasterio
- dem_stitcher
- gxx_linux-64>=9,<10

14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
python>=3.9 # sentinel1-reader requirement
numpy # sentinel1-reader requirement
lxml # sentinel1-reader requirement
#journal # as of Mar 2022, journal from conda does not support python3.9; since it is included during isce3 installation above, comment this out temporarily.
gdal>=3
h5py
isce3>=0.13.0 # since the conda-installed isce3 is not the most updated version, installing isce3 from stratch is recommended, to stay in sync with isce3 development.
#journal # as of Mar 2022, journal from conda does not support python3.9; since it is included during isce3 installation above, comment this out temporarily.
lxml # sentinel1-reader requirement
numpy # sentinel1-reader requirement
pandas
pyproj
pysolid
pytest
pytest-order
python>=3.9 # sentinel1-reader requirement
requests
ruamel.yaml
scipy
yamale
h5py
shapely
requests
yamale
25 changes: 15 additions & 10 deletions src/compass/s1_cslc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/usr/bin/env python

'''driver for CSLC workflow in radar/geo'''

from compass import (s1_rdr2geo, s1_geo2rdr, s1_resample,
s1_geocode_slc, s1_static_layers)
"""driver for CSLC workflow in radar/geo"""

from compass import (
s1_rdr2geo,
s1_geo2rdr,
s1_resample,
s1_geocode_slc,
s1_static_layers,
)
from compass.utils.geo_runconfig import GeoRunConfig
from compass.utils.runconfig import RunConfig
from compass.utils.yaml_argparse import YamlArgparse
Expand All @@ -21,10 +26,10 @@ def run(run_config_path: str, grid_type: str):
Grid type of the output CSLC
"""

if grid_type == 'radar':
if grid_type == "radar":
# CSLC workflow in radar coordinates
# get a runconfig dict from command line args
cfg = RunConfig.load_from_yaml(run_config_path, 's1_cslc_radar')
cfg = RunConfig.load_from_yaml(run_config_path, "s1_cslc_radar")

if cfg.is_reference:
# reference burst - run rdr2geo and archive it
Expand All @@ -35,13 +40,13 @@ def run(run_config_path: str, grid_type: str):
s1_geo2rdr.run(cfg)
s1_resample.run(cfg)

elif grid_type == 'geo':
elif grid_type == "geo":
# CSLC workflow in geo-coordinates
# get a runconfig dict from command line arguments
cfg = GeoRunConfig.load_from_yaml(run_config_path, 's1_cslc_geo')
cfg = GeoRunConfig.load_from_yaml(run_config_path, "s1_cslc_geo")

# Check if product_type is CSLC-S1, and produce product only
if cfg.product_type == 'CSLC_S1':
if cfg.product_type == "CSLC_S1":
s1_geocode_slc.run(cfg)
else:
s1_static_layers.run(cfg)
Expand All @@ -54,5 +59,5 @@ def main():


if __name__ == "__main__":
'''run s1_cslc from command line'''
"""run s1_cslc from command line"""
main()
Loading