Skip to content
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

switch over to opera-utils package #35

Merged
merged 1 commit into from
Nov 12, 2023
Merged
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
20 changes: 6 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,13 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: "23.10.1"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: black
- id: black-jupyter

- repo: https://github.com/PyCQA/flake8
rev: "6.1.0"
hooks:
- id: flake8

- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
hooks:
- id: isort
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, jupyter]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.1"
Expand Down
2 changes: 2 additions & 0 deletions conda-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
# - gdal>=3.5
# - h5py>=3.6
# - numpy>=1.20
# - opera-utils>=0.1.1
# - pydantic>=2.1
# - requests>=2.20
# - rich>=12.0
Expand All @@ -28,6 +29,7 @@ dependencies:
- gdal
- h5py
- numpy
- opera-utils
- pydantic>2.1
- pyproj>=3.3
- python-dateutil
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
dask>=2022.6.0
h5py>=3.6
numpy>=1.20
opera-utils>0.1.1
pandas
pydantic>=2
pyproj>=3.2
Expand Down
2 changes: 1 addition & 1 deletion scripts/prep_mintpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import numpy as np
import pyproj
from dolphin import io
from dolphin.opera_utils import OPERA_DATASET_ROOT
from dolphin.utils import full_suffix, get_dates
from mintpy.utils import arg_utils, ptime, readfile, writefile
from mintpy.utils.utils0 import calc_azimuth_from_east_north_obs
from opera_utils import OPERA_DATASET_ROOT

####################################################################################
EXAMPLE = """example:
Expand Down
2 changes: 1 addition & 1 deletion src/sweets/_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import rasterio as rio
from dolphin import io, stitching
from dolphin._types import Bbox
from dolphin.opera_utils import group_by_burst
from opera_utils import group_by_burst

from ._log import get_log
from ._types import Filename
Expand Down
2 changes: 1 addition & 1 deletion src/sweets/_missing_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_geodataframe(
"""
gslc_files = list(gslc_files) # make sure generator doesn't deplete after first run
if one_per_burst:
from dolphin.opera_utils import group_by_burst
from opera_utils import group_by_burst

burst_to_file_list = group_by_burst(gslc_files)
slc_files = [file_list[0] for file_list in burst_to_file_list.values()]
Expand Down
2 changes: 1 addition & 1 deletion src/sweets/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from dolphin import io, stitching, unwrap
from dolphin._types import Bbox
from dolphin.interferogram import Network
from dolphin.opera_utils import group_by_burst
from dolphin.utils import group_by_date, set_num_threads
from dolphin.workflows.config import YamlModel
from opera_utils import group_by_burst
from pydantic import ConfigDict, Field, field_validator, model_validator
from shapely import geometry, wkt

Expand Down
4 changes: 2 additions & 2 deletions src/sweets/interferogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from dask.distributed import Client
from dolphin import utils
from dolphin.io import DEFAULT_HDF5_OPTIONS, get_raster_xysize, load_gdal, write_arr
from dolphin.opera_utils import OPERA_DATASET_NAME
from opera_utils import OPERA_DATASET_NAME
from pydantic import BaseModel, Field, model_validator
from rich.progress import track

Expand Down Expand Up @@ -267,7 +267,7 @@ def _get_cli_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--slcs", nargs=2, metavar=("ref_slc_file", "sec_slc_file"), required=True
),
)
parser.add_argument("--dset", default=OPERA_DATASET_NAME)
parser.add_argument("-l", "--looks", type=int, nargs=2, default=(1, 1))
parser.add_argument(
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pre-commit
pytest
pytest-cov
pytest-xdist # parallel tests: https://pytest-xdist.readthedocs.io/en/latest/
ruff
Loading