Skip to content

Commit 38eab39

Browse files
authored
Merge pull request #615 from dbekaert/dev
2 parents d9fbf91 + 04d74a8 commit 38eab39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1283
-581
lines changed

.circleci/config.yml

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,91 @@
11
version: 2.1
2+
23
jobs:
34
build:
5+
parameters:
6+
python-version:
7+
type: string
48
docker:
59
- image: cimg/base:current
610
user: root
711
steps:
812
- checkout
13+
914
- run:
10-
name: Setup micromamba
15+
name: Install micromamba
16+
shell: /bin/bash -l
1117
command: |
1218
apt update --yes && apt-get upgrade --yes
1319
apt install -y --no-install-recommends wget ca-certificates git
14-
cd $HOME
20+
21+
cd ${HOME}
1522
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
23+
eval "$(${HOME}/bin/micromamba shell hook -s posix)"
1624
1725
- run:
18-
name: Setup environment
26+
name: Create RAiDER environment
27+
shell: /bin/bash -l
1928
command: |
20-
eval "$($HOME/bin/micromamba shell hook -s posix)"
29+
eval "$(${HOME}/bin/micromamba shell hook -s posix)"
30+
31+
PYTHON_VERSION="<< parameters.python-version >>"
32+
sed -i "/python>=/c\ - python=${PYTHON_VERSION}" environment.yml
2133
micromamba create -f environment.yml
34+
35+
- run:
36+
name: Install raider and check environment
37+
shell: /bin/bash -l
38+
command: |
39+
eval "$(${HOME}/bin/micromamba shell hook -s posix)"
2240
micromamba activate RAiDER
23-
pip install coveralls
24-
echo url: https://cds.climate.copernicus.eu/api/v2 > $HOME/.cdsapirc
25-
echo key: $cdsak >> $HOME/.cdsapirc
26-
27-
echo { > $HOME/.ecmwfapirc
28-
echo ' "url": "https://api.ecmwf.int/v1",' >> $HOME/.ecmwfapirc
29-
echo ' "email": "'$ecmwfu'",' >> $HOME/.ecmwfapirc
30-
echo ' "key": "'$ecmwfk'"' >> $HOME/.ecmwfapirc
31-
echo } >> $HOME/.ecmwfapirc
32-
33-
echo url: $NCUMloc > $HOME/.ncmrlogin
34-
echo username: $NCUMu >> $HOME/.ncmrlogin
35-
echo password: $NCUMp >> $HOME/.ncmrlogin
41+
42+
python -m pip install --no-deps .
43+
44+
python -c "import RAiDER; from RAiDER.delay import tropo_delay"
45+
python -c "import RAiDER; from RAiDER.interpolator import interp_along_axis"
3646
3747
python --version
3848
python -c "import numpy; print(numpy.__version__)"
3949
python -c "import pyproj; print(pyproj.__version__)"
50+
4051
- run:
41-
name: Install RAiDER and test the install
52+
name: Setup data stores
53+
shell: /bin/bash -l
4254
command: |
43-
eval "$($HOME/bin/micromamba shell hook -s posix)"
55+
eval "$(${HOME}/bin/micromamba shell hook -s posix)"
4456
micromamba activate RAiDER
45-
python -m pip install .
46-
python -c "import RAiDER; from RAiDER.delay import tropo_delay"
47-
python -c "import RAiDER; from RAiDER.interpolator import interp_along_axis"
57+
58+
python -c 'from RAiDER.models.credentials import setup_from_env; setup_from_env()'
59+
4860
- run:
4961
name: Run unit tests
5062
shell: /bin/bash -l
5163
command: |
52-
eval "$($HOME/bin/micromamba shell hook -s posix)"
64+
eval "$(${HOME}/bin/micromamba shell hook -s posix)"
5365
micromamba activate RAiDER
66+
5467
COV_OPTIONS=`python -c "import importlib;print(*(' --cov='+p for p in importlib.util.find_spec('RAiDER').submodule_search_locations))"`
55-
pytest -m "not long" test/ $COV_OPTIONS --cov-report=
68+
pytest -m "not long" test/ ${COV_OPTIONS} --cov-report=
69+
5670
- run:
5771
name: Report coverage
72+
shell: /bin/bash -l
5873
command: |
59-
eval "$($HOME/bin/micromamba shell hook -s posix)"
60-
micromamba activate RAiDER
61-
python .circleci/fix_coverage_paths.py .coverage $(pwd)/tools/RAiDER/
62-
coverage report -mi
63-
coveralls
74+
PYTHON_VERSION="<< parameters.python-version >>"
75+
if [ "${PYTHON_VERSION}" == "3.12" ]; then
76+
eval "$(${HOME}/bin/micromamba shell hook -s posix)"
77+
micromamba activate RAiDER
78+
79+
python -m pip install coveralls
80+
python .circleci/fix_coverage_paths.py .coverage ${PWD}/tools/RAiDER/
81+
coverage report -mi
82+
coveralls
83+
fi
84+
85+
workflows:
86+
all-tests:
87+
jobs:
88+
- build:
89+
matrix:
90+
parameters:
91+
python-version: ["3.9", "3.10", "3.11", "3.12"]

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ on:
1212

