Test Workflow #148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pick a random pair to run once per day | |
name: Test Workflow | |
on: | |
workflow_dispatch: | |
schedule: | |
# Run once per day at midnight | |
- cron: "0 0 * * *" | |
jobs: | |
searchASF: | |
runs-on: ubuntu-latest | |
outputs: | |
REFERENCE: ${{ steps.asf-search.outputs.REFERENCE }} | |
SECONDARY: ${{ steps.asf-search.outputs.SECONDARY }} | |
BURSTID: ${{ steps.asf-search.outputs.BURSTID }} | |
POLARIZATION: ${{ steps.asf-search.outputs.POLARIZATION }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Conda environment with Micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
cache-environment: true | |
environment-file: environment.yml | |
# https://words.yuvi.in/post/python-in-github-actions/ | |
- name: Search ASF for bursts | |
id: asf-search | |
shell: bash -el -c "python -u {0}" | |
run: | | |
import asf_search as asf | |
import geopandas as gpd | |
import json | |
import os | |
gfa = gpd.read_file('nepal.geojson') | |
results = asf.search(platform=[asf.PLATFORM.SENTINEL1], | |
processingLevel=asf.PRODUCT_TYPE.BURST, | |
intersectsWith=str(gfa.geometry.values[0]), | |
start="2024-01-01", | |
end="2025-01-01", | |
) | |
gf = gpd.GeoDataFrame.from_features(results.geojson(), crs=4326) | |
gf['fullBurstID'] = gf.burst.str['fullBurstID'] | |
random_burst = gf.fullBurstID.sample(1).values[0] | |
acquisitions = gf[gf.fullBurstID == random_burst] | |
random_pol = acquisitions.polarization.sample(1).values[0] | |
pair = acquisitions[acquisitions.polarization == random_pol].sample(2) | |
# Original SLC names | |
reference, secondary = pair.additionalUrls.apply(lambda x: x[0].split('/')[3]) | |
# Save Environment Variables for Next Job | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
print(f'REFERENCE={reference}', file=f) | |
print(f'SECONDARY={secondary}', file=f) | |
print(f'BURSTID={random_burst}', file=f) | |
print(f'POLARIZATION={random_pol}', file=f) | |
hyp3-isce2: | |
needs: searchASF | |
uses: ./.github/workflows/insar_pair.yml | |
with: | |
reference: ${{ needs.searchASF.outputs.REFERENCE }} | |
secondary: ${{ needs.searchASF.outputs.SECONDARY }} | |
burstId: ${{ needs.searchASF.outputs.BURSTID }} | |
polarization: ${{ needs.searchASF.outputs.POLARIZATION }} | |
looks: 20x4 | |
jobname: ${{ needs.searchASF.outputs.BURSTID }} | |
environment: testing | |
secrets: inherit |