-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data-pipeline): improve tiles and add greenhouse (#340)
* feat(data-pipeline): hide gsutil upload logs * feat(data-pipeline): use nearest neighbor filtering for gdalwarp * feat(data-pipeline): use dataset bounds from netcdf * feat(data-pipeline): add script to optionally mask values * feat(data-pipeline): add snow layer * feat(data-pipeline): add greenhouse
- Loading branch information
Showing
19 changed files
with
221 additions
and
11 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
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
URL="ftp://anon-ftp.ceda.ac.uk/neodc/esacci/biomass/data/agb/maps/2017/v1.0/netcdf/ESACCI-BIOMASS-L4-AGB-MERGED-100m-2017-fv1.0.nc" | ||
START_DATE=2017-01-01 | ||
OUTPUT_FODLER=./download | ||
|
||
FILENAME=$OUTPUT_FODLER/$(date +%Y%m%d -d "$START_DATE + $i month").nc | ||
echo $FTP_URL | ||
|
||
curl --silent $FTP_URL > $FILENAME | ||
|
||
python ./data/drop-unused-vars.py --file $FILENAME --variable AOD550_mean | ||
python ./data/add-time-coordinate.py --file $FILENAME --timestamp $NEXT_DATE |
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,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# gsutil -m cp gs://esa-cfs-cate-data/greenhouse.xch4/* ./download | ||
|
||
START_DATE=2003-01-01 | ||
OUTPUT_FODLER=./download | ||
|
||
for i in {0..191} | ||
do | ||
NEXT_MONTH=$(date +%Y-%m -d "$START_DATE + $i month") | ||
NEXT_DATE=$(date +%Y%m%d -d "$START_DATE + $i month") | ||
FILENAME=$OUTPUT_FODLER/xch4_$NEXT_MONTH.tif | ||
NETCDF=$OUTPUT_FODLER/$NEXT_DATE.nc | ||
echo $FILENAME | ||
|
||
python ./data/tif2netcdf.py --file $FILENAME --output $NETCDF --variable xch4 | ||
python ./data/mask-values.py --file $NETCDF --variable xch4 --min "-100" | ||
python ./data/add-time-coordinate.py --file $NETCDF --timestamp $NEXT_DATE | ||
done |
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,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
gsutil -m cp gs://esa-cfs-cate-data/greenhouse.xco2/* ./download | ||
|
||
START_DATE=2003-01-01 | ||
OUTPUT_FODLER=./download | ||
|
||
for i in {0..191} | ||
do | ||
NEXT_MONTH=$(date +%Y-%m -d "$START_DATE + $i month") | ||
NEXT_DATE=$(date +%Y%m%d -d "$START_DATE + $i month") | ||
FILENAME=$OUTPUT_FODLER/xco2_$NEXT_MONTH.tif | ||
NETCDF=$OUTPUT_FODLER/$NEXT_DATE.nc | ||
echo $FILENAME | ||
|
||
python ./data/tif2netcdf.py --file $FILENAME --output $NETCDF --variable xco2 | ||
python ./data/mask-values.py --file $NETCDF --variable xco2 --min "-100" | ||
python ./data/add-time-coordinate.py --file $NETCDF --timestamp $NEXT_DATE | ||
done |
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,4 @@ | ||
100 0 255 0 | ||
1 255 255 0 | ||
0 0 0 0 0 | ||
nv 0 255 255 0 |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
10000 255 255 0 | ||
10000 0 255 0 | ||
0 255 0 0 | ||
nv 0 255 255 0 |
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,4 @@ | ||
0.0000020082 255 255 0 | ||
0.00000175 0 255 0 | ||
0.0000015674 0 255 255 | ||
nv 0 255 255 0 |
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,3 @@ | ||
0.000426 255 0 0 | ||
0.000360 0 0 255 | ||
nv 0 255 255 0 |
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,13 @@ | ||
import xarray as xr | ||
import rasterio | ||
from argparse import ArgumentParser | ||
|
||
parser = ArgumentParser() | ||
parser.add_argument("-f", "--file", dest="file") | ||
parser.add_argument("-o", "--output", dest="output") | ||
parser.add_argument("-v", "--variable", dest="variable") | ||
args = parser.parse_args() | ||
|
||
da = xr.open_rasterio(args.file) | ||
ds = da.to_dataset(name=args.variable) | ||
ds.to_netcdf(args.output, format='NETCDF4', mode='w') |
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,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
TIMEOUT=2000 | ||
LAYER_ID="biomass.agb" | ||
VARIABLE_ID="agb" | ||
VERSION="0.4.1" | ||
ZOOM_LEVELS="0-7" | ||
MIN_LON="-180" | ||
MAX_LON="180" | ||
MIN_LAT="-60" | ||
MAX_LAT="80" | ||
MIN="0" | ||
MAX="100" | ||
MACHINE_TYPE="N1_HIGHCPU_32" | ||
|
||
if [ ! -f ./package.json ]; then | ||
echo "You have to be in the root folder of the project to run this script!" | ||
exit 1 | ||
fi | ||
|
||
gcloud builds submit --config ./ci/cloudbuild-tiles-reproject.yaml \ | ||
--machine-type=$MACHINE_TYPE \ | ||
--timeout=$TIMEOUT \ | ||
--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 \ | ||
. |
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,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
TIMEOUT=3000 | ||
LAYER_ID="greenhouse.xch4" | ||
VARIABLE_ID="xch4" | ||
VERSION="0.4.1" | ||
ZOOM_LEVELS="0-2" | ||
MIN_LON="-180" | ||
MAX_LON="180" | ||
MIN_LAT="-90" | ||
MAX_LAT="90" | ||
MIN="auto" | ||
MAX="auto" | ||
MACHINE_TYPE="N1_HIGHCPU_8" | ||
|
||
if [ ! -f ./package.json ]; then | ||
echo "You have to be in the root folder of the project to run this script!" | ||
exit 1 | ||
fi | ||
|
||
# --machine-type=$MACHINE_TYPE \ | ||
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,_MIN_LON=$MIN_LON,_MAX_LON=$MAX_LON,_MIN_LAT=$MIN_LAT,_MAX_LAT=$MAX_LAT \ | ||
. |
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,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
TIMEOUT=3000 | ||
LAYER_ID="greenhouse.xco2" | ||
VARIABLE_ID="xco2" | ||
VERSION="0.4.1" | ||
ZOOM_LEVELS="0-3" | ||
MIN_LON="-180" | ||
MAX_LON="180" | ||
MIN_LAT="-90" | ||
MAX_LAT="90" | ||
MIN="auto" | ||
MAX="auto" | ||
MACHINE_TYPE="N1_HIGHCPU_8" | ||
|
||
if [ ! -f ./package.json ]; then | ||
echo "You have to be in the root folder of the project to run this script!" | ||
exit 1 | ||
fi | ||
|
||
# --machine-type=$MACHINE_TYPE \ | ||
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,_MIN_LON=$MIN_LON,_MAX_LON=$MAX_LON,_MIN_LAT=$MIN_LAT,_MAX_LAT=$MAX_LAT \ | ||
. |
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