Skip to content

Commit

Permalink
feat(data-pipeline): add sss dataset (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach authored Apr 28, 2020
1 parent 12d33ab commit 01a759c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 13 deletions.
5 changes: 4 additions & 1 deletion ci/cloudbuild-tiles-reproject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ steps:
args:
- "./data/gdal-reproject.sh"
- "${_VARIABLE_ID}"
- "${_MIN_LON} ${_MIN_LAT} ${_MAX_LON} ${_MAX_LAT}"
- "${_ZOOM_LEVELS}"
- "${_MIN_LON} ${_MIN_LAT} ${_MAX_LON} ${_MAX_LAT}"
- "${_SOURCE_PROJECTION}"
- "${_SOURCE_MIN_X} ${_SOURCE_MAX_Y} ${_SOURCE_MAX_X} ${_SOURCE_MIN_Y}"

- name: gcr.io/esa-climate-from-space/tile-mover
id: 'prepare-upload'
Expand All @@ -40,6 +42,7 @@ steps:
- "gs://esa-cfs-tiles/${_VERSION}/${_LAYER_ID}/"

options:
substitution_option: 'ALLOW_LOOSE'
diskSizeGb: 50
volumes:
- name: 'vol1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BASE_URL="ftp://anon-ftp.ceda.ac.uk/neodc/esacci/sea_surface_salinity/data/v01.8
START_DATE=2010-01-01
OUTPUT_FODLER=./download

for i in {0..3}
for i in {0..5}
do
NEXT_YEAR=$(date +%Y -d "$START_DATE + $i month")
NEXT_DATE=$(date +%Y%m%d -d "$START_DATE + $i month")
Expand Down
8 changes: 2 additions & 6 deletions data/gdal-colors/colors-sss.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
100 0 0 255
80 0 155 100
60 100 155 0
40 255 255 0
20 155 255 0
1 0 255 0
50 0 255 0
1 255 0 0
nv 0 255 255 0
21 changes: 18 additions & 3 deletions data/gdal-reproject.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
#!/usr/bin/env bash

VARIABLE=$1
BOUNDS=$2
ZOOM_LEVELS=$3
ZOOM_LEVELS=$2
OUT_BOUNDS=$3
SOURCE_PROJECTION=$4
SOURCE_BOUNDS=$5
TRIMMED_SOURCE_BOUNDS=$(echo $SOURCE_BOUNDS | sed 's/ *$//g')
FOLDER=/data/netcdfs/
counter=0

for file in $(find $FOLDER -name *.nc -type f | sort -n); do
echo "--------------"
echo $file

if [ ! -z "$SOURCE_PROJECTION" ] && [ ! -z "$TRIMMED_SOURCE_BOUNDS" ]
then
echo "Updating projection information"
# if defined set projection and bounds in netcdf file
gdal_translate \
-of NETCDF \
-a_srs $SOURCE_PROJECTION \
-a_ullr $TRIMMED_SOURCE_BOUNDS \
NETCDF:\"$file\":$VARIABLE \
$file
fi

gdalwarp \
-t_srs EPSG:4326 \
-te $BOUNDS \
-te $OUT_BOUNDS \
NETCDF:\"$file\":$VARIABLE \
./tmp.tif

Expand Down
13 changes: 11 additions & 2 deletions data/triggers/sea_surface_salinity_sss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ VERSION="test"
ZOOM_LEVELS="0-3"
MIN="auto"
MAX="auto"
MIN_LON="-180"
MAX_LON="180"
MIN_LAT="-90"
MAX_LAT="90"
SOURCE_PROJECTION="EPSG:3410"
SOURCE_MIN_X="-17324563.84"
SOURCE_MAX_X="17324563.84"
SOURCE_MIN_Y="-7338939.46"
SOURCE_MAX_Y="7338939.46"
MACHINE_TYPE="N1_HIGHCPU_8"

if [ ! -f ./package.json ]; then
Expand All @@ -15,7 +24,7 @@ if [ ! -f ./package.json ]; then
fi

# --machine-type=$MACHINE_TYPE \
gcloud builds submit --config ./ci/cloudbuild-tiles.yaml \
gcloud builds submit --config ./ci/cloudbuild-tiles-reproject.yaml \
--timeout=$TIMEOUT \
--substitutions _LAYER_ID=$LAYER_ID,_VARIABLE_ID=$VARIABLE_ID,_ZOOM_LEVELS=$ZOOM_LEVELS,_VERSION=$VERSION,_MIN=$MIN,_MAX=$MAX \
--substitutions _LAYER_ID=$LAYER_ID,_VARIABLE_ID=$VARIABLE_ID,_ZOOM_LEVELS=$ZOOM_LEVELS,_VERSION=$VERSION,_MIN=$MIN,_MAX=$MAX,_MIN_LON=$MIN_LON,_MAX_LON=$MAX_LON,_MIN_LAT=$MIN_LAT,_MAX_LAT=$MAX_LAT,_SOURCE_PROJECTION=$SOURCE_PROJECTION,_SOURCE_BOUNDS=$SOURCE_BOUNDS,_SOURCE_MIN_X=$SOURCE_MIN_X,_SOURCE_MAX_X=$SOURCE_MAX_X,_SOURCE_MIN_Y=$SOURCE_MIN_Y,_SOURCE_MAX_Y=$SOURCE_MAX_Y \
.
6 changes: 6 additions & 0 deletions storage/layers/layers-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,11 @@
"name": "Land Cover - lccs_class",
"description": "Das ist der ...",
"link": "http://..."
},
{
"id": "sea_surface_salinity.sss",
"name": "Sea Surface Salinity - sss",
"description": "Das ist der ...",
"link": "http://..."
}
]
6 changes: 6 additions & 0 deletions storage/layers/layers-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,11 @@
"name": "Land Cover - lccs_class",
"description": "This is the ...",
"link": "http://..."
},
{
"id": "sea_surface_salinity.sss",
"name": "Sea Surface Salinity - sss",
"description": "This is the ...",
"link": "http://..."
}
]

0 comments on commit 01a759c

Please sign in to comment.