1313
jobs:
1414
call-version-info-workflow:
15-
uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.8.2
15+
uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.8.3
1616
with:
1717
python_version: '3.10'
1818

1919
call-docker-ghcr-workflow:
2020
needs: call-version-info-workflow
21-
uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.8.2
21+
uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.8.3
2222
with:
2323
version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }}
2424
release_branch: main

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ on:
1313

1414
jobs:
1515
call-changelog-check-workflow:
16-
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.8.2
16+
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.8.3
1717
secrets:
1818
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/labeled-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ on:
1212

1313
jobs:
1414
call-labeled-pr-check-workflow:
15-
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.8.2
15+
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.8.3

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
call-release-workflow:
10-
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.8.2
10+
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.8.3
1111
with:
1212
release_prefix: RAiDER
1313
develop_branch: dev

.github/workflows/tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
call-bump-version-workflow:
10-
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.8.2
10+
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.8.3
1111
with:
1212
user: dbekaert
1313
email: bekaertdavid@gmail.com

CHANGELOG.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
77
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
10+
## [0.4.6]
11+
12+
### Added
13+
* Adds an `s1_orbits.py` module which includes:
14+
* `get_orbits_from_slc_ids` to download the associated orbit files for a list of Sentinel-1 SLC IDs
15+
* `ensure_orbit_credentials` to ensure ESA CSDE credentials have been provides to download orbit files. This should be called before `sentineleof` is used to download orbits.
16+
* Adds a `setup_from_env` function to `models/credentials.py` which will pull *all* credentials needed for acquiring weather model data from environment variables and ensure the correct config file is written. This makes setting up credentials in CI pipelines significantly easier
17+
18+
### Changed
19+
* `sentineleof` upgraded to version 0.9.5 or later to (a) fetch orbits from ESA CDSE and (b) ensure that if CDSE fetch fails, code resorts to ASF orbit repository
20+
21+
### Fixes
22+
* RAiDER is now tested on Python version 3.9-3.12
23+
* All typehints are now Python 3.9 compatible
24+
* [607](https://github.com/dbekaert/RAiDER/issues/607): Python entrypoint loading is now compatible with Python 3.12
25+
* [610](https://github.com/dbekaert/RAiDER/issues/610): Sentinel-1 orbit availability due to ESA migrating Sentinel-1 orbit files from Copernicus Open Access Hub (Scihub) to the new Copernicus Data Space Ecosystem (CDSE)
26+
* make weather file directory when it doesn't exist
27+
* Ensures the `models/data/alaska.geojson.zip` file is packaged when building from the source tarball
28+
* Make ISCE3 an optional dependency in `s1_azimuth_timing.py`
29+
+ Added unit tests and removed unused and depracated functions
30+
31+
### Removed
32+
* `hyp3lib`, which was only used for downloading orbit fies, has been removed in favor of `sentineleof`
33+
934
## [0.4.5]
1035

11-
## Fixes
36+
### Fixes
1237
* [#583](https://github.com/dbekaert/RAiDER/issues/583): it appears that since the issues with geo2rdr cropped up during our processing campaign, there has been a new release of ISCE3 that resolves these failures with `geo2rdr` and the time interpolation that uses this ISCE3 routine.
1338
* [#584](https://github.com/dbekaert/RAiDER/issues/584): failed Raider step function in hyp3 job submission when HRRR model times are not available (even within the valid model range) - to resolve, we check availability of files when delay workflow called with a) azimuth_grid_interpolation and b) input to workflow is GUNW. If weather model files are unavailable and the GUNW is on s3, do nothing to GUNW (i.e. do not add tropo delay) and exit successfully. If weather model files are unavailable and the GUNW is on local disk, raise `ValueError`
1439
* [#587](https://github.com/dbekaert/RAiDER/issues/587): similar to 584 except added here to the mix is control flow in RAiDER.py passes over numerous exceptions in workflow. This is fixed identically as above.
1540
* [#596](https://github.com/dbekaert/RAiDER/issues/596): the "prefix" for aws does not include the final netcdf file name, just the sub-directories in the bucket and therefore extra logic must be added to determine the GUNW netcdf file name (and the assocaited reference/secondary dates). We proceed by downloading the data which is needed regardless. Tests are updated.
1641

17-
## Removed
42+
### Removed
1843
* Removes `update` option (either `True` or `False`) from calcGUNW workflow which asks whether the GUNW should be updated or not. In existing code, it was not being used/applied, i.e. previous workflow always updated GUNW. Removed input arguments related from respective functions so that it can be updated later.
1944

20-
## Added
45+
### Added
2146
* Allow for Hyp3 GUNW workflow with HRRR (i.e. specifying a gunw path in s3) to successfully exit if any of the HRRR model times required for `azimuth-time-grid` interpolation (which is default interpolatin method) are not available when using bucket inputs (i.e. only on the cloud)
2247
* For GUNW workflow, when model is HRRR, azimuth_time_grid interpolation used, and using a local GUNW, if requisite weather model files are not available for raise a ValueError (before processing)
2348
* Raise a value error if non-unique dates are given in the function `get_inverse_weights_for_dates` in `s1_azimuth_timing.py`
@@ -30,7 +55,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3055
* Ensures ISCE3 is `>=0.15.0`
3156
* Uses correct HyP3 S3 prefix conventions and filename suffix within test patches to improve readability of what tests are mocking (see comments in #597).
3257

33-
## Changed
58+
### Changed
3459
* Get only 2 or 3 model times required for azimuth-time-interpolation (previously obtained all 3 as it was easier to implement) - this ensures slightly less failures associated with HRRR availability. Importantly, if a acquisition time occurs during a model time, then we order by distance to the reference time and how early it occurs (so earlier times come first if two times are equidistant to the aquisition time).
3560
* Made test names in `test_GUNW.py` more descriptive
3661
* Numpy docstrings and general linting to modified function including removing variables that were not being accessed
@@ -40,11 +65,10 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4065
* Fixes tests for checking availability of HRRR due Issue #596 (above).
4166

4267
## [0.4.4]
43-
44-
## Fixes
4568
* For s1-azimuth-time interpolation, overlapping orbits when one orbit does not cover entire GUNW product errors out. We now ensure state-vectors are both unique and in order before creating a orbit object in ISCE3.
4669

4770
## [0.4.3]
71+
+ Bug fixes, unit tests, docstrings
4872
+ Prevent ray tracing integration from occuring at exactly top of weather model
4973
+ Properly expose z_ref (max integration height) parameter, and dont allow higher than weather model
5074
+ Min version for sentineleof for obtaining restituted orbits.

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,34 @@ If you get stuck at any point you can create an [issue on GitHub](https://github
1313
For more information on contributing to open source projects, [GitHub's own guide](https://guides.github.com/activities/contributing-to-open-source/)
1414
is a great starting point if you are new to version control.
1515

16+
## Optional Dependencies
17+
18+
In order to better support the NISAR SDS (see: [#533](https://github.com/dbekaert/RAiDER/issues/533)), RAiDER has some optional dependencies:
19+
20+
* ISCE3
21+
* Pandas
22+
* Rasterio
23+
* Progressbar
24+
25+
RAiDER distributes two conda packages, `raider-base` a lighter-weight package that does depend on the optional dependencies, and `raider` which includes all dependencies. When using, or adding new, optional dependenices in RAiDER, please follow this pattern:
26+
1. When you import the optional dependency, handle import errors like:
27+
```python
28+
try:
29+
import optional_dependency
30+
except ImportError:
31+
optional_dependency = None
32+
```
33+
Note: you *do not* need to delay imports until use with this pattern.
34+
2. At the top of any function/method that uses the optional dependency, throw if it's missing like:
35+
```python
36+
if optional_dependency is None:
37+
raise ImportError('optional_dependency is required for this function. Use conda to install optional_dependency')
38+
```
39+
3. If you want to add type hints for objects in the optional_dependency, use a forward declaration like:
40+
```python
41+
def function_that_uses_optional_dependency(obj: 'optional_dependency.obj'):
42+
```
43+
Note: the typehint is a string here.
1644

1745
## Git workflows ##
1846

environment.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@ dependencies:
1313
# For running
1414
- asf_search
1515
- boto3
16+
- cartopy
1617
- cdsapi
1718
- cfgrib
18-
- cmake
19-
- cxx-compiler
20-
- cython
2119
- dask
2220
- dem_stitcher>=2.3.1
2321
- ecmwf-api-client
22+
- h5netcdf
2423
- h5py
2524
- herbie-data
26-
- h5netcdf
27-
- hyp3lib
2825
- isce3>=0.15.0
2926
- jsonschema==3.2.0 # this is for ASF DAAC ingest schema validation
3027
- lxml
@@ -33,36 +30,39 @@ dependencies:
3330
- numpy
3431
- pandas
3532
- progressbar
36-
- pybind11
3733
- pydap>3.2.2
3834
- pyproj>=2.2.0
3935
- pyyaml
4036
- rasterio>=1.3.0
41-
- rioxarray
4237
- requests
38+
- rioxarray
4339
- s3fs
4440
- scipy>1.10.0
41+
- sentineleof>=0.9.5
4542
- shapely
46-
- sysroot_linux-64
4743
- tqdm
4844
- xarray
4945
# For packaging and testing
5046
- autopep8
47+
- cmake
48+
- cxx-compiler
49+
- cython
50+
- pybind11
5151
- pytest
52+
- pytest-console-scripts
5253
- pytest-cov
53-
- pytest-timeout
5454
- pytest-mock
55-
- pytest-console-scripts
56-
- setuptools_scm >=6.2
55+
- pytest-timeout
56+
- setuptools_scm>=6.2
57+
- sysroot_linux-64
5758
# For docs website
5859
- mkdocs
59-
- mkdocstrings
60-
- mkdocstrings-python
6160
- mkdocs-macros-plugin
6261
- mkdocs-material
6362
- mkdocs-material-extensions
64-
- sentineleof>=0.8.1
63+
- mkdocstrings
64+
- mkdocstrings-python
6565
# For RAiDER-docs
66-
- jupyterlab
6766
- jupyter_contrib_nbextensions
67+
- jupyterlab
6868
- wand

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ zip-safe = false
5858
where = ["tools"]
5959

6060
[tool.setuptools.package-data]
61-
"*" = ["*.yml", "*.yaml"]
61+
"*" = ["*.yml", "*.yaml", "*.zip"]
6262

6363
[tool.isort]
6464
known_first_party = "RAiDER"

0 commit comments

Comments
 (0)