Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110479328
project_GHI.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 26, 12:46
Size
1011 B
Mime Type
text/x-shellscript
Expires
Mon, Apr 28, 12:46 (2 d)
Engine
blob
Format
Raw Data
Handle
25817296
Attached To
R8800 solar_potential
project_GHI.sh
View Options
#!/bin/bash
##== User input
LAYER_DEPTH=$1
LAYER_NAME=$2
PROJ_METHOD=$3 # one of nearest, bilinear, bicubic
OUTFILE=$4
##== Constants
LOC=WSG84
MAP=PERMANENT
NULL_VAL=-9999
##== MAIN SCRIPT
# print inputs:
echo Layer information: depth = $1, name = $2
echo Interpolation method for projection: $3
echo Output file: $4
# project all layers into current coordinate system using given method
for ID in `seq 1 $LAYER_DEPTH`; do
echo $ID
r.proj location=$LOC mapset=$MAP input=$LAYER_NAME\.$ID method=$PROJ_METHOD --overwrite
done
# create sequence of layers in ascending order
LAYER_SEQ=$LAYER_NAME\.1
for ID in `seq 2 $LAYER_DEPTH`; do
LAYER_SEQ=$LAYER_SEQ\,$LAYER_NAME\.$ID
done
echo $LAYER_SEQ
# extend region in 3D for current length of input
g.region t=$LAYER_DEPTH b=0 -p3
# convert layers to 3D raster
r.to.rast3 input=$LAYER_SEQ output=$LAYER_NAME --overwrite
# save 3D raster in OUTFILE
r3.out.netcdf -p input=$LAYER_NAME output=$OUTFILE null=$NULL_VAL --overwrite
echo DONE
Event Timeline
Log In to Comment