Skip to content

Commit

Permalink
initial commit of GCOV pipeline for ADE use
Browse files Browse the repository at this point in the history
  • Loading branch information
niemoell committed Nov 19, 2024
1 parent d9ab2ec commit abac269
Show file tree
Hide file tree
Showing 10 changed files with 1,245 additions and 80 deletions.
7 changes: 5 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: sar2-d2
channels:
- conda-forge
- nodefaults
- nodefaults # force everything to come from conda-forge channel
dependencies:
- isce3
- isce3=0.24.1 # R4.0.4 delivery
- python >=3.12
- pip:
- git+https://github.com/MAAP-Project/maap-py.git
- sardem # to download and crop the SRTM DEM

# # Used by conda lock
# platforms:
Expand Down
56 changes: 39 additions & 17 deletions nasa/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,41 @@ input_dir="${PWD}/input"
output_dir="${PWD}/output"

if [[ $# == 0 || "$1" == "-h" ]]; then
echo "usage: nasa/run.sh [-h] CALIBRATION_FILE LEFT BOTTOM RIGHT TOP
echo "usage: nasa/run.sh [-h] INPUT_FILE LEFT BOTTOM RIGHT TOP INPUT_PRODUCT_TYPE OUTPUT_PRODUCT_TYPE GCOV_POSTING
SAR2-D2: Synthetic Aperture Radar Remote Disturbance Detector
positional arguments:
CALIBRATION_FILE path to calibration file
LEFT left longitude of your desired bounding box
BOTTOM bottom latitude of your desired bounding box
RIGHT right longitude of your desired bounding box
TOP top latitude of your desired bounding box
options:
-h, --help show this help message and exit"
INPUT_FILE path to input file
LEFT left longitude of bounding box of the input file
BOTTOM bottom latitude of the input file
RIGHT right longitude of the input file
TOP top latitude of the input file
INPUT_PRODUCT_TYPE Product type of the input file. One of: 'alos1', 'l0b', 'rslc'.
Will be processed through the ALOS1->L0B->RSLC->GCOV pipeline,
ending with type specified by `out_type`.
OUTPUT_PRODUCT_TYPE Product type of the output file. One of: 'l0b', 'rslc', 'gcov'.
In combination with `in_type`, determines which processing steps
occur.
GCOV_POSTING Posting for pixel spacing for GCOV (square pixels). Must be
in units of EPSG 4326 (same as DEM and bbox coordinates)."
exit 1
fi

if test -d "${input_dir}"; then
# RUNNING IN DPS
#
# There is an `input` sub-directory of the current working directory, so assume the
# calibration file is the sole file within the `input` sub-directory that the DPS
# input file is the sole file within the `input` sub-directory that the DPS
# automatically downloaded for us, based upon the URL given as the value of the
# calibration_file job input.
# in_file job input.
ls -l "${input_dir}" >&2

calibration_file="$(ls "${input_dir}"/*)"
in_file="$(ls "${input_dir}"/*)"
bbox="$1"
in_type="$2"
out_type="$3"
posting="$4"
else
# RUNNING IN DEVELOPMENT ENVIRONMENT
#
Expand All @@ -42,21 +50,27 @@ else
# non-DPS environment, where there is no `input` directory since the DPS creates
# the `input` directory. In this case, we must pass a path to a "local" file,
# which can be a path to a file in a shared bucket in the ADE.
calibration_file="$1"
in_file="$1"

if [[ $# -eq 5 ]]; then
if [[ $# -eq 8 ]]; then
# Allow us to pass the coordinates as individual arguments, so we don't need to
# remember to put quotes around them:
#
# nasa/run.sh path/to/calibration-file LEFT BOTTOM RIGHT TOP
#
bbox="$2 $3 $4 $5"
in_type="$6"
out_type="$7"
posting="$8"
else
# Also allow us to put quotes around the 4 coordinates:
#
# nasa/run.sh path/to/calibration-file "LEFT BOTTOM RIGHT TOP"
#
bbox="$2"
in_type="$3"
out_type="$4"
posting="$5"
fi
fi

Expand All @@ -67,7 +81,15 @@ fi
# arguments.

# shellcheck disable=SC2086
"${basedir}"/bin/conda/run.sh python "${basedir}/sar2_d2/cli.py" \
--calibration-file "${calibration_file}" \
"${basedir}"/bin/conda/run.sh python "${basedir}/src/alos1_2_gcov/alos1_to_gcov.py" \
--in-file "${in_file}" \
--bbox ${bbox} \
--output-dir "${output_dir}"
--out-dir "${output_dir}" \
--in_type "${in_type}" \
--out_type "${out_type}" \
--gcov_posting "${posting}" \
# --dem /projects/alos1-dist/sar2-d2/nasa/output/dem.tif




633 changes: 633 additions & 0 deletions nasa/sar2d2_driver.ipynb

Large diffs are not rendered by default.

51 changes: 0 additions & 51 deletions sar2_d2/cli.py

This file was deleted.

10 changes: 0 additions & 10 deletions sar2_d2/sar2d2.py

This file was deleted.

File renamed without changes.
Loading

0 comments on commit abac269

Please sign in to comment.