-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into uv_at_last
- Loading branch information
Showing
18 changed files
with
296 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Add content_date_description to version_metadata | ||
Revision ID: 604bf4e66c2b | ||
Revises: ef3392e8e054 | ||
Create Date: 2024-10-31 16:52:56.571782 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
import sqlalchemy_utils | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '604bf4e66c2b' | ||
down_revision = 'ef3392e8e054' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('version_metadata', sa.Column('content_date_description', sa.String(), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('version_metadata', 'content_date_description') | ||
# ### end Alembic commands ### |
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
# | ||
# USAGE: _tiff_crosses_dateline.sh raster_file | ||
# | ||
# Prints the string "true" if the input raster will cross the dateline | ||
# when converting to EPSG:4326, "false" otherwise | ||
# | ||
# Needs GDAL 2.0+ and Python | ||
# | ||
# Credit: Slightly modified from https://gis.stackexchange.com/a/222341 | ||
|
||
|
||
if [ -z "${1}" ]; then | ||
echo -e "Error: No input raster file given.\n> USAGE: _tiff_crosses_dateline.sh raster_file" | ||
exit 1 | ||
fi | ||
|
||
# Get raster info, save it to a variable as we need it several times | ||
gdalinfo=$(gdalinfo "${1}" -json) | ||
|
||
# Exit if -json switch is not available | ||
if [ ! -z $(echo $gdalinfo | grep "^Usage:") ]; then | ||
echo -e "Error: GDAL command failed, Version 2.0+ is needed" | ||
exit 1 | ||
fi | ||
|
||
function jsonq { | ||
echo "${1}" | python -c "import json,sys; jdata = sys.stdin.read(); data = json.loads(jdata); print(data${2});" | ||
} | ||
|
||
ulx=$(jsonq "$gdalinfo" "['wgs84Extent']['coordinates'][0][0][0]") | ||
llx=$(jsonq "$gdalinfo" "['wgs84Extent']['coordinates'][0][1][0]") | ||
lrx=$(jsonq "$gdalinfo" "['wgs84Extent']['coordinates'][0][3][0]") | ||
urx=$(jsonq "$gdalinfo" "['wgs84Extent']['coordinates'][0][2][0]") | ||
|
||
crossing_dateline=false | ||
test $(python -c "print(${ulx}>${lrx})") = True && crossing_dateline=true | ||
test $(python -c "print(${llx}>${urx})") = True && crossing_dateline=true | ||
|
||
echo -n "${crossing_dateline}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# arguments: | ||
# $0 - The name of this script | ||
# $1 - local_src_file | ||
# $2 - local_warped_file | ||
# $3 - target_crs | ||
# $4 - remote target file | ||
|
||
if aws s3 ls "$4"; then | ||
echo "Remote target file $4 already exists, skipping..." | ||
exit 0 | ||
fi | ||
|
||
warp_options=("-co" "COMPRESS=DEFLATE" "-co" "TILED=yes") | ||
|
||
echo "Seeing if TIFF crosses the dateline" | ||
crosses="$(_tiff_crosses_dateline.sh $1)" | ||
if [ "${crosses}" = "true" ]; then | ||
echo "$1 crosses the dateline" | ||
warp_options+=("--config" "CENTER_LONG" "180") | ||
else | ||
echo "$1 does not cross the dateline" | ||
fi | ||
|
||
echo "Now warping $1 to $2" | ||
gdalwarp "$1" "$2" -t_srs "$3" "${warp_options[@]}" | ||
echo "Done warping $1 to $2" | ||
|
||
echo "Now uploading $2 to $4" | ||
aws s3 cp --no-progress "$2" "$4" | ||
echo "Done uploading $2 to $4" | ||
|
||
echo "Finally, deleting local files $1 and $2" | ||
rm "$1" "$2" | ||
echo "Done deleting local files $1 and $2" |
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
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
Oops, something went wrong.