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

Include hls-vi tools. #162

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a6dfb94
Include hls-vi tools.
sharkinsspatial Jun 20, 2024
56f5b5e
Remove unecessary vi_bucket env variable.
sharkinsspatial Jun 20, 2024
1ade982
Fix incorrect vi inputdir arg.
sharkinsspatial Jun 20, 2024
7e59a5e
Use new version of hls-vi that will non-wheel rasterio from container.
sharkinsspatial Jun 21, 2024
6abc2fb
Use hls-vi 1.3 to handle dataclass dependency for Python 3.6.
sharkinsspatial Jun 21, 2024
47aa7ad
Update hls-vi with correct option parsing.
sharkinsspatial Jun 24, 2024
0f947e3
Update vi_generate_indices short idstring param.
sharkinsspatial Jun 25, 2024
b410d15
Update hls-vi to 1.5 for correct metadata tag names.
sharkinsspatial Jun 26, 2024
140a075
Include VI manifest for LPDAAC notification.
sharkinsspatial Jul 9, 2024
4c90a95
Update hls-vi to 1.7.
sharkinsspatial Jul 25, 2024
04ae839
Update hls-vi to 1.8 to handle end date padding correction.
sharkinsspatial Aug 2, 2024
34c61c8
Update hls-vi to 1.9 to handle lxml library incompatibility.
sharkinsspatial Aug 7, 2024
a5f0c97
Update hls-vi to 1.10 to handle schema packaging issue.
sharkinsspatial Aug 8, 2024
dae17ad
Update hls-vi to 1.11.
sharkinsspatial Aug 9, 2024
e93a0a5
Update hls-vi to 1.12.
sharkinsspatial Aug 12, 2024
825fb10
Update hls-vi to 1.13.
sharkinsspatial Aug 27, 2024
84a9ead
Update hls-vi to 1.14 and update VI output key structure.
sharkinsspatial Sep 19, 2024
7f8bf89
Update hls-vi util to 1.15 for metadata updates.
sharkinsspatial Nov 7, 2024
033a3ab
Bump hls-vi to v1.16 to include masking & metadata fixes
ceholden Jan 9, 2025
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
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,16 @@ RUN pip3 install --upgrade awscli
RUN pip3 install click==7.1.2
RUN pip3 install rio-cogeo==1.1.10 --no-binary rasterio --user
RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]

RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]

RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]

RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]
RUN pip3 install wheel
RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]
RUN pip3 install libxml2-python3
RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]
RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]
RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]
RUN pip3 install git+https://github.com/NASA-IMPACT/[email protected]


COPY ./scripts/* ${PREFIX}/bin/
ENV OMP_NUM_THREADS=4
Expand Down
37 changes: 33 additions & 4 deletions scripts/sentinel.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# shellcheck disable=SC2153
# shellcheck disable=SC1091
# shellcheck disable=SC1091
# Exit on any error
set -o errexit

Expand All @@ -10,6 +10,7 @@ bucket="$OUTPUT_BUCKET"
# shellcheck disable=SC2034
inputbucket="$INPUT_BUCKET"
workingdir="/var/scratch/${jobid}"
vidir="${workingdir}/vi"
bucket_role_arn="$GCC_ROLE_ARN"
debug_bucket="$DEBUG_BUCKET"
replace_existing="$REPLACE_EXISTING"
Expand Down Expand Up @@ -46,6 +47,7 @@ set_output_names () {
hlsversion="v2.0"
day_of_year=$(get_doy "${year}" "${month}" "${day}")
outputname="HLS.S30.${granulecomponents[5]}.${year}${day_of_year}${hms}.${hlsversion}"
vi_outputname="HLS-VI.S30.${granulecomponents[5]}.${year}${day_of_year}${hms}.${hlsversion}"
output_hdf="${workingdir}/${outputname}.hdf"
nbar_name="HLS.S30.${granulecomponents[5]}.${year}${day_of_year}.${hms}.${hlsversion}"
nbar_input="${workingdir}/${nbar_name}.hdf"
Expand All @@ -54,6 +56,7 @@ set_output_names () {
output_metadata="${workingdir}/${outputname}.cmr.xml"
output_stac_metadata="${workingdir}/${outputname}_stac.json"
bucket_key="s3://${bucket}/S30/data/${year}${day_of_year}/${outputname}${twinkey}"
vi_bucket_key="s3://${bucket}/S30_VI/data/${year}${day_of_year}/${vi_outputname}${twinkey}"
gibs_dir="${workingdir}/gibs"
gibs_bucket_key="s3://${gibs_bucket}/S30/data/${year}${day_of_year}"
# We also need to obtain the sensor for the Bandpass parameters file
Expand Down Expand Up @@ -171,7 +174,7 @@ create_thumbnail -i "$workingdir" -o "$output_thumbnail" -s S30

# Create metadata
echo "Creating metadata"
create_metadata "$output_hdf" --save "$output_metadata"
create_metadata "$output_hdf" --save "$output_metadata"

# Create STAC metadata
cmr_to_stac_item "$output_metadata" "$output_stac_metadata" \
Expand Down Expand Up @@ -202,7 +205,7 @@ if [ -z "$debug_bucket" ]; then
# Copy manifest to S3 to signal completion.
aws s3 cp "$manifest" "${bucket_key}/${manifest_name}" --profile gccprofile
else
# Create
# Create
# Convert intermediate hdf to COGs
hdf_to_cog "$resample30m" --output-dir "$workingdir" --product S30 --debug-mode
hdf_to_cog "$nbarIntermediate" --output-dir "$workingdir" --product S30 --debug-mode
Expand All @@ -227,7 +230,7 @@ for gibs_id_dir in "$gibs_dir"/* ; do
subtile_basename=$(basename "$xml" .xml)
subtile_manifest_name="${subtile_basename}.json"
subtile_manifest="${gibs_id_dir}/${subtile_manifest_name}"
gibs_id_bucket_key="$gibs_bucket_key/${gibsid}"
gibs_id_bucket_key="$gibs_bucket_key/${gibsid}"
echo "Gibs id bucket key is ${gibs_id_bucket_key}"

create_manifest "$gibs_id_dir" "$subtile_manifest" \
Expand All @@ -252,3 +255,29 @@ for gibs_id_dir in "$gibs_dir"/* ; do
fi
done
echo "All GIBS tiles created"

# Generate VI files
echo "Generating VI files"
vi_generate_indices -i "$workingdir" -o "$vidir" -s "$outputname"
vi_generate_metadata -i "$workingdir" -o "$vidir"

echo "Generating VI manifest"
vi_manifest_name="${vi_outputname}.json"
vi_manifest="${vidir}/${vi_manifest_name}"
create_manifest "$vidir" "$vi_manifest" "$vi_bucket_key" "HLSS30_VI" \
"$vi_outputname" "$jobid" false

if [ -z "$debug_bucket" ]; then
aws s3 cp "$vidir" "$vi_bucket_key" --exclude "*" --include "*.tif" \
--include "*.xml" --include "*.jpg" --include "*_stac.json" \
--profile gccprofile --recursive

# Copy vi manifest to S3 to signal completion.
aws s3 cp "$vi_manifest" "${vi_bucket_key}/${vi_manifest_name}" --profile gccprofile
else
# Copy all vi files to debug bucket.
echo "Copy files to debug bucket"
debug_bucket_key=s3://${debug_bucket}/${outputname}
aws s3 cp "$vidir" "$debug_bucket_key" --recursive --acl public-read
fi

Loading