Revision 161e277a
Added by selv in ga254@bulldogj almost 11 years ago
terrain/procedures/dem_variables/GEO_AREA/sc3_create_tif_area_shp_75arc-sec.sh | ||
---|---|---|
1 |
|
|
2 |
# script che funziona deve essere un po miglirato per tenerlo in stand alone. |
|
3 |
# converte una striscia shp in determinata projection e calcola l'area e riproduce la colonna n volte. |
|
4 |
|
|
5 |
# SR-ORG:28: lambert azimutha equal area |
|
6 |
# SR-ORG:6842: MODIS Sinusoidal |
|
7 |
# SR-ORG:6965: MODIS Sinusoidal |
|
8 |
# SR-ORG:6974: MODIS Sinusoidal # according to Adam this is the modis projection |
|
9 |
|
|
10 |
|
|
11 |
# create a tif whith one column |
|
12 |
# una colonna di numeri |
|
13 |
|
|
14 |
module load Tools/Python/2.7.3 |
|
15 |
module load Libraries/GDAL/1.10.0 |
|
16 |
module load Tools/PKTOOLS/2.4.2 |
|
17 |
module load Libraries/OSGEO/1.10.0 |
|
18 |
|
|
19 |
|
|
20 |
export INDIR=/home2/ga254/scratch/dem_bj/GEO_AREA |
|
21 |
|
|
22 |
echo "ncols 1" > $INDIR/asc/75arc-sec-IDcol.asc |
|
23 |
echo "nrows 86400" >> $INDIR/asc/75arc-sec-IDcol.asc |
|
24 |
echo "xllcorner -180" >> $INDIR/asc/75arc-sec-IDcol.asc |
|
25 |
echo "yllcorner -90" >> $INDIR/asc/75arc-sec-IDcol.asc |
|
26 |
echo "cellsize 0.00208333333333333333333" >> $INDIR/asc/75arc-sec-IDcol.asc |
|
27 |
|
|
28 |
awk ' BEGIN { |
|
29 |
for (row=1 ; row<=86400 ; row++) { |
|
30 |
for (col=1 ; col<=1 ; col++) { |
|
31 |
printf ("%i " , col+(row-1)*1 ) } ; printf ("\n") }}' >> $INDIR/asc/75arc-sec-IDcol.asc |
|
32 |
|
|
33 |
gdal_translate -ot UInt32 -a_srs $INDIR/prj/wgs84.prj $INDIR/asc/75arc-sec-IDcol.asc $INDIR/tif_col/75arc-sec-IDcol.tif |
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
# transform to shp and calculate the area |
|
38 |
|
|
39 |
rm $INDIR/shp/75arc-sec-IDcol.{shp,dbf,prj,shx} |
|
40 |
gdal_polygonize.py -f "ESRI Shapefile" $INDIR/tif_col/75arc-sec-IDcol.tif $INDIR/shp/75arc-sec-IDcol.shp |
|
41 |
|
|
42 |
|
|
43 |
# change projection and calculate the area |
|
44 |
|
|
45 |
rm $INDIR/shp/75arc-sec-IDcol-proj[1-9]*.* |
|
46 |
|
|
47 |
echo 28 6842 6965 6974 | xargs -n 1 -P 4 bash -c $' |
|
48 |
prj=$1 |
|
49 |
echo change proj wgs84 to $prj |
|
50 |
ogr2ogr -t_srs $INDIR/prj/$prj.prj $INDIR/shp/75arc-sec-IDcol-proj$prj.shp $INDIR/shp/75arc-sec-IDcol.shp |
|
51 |
$INDIR/scripts/addattr-area.py $INDIR/shp/75arc-sec-IDcol-proj$prj.shp Area |
|
52 |
ogrinfo -al $INDIR/shp/75arc-sec-IDcol-proj$prj.shp | grep Area | awk \'{ if (NF==4) print $4 }\' > $INDIR/asc/matrix_area_prj$prj.asc |
|
53 |
' _ |
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
# use the column matrix to create asi file and shift it |
|
58 |
# final tif 172800 * 86400 |
|
59 |
|
|
60 |
echo 28 6842 6965 6974 | xargs -n 1 -P 4 bash -c $' |
|
61 |
|
|
62 |
prj=$1 |
|
63 |
|
|
64 |
# create asc file 100 pixel large. |
|
65 |
|
|
66 |
echo "ncols 8640" > $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc |
|
67 |
echo "nrows 86400" >> $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc |
|
68 |
echo "xllcorner -180" >> $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc |
|
69 |
echo "yllcorner -90" >> $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc |
|
70 |
echo "cellsize 0.00208333333333333333333" >> $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc |
|
71 |
|
|
72 |
awk \'{if($1>0){for(ncols=1;ncols<=8640;ncols++) {printf("%i ",int($1))}; printf ("\\n")}}\' asc/matrix_area_prj$prj.asc >> $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc |
|
73 |
|
|
74 |
gdal_translate -ot UInt32 -co COMPRESS=LZW -a_srs $INDIR/prj/wgs84.prj $INDIR/asc/75arc-sec-AreaCol_prj$prj.asc $INDIR/tif_col/75arc-sec-AreaCol_prj$prj.tif |
|
75 |
|
|
76 |
' _ |
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
# shift the 75arc-sec-AreaCol.tif evry 8640 pixel |
|
81 |
|
|
82 |
for prj in 28 6842 6965 6974 ; do |
|
83 |
|
|
84 |
|
|
85 |
cp $INDIR/tif_col/75arc-sec-AreaCol_prj$prj.tif $INDIR/tif_col/75arc-sec-AreaCol_prj.tif |
|
86 |
|
|
87 |
seq 1 19 | xargs -n 1 -P 20 bash -c $' |
|
88 |
n=$1 |
|
89 |
ulx=$(awk -v n=$n \'BEGIN { print -180 + (0.00208333333333333333333 * n * 8640)}\') |
|
90 |
lrx=$(awk -v n=$n \'BEGIN { print -180 + (0.00208333333333333333333 * (n + 1 ) * 8640 )}\') |
|
91 |
gdal_translate -co COMPRESS=LZW -ot UInt32 -a_ullr $ulx +90 $lrx -90 $INDIR/tif_col/75arc-sec-AreaCol_prj.tif $INDIR/tif_col/75arc-sec-AreaCol_shift$n.tif |
|
92 |
|
|
93 |
' _ |
|
94 |
|
|
95 |
echo merging $prj |
|
96 |
|
|
97 |
cp $INDIR/tif_col/75arc-sec-AreaCol_prj.tif $INDIR/tif_col/75arc-sec-AreaCol_shift0.tif |
|
98 |
|
|
99 |
rm -f $INDIR/area_tif/75arc-sec-Area_prj${prj}merge*.tif |
|
100 |
|
|
101 |
echo 0 4 5 9 10 14 15 19 | xargs -n 2 -P 4 bash -c $' |
|
102 |
|
|
103 |
start=$1 |
|
104 |
end=$2 |
|
105 |
gdal_merge_bylines.py -co COMPRESS=LZW -o $INDIR/area_tif/75arc-sec-Area_prj$prj"merge$start.tif" $(for n in `seq $start $end` ; do echo $INDIR/tif_col/75arc-sec-AreaCol_shift$n.tif ; done) |
|
106 |
|
|
107 |
' _ |
|
108 |
|
|
109 |
rm -f $INDIR/area_tif/75arc-sec-Area_prj$prj.tif |
|
110 |
gdal_merge_bylines.py -co COMPRESS=LZW -o $INDIR/area_tif/75arc-sec-Area_prj$prj.tif $INDIR/area_tif/75arc-sec-Area_prj${prj}merge*.tif |
|
111 |
|
|
112 |
|
|
113 |
done |
|
114 |
|
|
115 |
|
|
116 |
|
terrain/procedures/dem_variables/HYDRO1k/sc1_reproj1km_bj.sh | ||
---|---|---|
1 |
|
|
2 |
# echo af as au eu na sa |
|
3 |
# echo eu | xargs -n 1 -P 6 bash /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/HYDRO1k/sc1_reproj1km_bj.sh |
|
4 |
|
|
5 |
INDIR=/lustre0/scratch/ga254/dem_bj/HYDRO1k |
|
6 |
CONT=$1 |
|
7 |
|
|
8 |
gdal_translate -stats -ot Int16 -a_nodata 32767 -co COMPRESS=LZW $INDIR/gt30h1k$CONT/${CONT}_dem.bil $INDIR/gt30h1k$CONT/${CONT}_dem.tif |
|
9 |
|
|
10 |
gdalwarp -ot Int16 -wt Int16 -srcnodata 32767 -dstnodata 32767 -multi -tr 0.0083333333333 0.0083333333333 -r cubic -co COMPRESS=LZW -t_srs /lustre0/scratch/ga254/dem_bj/GMTED2010/prj/4326.prj $INDIR/gt30h1k$CONT/${CONT}_dem.tif $INDIR/gt30h1k$CONT/${CONT}_dem_proj.tif -overwrite |
|
11 |
|
|
12 |
|
|
13 |
# get the proj4 string from the bil file non automatizzato perche lo spazio nella stringa interrompe lo script. |
|
14 |
# prj4=`gdalsrsinfo -o proj4 eu_dem.bil` |
|
15 |
|
|
16 |
if [ $CONT = af ] ; then |
|
17 |
gdal_translate -stats -ot UInt32 -a_nodata 4294957297 -a_srs "+proj=laea +lat_0=5 +lon_0=20 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs" $INDIR/gt30h1k$CONT/${CONT}_fa.bil $INDIR/gt30h1k$CONT/${CONT}_fa.tif |
|
18 |
fi |
|
19 |
|
|
20 |
if [ $CONT = as ] ; then |
|
21 |
gdal_translate -stats -ot UInt32 -a_nodata 4294957297 -a_srs "+proj=laea +lat_0=45 +lon_0=100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs" $INDIR/gt30h1k$CONT/${CONT}_fa.bil $INDIR/gt30h1k$CONT/${CONT}_fa.tif |
|
22 |
fi |
|
23 |
|
|
24 |
if [ $CONT = au ] ; then |
|
25 |
gdal_translate -stats -ot UInt32 -a_nodata 4294957297 -a_srs "+proj=laea +lat_0=-15 +lon_0=135 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs" $INDIR/gt30h1k$CONT/${CONT}_fa.bil $INDIR/gt30h1k$CONT/${CONT}_fa.tif |
|
26 |
fi |
|
27 |
|
|
28 |
if [ $CONT = eu ] ; then |
|
29 |
gdal_translate -stats -ot UInt32 -a_nodata 4294957297 -a_srs "+proj=laea +lat_0=55 +lon_0=20 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs" $INDIR/gt30h1k$CONT/${CONT}_fa.bil $INDIR/gt30h1k$CONT/${CONT}_fa.tif |
|
30 |
fi |
|
31 |
|
|
32 |
if [ $CONT = na ] ; then |
|
33 |
gdal_translate -stats -ot UInt32 -a_nodata 4294957297 -a_srs "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs" $INDIR/gt30h1k$CONT/${CONT}_fa.bil $INDIR/gt30h1k$CONT/${CONT}_fa.tif |
|
34 |
fi |
|
35 |
|
|
36 |
if [ $CONT = sa ] ; then |
|
37 |
gdal_translate -stats -ot UInt32 -a_nodata 4294957297 -a_srs "+proj=laea +lat_0=-15 +lon_0=-60 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs" $INDIR/gt30h1k$CONT/${CONT}_fa.bil $INDIR/gt30h1k$CONT/${CONT}_fa.tif |
|
38 |
fi |
|
39 |
|
|
40 |
gdalwarp -ot UInt32 -wt UInt32 -srcnodata 4294957297 -dstnodata 4294957297 -multi -tr 0.0083333333333 0.0083333333333 -r cubic -co COMPRESS=LZW -t_srs /lustre0/scratch/ga254/dem_bj/GMTED2010/prj/4326.prj $INDIR/gt30h1k$CONT/${CONT}_fa.tif $INDIR/gt30h1k$CONT/${CONT}_fa_proj.tif -overwrite |
terrain/procedures/dem_variables/HYDRO1k/sc2_reprojectiling_toEPSG4326_bj.sh | ||
---|---|---|
1 |
# rm /lustre0/scratch/ga254/stdout/* /lustre0/scratch/ga254/stderr/* |
|
2 |
# for file in /lustre0/scratch/ga254/dem_bj/HYDRO1k/gt30h1k??/??_fa.tif ; do qsub -v file1k=$file /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/HYDRO1k/sc2_reprojectiling_toEPSG4326_bj.sh ; done |
|
3 |
|
|
4 |
# bash /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/HYDRO1k/sc2_reprojectiling_toEPSG4326_bj.sh /lustre0/scratch/ga254/dem_bj/HYDRO1k/gt30h1keu/eu_fa.tif |
|
5 |
|
|
6 |
|
|
7 |
#PBS -S /bin/bash |
|
8 |
#PBS -q fas_normal |
|
9 |
#PBS -l mem=4gb |
|
10 |
#PBS -l walltime=4:00:00 |
|
11 |
#PBS -l nodes=1:ppn=4 |
|
12 |
#PBS -V |
|
13 |
#PBS -o /lustre0/scratch/ga254/stdout |
|
14 |
#PBS -e /lustre0/scratch/ga254/stderr |
|
15 |
|
|
16 |
#file1k=$1 |
|
17 |
export $file1k |
|
18 |
export CONT=`basename $file1k _fa.tif` |
|
19 |
export OUTDIR=/lustre0/scratch/ga254/dem_bj/HYDRO1k/tiles |
|
20 |
export INDIR=/lustre0/scratch/ga254/dem_bj/HYDRO1k |
|
21 |
|
|
22 |
echo processing $CONT |
|
23 |
|
|
24 |
ls /lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/be75_grd_tif_16overlap/?_?.tif | xargs -n 1 -P 10 bash -c $' |
|
25 |
file=$1 |
|
26 |
filename=`basename $file` |
|
27 |
INDIR=/lustre0/scratch/ga254/dem_bj/HYDRO1k |
|
28 |
OUTDIR=/lustre0/scratch/ga254/dem_bj/HYDRO1k/tiles |
|
29 |
|
|
30 |
gdalwarp -ot UInt32 -wt UInt32 -srcnodata 4294957297 -dstnodata 4294957297 -multi -te $(~/bin/getCorners4Gwarp $file) -tr 0.002083333333333 0.002083333333333 -r bilinear -co COMPRESS=LZW -t_srs /lustre0/scratch/ga254/dem_bj/GMTED2010/prj/4326.prj $INDIR/gt30h1k$CONT/${CONT}_fa.tif $OUTDIR/${CONT}_$filename -overwrite |
|
31 |
|
|
32 |
min=$(gdalinfo -mm $OUTDIR/${CONT}_$filename | grep Compute | awk \'{ gsub ("=,"," ") ; print int($1) }\') |
|
33 |
echo $min |
|
34 |
if [ "$min" = "" ] ; then |
|
35 |
rm -f $OUTDIR/${CONT}_$filename |
|
36 |
fi |
|
37 |
|
|
38 |
' - |
terrain/procedures/dem_variables/HYDRO1k/sc3_mergetiling_bj.sh | ||
---|---|---|
1 |
|
|
2 |
# cd /lustre0/scratch/ga254/dem_bj/HYDRO1k/tiles |
|
3 |
# get the file list to process |
|
4 |
# for file in ??_?_?.tif ; do echo ${file:3:8} ; done | sort | uniq -c | sort -k 1,1 -g | awk '{ if ($1>1) print $2 }' |
|
5 |
# |
|
6 |
|
|
7 |
|
|
8 |
# for file in 0_0.tif 2_2.tif 3_2.tif 4_1.tif 5_1.tif 5_2.tif 6_0.tif 6_1.tif 7_2.tif 8_1.tif 8_2.tif 6_2.tif ; do filename=`basename $file`; qsub -v filename=$filename /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/HYDRO1k/sc3_mergetiling_bj.sh ; done |
|
9 |
|
|
10 |
# rm /lustre0/scratch/ga254/stdout/* /lustre0/scratch/ga254/stderr/* |
|
11 |
|
|
12 |
#PBS -S /bin/bash |
|
13 |
#PBS -q fas_normal |
|
14 |
#PBS -l mem=4gb |
|
15 |
#PBS -l walltime=1:00:00 |
|
16 |
#PBS -l nodes=1:ppn=4 |
|
17 |
#PBS -V |
|
18 |
#PBS -o /lustre0/scratch/ga254/stdout |
|
19 |
#PBS -e /lustre0/scratch/ga254/stderr |
|
20 |
|
|
21 |
# load moduels |
|
22 |
|
|
23 |
module load Tools/Python/2.7.3 |
|
24 |
module load Libraries/GDAL/1.10.0 |
|
25 |
module load Tools/PKTOOLS/2.4.2 |
|
26 |
module load Libraries/OSGEO/1.10.0 |
|
27 |
|
|
28 |
INDIR=/lustre0/scratch/ga254/dem_bj/HYDRO1k/tiles |
|
29 |
|
|
30 |
pkmosaic -m minband $( for file in $INDIR/??_$filename ; do echo -i $file ; done ) -ot UInt32 -t 4294957297 -max 4294957295 -o $INDIR/$filename |
|
31 |
|
|
32 |
|
terrain/procedures/dem_variables/MOD44W/sc1_wget.sh | ||
---|---|---|
1 |
cd /lustre0/scratch/ga254/dem_bj/MOD44W/gz |
|
2 |
|
|
3 |
|
|
4 |
wget -m -A .gz ftp://ftp.glcf.umd.edu/modis/WaterMask/Collection_5/2000/ |
|
5 |
mv ftp.glcf.umd.edu/modis/WaterMask/Collection_5/2000/*/*.tif.gz . |
|
6 |
rm -r ftp.glcf.umd.edu |
|
7 |
|
|
8 |
ls *.gz | xargs -n 1 -P 40 bash -c $' |
|
9 |
gunzip $1 |
|
10 |
filename=`basename $1 .gz` |
|
11 |
mv /lustre0/scratch/ga254/dem_bj/MOD44W/gz/$filename /lustre0/scratch/ga254/dem_bj/MOD44W/tiles |
|
12 |
' _ |
|
13 |
|
terrain/procedures/dem_variables/gmted2010_rad/scripts_r_sun/create_location_gr.sh | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
# |
|
3 |
# Script to create a new GRASS LOCATION from a raster data set |
|
4 |
# |
|
5 |
# (c) Markus Neteler 2002, ITC-irst, Trento |
|
6 |
# V 1.1 2003 |
|
7 |
# |
|
8 |
# Giuseppe Amatulli modify it for the grass64 version |
|
9 |
# |
|
10 |
# This program is Free Software under the GNU GPL (>=v2). |
|
11 |
# create a new LOCATION from a raster data set |
|
12 |
# Reference: |
|
13 |
# Markus Neteler and Helena Mitasova: |
|
14 |
# Open Source GIS: A GRASS GIS Approach. |
|
15 |
# Kluwer Academic Publishers, Boston, Dordrecht, 464 pp, |
|
16 |
# ISBN: 1-4020-7088-8, http://mpa.itc.it/grasstutor/ |
|
17 |
# |
|
18 |
# The trick: |
|
19 |
# The script generates a temp LOCATION for a fake GRASS session, then |
|
20 |
# uses r.in.gdal to generate the target LOCATION with new raster |
|
21 |
# data set. Check data first with 'gdalinfo <dataset>'. |
|
22 |
|
|
23 |
#customize path to GRASS start script, if needed: |
|
24 |
# GRASSSTARTSCRIPT=/usr/local/bin/grass5 |
|
25 |
GRASSSTARTSCRIPT=/usr/bin/grass64 |
|
26 |
|
|
27 |
########## nothing to change below ############################## |
|
28 |
MAP=$1 |
|
29 |
LOCATION=$2 |
|
30 |
MYGISDBASE=$3 |
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
if [ $# -lt 2 ] ; then |
|
35 |
echo "Script to create a new LOCATION from a raster data set" |
|
36 |
echo "Usage:" |
|
37 |
echo " create_location.sh rasterfile newlocation_name [GISDBASE]" |
|
38 |
echo "" |
|
39 |
echo " rasterfile: file to be imported (GeoTIFF, LANDSAT, ...)" |
|
40 |
echo " newlocation_name: new location to be created" |
|
41 |
echo " GISDBASE: full path to GRASS database directory (optional)" |
|
42 |
echo " e.g. $HOME/grassdata" |
|
43 |
echo "" |
|
44 |
exit 1 |
|
45 |
fi |
|
46 |
|
|
47 |
if test -f $HOME/.gislock5 ; then |
|
48 |
echo "ERROR. GRASS 6.0 is already running" |
|
49 |
echo "Please close other session first." |
|
50 |
exit 1 |
|
51 |
fi |
|
52 |
|
|
53 |
|
|
54 |
#get GISBASE from GRASS start script: |
|
55 |
GRASSSTARTSCRIPTPATH=`type -p $GRASSSTARTSCRIPT` |
|
56 |
if [ "$GRASSSTARTSCRIPTPATH" = "" ] ; then |
|
57 |
echo "ERROR. Cannot find '$GRASSSTARTSCRIPT' in path" |
|
58 |
exit 1 |
|
59 |
fi |
|
60 |
|
|
61 |
|
|
62 |
GISBASE=`cat $GRASSSTARTSCRIPTPATH | grep 'GISBASE=' | cut -d'=' -f2` |
|
63 |
if [ "$GISBASE" = "" ] ; then |
|
64 |
echo "ERROR. Cannot get GISBASE from '`type -p $GRASSSTARTSCRIPT`' script" |
|
65 |
exit 1 |
|
66 |
fi |
|
67 |
|
|
68 |
#get GISDBASE from previous session: |
|
69 |
if [ "$MYGISDBASE" = "" ] ; then |
|
70 |
GISDBASE=`grep GISDBASE $HOME/.grassrc6 | cut -d' ' -f2` |
|
71 |
if [ "$GISDBASE" = "" ] ; then |
|
72 |
echo "ERROR. Cannot get GISDBASE from $HOME/.grassrc6" |
|
73 |
echo "Please specify the GISDBASE parameter" |
|
74 |
exit 1 |
|
75 |
fi |
|
76 |
else |
|
77 |
GISDBASE=$MYGISDBASE |
|
78 |
fi |
|
79 |
|
|
80 |
if test -d $GISDBASE/$LOCATION ; then |
|
81 |
echo "ERROR. Location $LOCATION already exists in $GISDBASE" |
|
82 |
exit 1 |
|
83 |
fi |
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
#generate temporal LOCATION: |
|
88 |
TEMPDIR=$$.tmp |
|
89 |
mkdir -p $GISDBASE/$TEMPDIR/temp |
|
90 |
|
|
91 |
#save existing .grassrc6 |
|
92 |
if test -e $HOME/.grassrc6 ; then |
|
93 |
mv $HOME/.grassrc6 /tmp/$TEMPDIR.grassrc6 |
|
94 |
fi |
|
95 |
echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6 |
|
96 |
echo "MAPSET: temp" >> $HOME/.grassrc6 |
|
97 |
echo "DIGITIZER: none" >> $HOME/.grassrc6 |
|
98 |
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6 |
|
99 |
|
|
100 |
export GISBASE=$GISBASE |
|
101 |
export GISRC=$HOME/.grassrc6 |
|
102 |
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts |
|
103 |
export LD_LIBRARY_PATH="$GISBASE/lib" |
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
# import raster map into new location |
|
108 |
r.in.gdal in=$MAP out=$MAP location=$LOCATION 2> error_gr.txt |
|
109 |
if [ $? -eq 1 ] ; then |
|
110 |
echo "An error occured. Stop." |
|
111 |
exit 1 |
|
112 |
fi |
|
113 |
|
|
114 |
#restore previous .grassrc5 |
|
115 |
if test -f /tmp/$TEMPDIR.grassrc6 ; then |
|
116 |
mv /tmp/$TEMPDIR.grassrc6 $HOME/.grassrc6 |
|
117 |
fi |
|
118 |
|
|
119 |
#cleanup: |
|
120 |
rm -rf $GISDBASE/$TEMPDIR |
|
121 |
|
|
122 |
echo "Now you can launch GRASS with:" |
|
123 |
echo " grass64 -text $GISDBASE/$LOCATION/PERMANENT" |
|
124 |
echo "and continue to import further data sets." |
terrain/procedures/dem_variables/gmted2010_rad/scripts_r_sun/sc1a_convert_hdf_albedo.sh | ||
---|---|---|
1 |
# run before the xargs |
|
2 |
# cd /mnt/data2/scratch/GMTED2010/MODALB/ |
|
3 |
# tar xvf 0.3_5.0.um.00-04.WS.c004.v2.0.tar |
|
4 |
# cd 0.3_5.0.um.00-04.WS.c004.v2.0 |
|
5 |
# for file in *.gz ; do echo $file ; gunzip $file ; done |
|
6 |
# INDIR=/mnt/data2/scratch/GMTED2010/MODALB/0.3_5.0.um.00-04.WS.c004.v2.0 |
|
7 |
# ls $INDIR/*.hdf | xargs -n 1 -P 8 bash /mnt/data2/scratch/GMTED2010/scripts/sc1_convert_hdf.sh |
|
8 |
|
|
9 |
|
|
10 |
INDIR=/mnt/data2/scratch/GMTED2010/MODALB/0.3_5.0.um.00-04.WS.c004.v2.0 |
|
11 |
cd $INDIR |
|
12 |
|
|
13 |
file=$1 |
|
14 |
echo $file |
|
15 |
|
|
16 |
filename=$(basename $file .hdf) |
|
17 |
|
|
18 |
# this actino create a |
|
19 |
# Upper Left (-179.9916687, 89.9916687) |
|
20 |
# Lower Left (-179.9916687, -89.9916611) |
|
21 |
# Upper Right ( 179.9916687, 89.9916687) |
|
22 |
# Lower Right ( 179.9916687, -89.9916611) |
|
23 |
# gdal_translate -of AAIGrid HDF4_SDS:UNKNOWN:"${filename}.hdf":1 ${filename}_X.asc |
|
24 |
# gdal_translate -of AAIGrid HDF4_SDS:UNKNOWN:"${filename}.hdf":0 ${filename}_Y.asc |
|
25 |
# rm ${filename}_X.asc.aux.xml ${filename}_Y.asc.aux.xml |
|
26 |
|
|
27 |
# ulx=$(awk '{ if (NR==6) print $1 }' ${filename}_X.asc) |
|
28 |
# lrx=$(awk '{ if (NR==6) print $NF }' ${filename}_X.asc) |
|
29 |
|
|
30 |
# uly=$(awk '{ if (NR==6) print $1 }' ${filename}_Y.asc) |
|
31 |
# lry=$(awk '{ if (NR==6) print $NF }' ${filename}_Y.asc) |
|
32 |
|
|
33 |
# so in the end decide to run as fix paramaters |
|
34 |
|
|
35 |
ulx=-180 |
|
36 |
lrx=+180 |
|
37 |
|
|
38 |
uly=+90 |
|
39 |
lry=-90 |
|
40 |
|
|
41 |
gdal_translate -a_nodata 32767 -a_srs EPSG:4326 -ot Int16 -co COMPRESS=LZW -co ZLEVEL=9 -a_ullr $ulx $uly $lrx $lry $file $INDIR/$filename.tif |
|
42 |
|
|
43 |
|
terrain/procedures/dem_variables/gmted2010_rad/scripts_r_sun/sc1b_dayly_albedo.sh | ||
---|---|---|
1 |
# calculate the albdedo days based on linear trend between 2 estimation |
|
2 |
# echo 001 017 033 049 065 081 097 113 129 145 161 177 193 209 225 241 257 273 289 305 321 337 353 | xargs -n 1 -P 10 bash /mnt/data2/scratch/GMTED2010/scripts/sc1b_dayly_albedo.sh |
|
3 |
|
|
4 |
INDIR=/mnt/data2/scratch/GMTED2010/MODALB/0.3_5.0.um.00-04.WS.c004.v2.0 |
|
5 |
OUTDIR=/mnt/data2/scratch/GMTED2010/MODALB/0.3_5.0.um.00-04.WS.c004.v2.0_day_estimation |
|
6 |
|
|
7 |
file=AlbMap.WS.c004.v2.0.00-04.$1.0.3_5.0.tif |
|
8 |
|
|
9 |
cp $INDIR/$file $OUTDIR/AlbMap.WS.c004.v2.0.00-04.$(expr $1 + 0 ).0.3_5.0.tif |
|
10 |
|
|
11 |
# to use the 001 for the 366 day |
|
12 |
if [ $1 = '353' ] ; then |
|
13 |
filend=$(expr $1 + 13) |
|
14 |
cp $INDIR/AlbMap.WS.c004.v2.0.00-04.001.0.3_5.0.tif $OUTDIR/AlbMap.WS.c004.v2.0.00-04.366.0.3_5.0.tif |
|
15 |
nseq=12 |
|
16 |
else |
|
17 |
filend=$(expr $1 + 16) |
|
18 |
if [ $filend -lt 99 ] ; then |
|
19 |
fileB=0$filend |
|
20 |
else |
|
21 |
fileB=$filend |
|
22 |
fi |
|
23 |
cp $INDIR/AlbMap.WS.c004.v2.0.00-04.$fileB.0.3_5.0.tif $OUTDIR/AlbMap.WS.c004.v2.0.00-04.$filend.0.3_5.0.tif |
|
24 |
nseq=15 |
|
25 |
fi |
|
26 |
|
|
27 |
echo start to process $1 |
|
28 |
|
|
29 |
for n in `seq 1 $nseq` ; do |
|
30 |
# decide to take out the 0 before the daynumber |
|
31 |
fileout=$(expr $1 + $n) |
|
32 |
echo processing day $fileout |
|
33 |
gdal_calc.py --co=COMPRESS=LZW --co=ZLEVEL=9 -A $INDIR/$file -B $OUTDIR/AlbMap.WS.c004.v2.0.00-04.$filend.0.3_5.0.tif --calc="( A + ((B-A) * 0.0625 * $n) )" --type Int16 --outfile=$OUTDIR/AlbMap.WS.c004.v2.0.00-04.$fileout.0.3_5.0.tif --overwrite |
|
34 |
done |
|
35 |
|
|
36 |
|
terrain/procedures/dem_variables/gmted2010_rad/scripts_r_sun/sc2_solar_radiation.sh | ||
---|---|---|
1 |
# cd /media/data/grassdb1/ |
|
2 |
# ls /mnt/data2/scratch/GMTED2010/tiles/mn75_grd_tif/?_?.tif | xargs -n 1 -P 10 bash /mnt/data2/scratch/GMTED2010/scripts/sc2_solar_radiation.sh |
|
3 |
|
|
4 |
file=`basename $1 .tif` |
|
5 |
|
|
6 |
time ( |
|
7 |
|
|
8 |
export file=`basename $1` |
|
9 |
export filename=`basename $file .tif` |
|
10 |
export INDIR=/media/data/grassdb1 |
|
11 |
|
|
12 |
rm -rf $INDIR/loc_$filename |
|
13 |
echo clip the data |
|
14 |
|
|
15 |
cd $INDIR |
|
16 |
|
|
17 |
# clip the 1km dem, use the be75_grd_tif to ensure larger overlap |
|
18 |
gdal_translate -projwin $(getCorners4Gtranslate /mnt/data2/scratch/GMTED2010/tiles/be75_grd_tif/$file) /media/data/grassdb1/mn30_grd_tif/mn30_grd.tif $file |
|
19 |
|
|
20 |
echo clip albedo by $file |
|
21 |
|
|
22 |
/mnt/data2/scratch/GMTED2010/scripts/create_location_gr.sh $file loc_$filename $INDIR |
|
23 |
|
|
24 |
# echo enter in grass |
|
25 |
|
|
26 |
echo "LOCATION_NAME: loc_$filename" > $HOME/.grassrc6$$ |
|
27 |
echo "MAPSET: PERMANENT" >> $HOME/.grassrc6$$ |
|
28 |
echo "DIGITIZER: none" >> $HOME/.grassrc6$$ |
|
29 |
echo "GRASS_GUI: text" >> $HOME/.grassrc6$$ |
|
30 |
echo "GISDBASE: /media/data/grassdb1" >> $HOME/.grassrc6$$ |
|
31 |
|
|
32 |
# path to GRASS binaries and libraries: |
|
33 |
|
|
34 |
export GISBASE=/usr/lib/grass64 |
|
35 |
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts |
|
36 |
export LD_LIBRARY_PATH="$GISBASE/lib" |
|
37 |
export GISRC=~/.grassrc6$$ |
|
38 |
|
|
39 |
g.gisenv |
|
40 |
|
|
41 |
g.list rast | head |
|
42 |
|
|
43 |
echo calculate r.slope.aspect |
|
44 |
r.slope.aspect elevation=$file aspect=aspect_$filename slope=slope_$filename |
|
45 |
|
|
46 |
# produce 12 maps |
|
47 |
# r.horizon elevin=$filename horizonstep=30 horizon=horangle dist=1 maxdistance=1000 |
|
48 |
|
|
49 |
|
|
50 |
for day in `seq 1 365` ; do |
|
51 |
|
|
52 |
# import albedo |
|
53 |
gdal_translate -a_nodata 32767 -projwin $(getCorners4Gtranslate /mnt/data2/scratch/GMTED2010/tiles/be75_grd_tif/$file) /mnt/data2/scratch/GMTED2010/MODALB/0.3_5.0.um.00-04.WS.c004.v2.0_day_estimation/AlbMap.WS.c004.v2.0.00-04.${day}.0.3_5.0.tif $INDIR/alb_WS/${filename}_albWS_day${day}.tif |
|
54 |
|
|
55 |
r.in.gdal -o input=$INDIR/alb_WS/${filename}_albWS_day${day}.tif output=${filename}_albWS_day${day} --overwrite |
|
56 |
r.mapcalc ${filename}_albWS_day${day}_coef = " ${filename}_albWS_day${day} * 0.001" |
|
57 |
|
|
58 |
# import Linke turbidity |
|
59 |
|
|
60 |
if [ $day -ge 1 ] && [ $day -le 31 ] ; then LT=January ; fi |
|
61 |
if [ $day -ge 32 ] && [ $day -le 59 ] ; then LT=February ; fi |
|
62 |
if [ $day -ge 60 ] && [ $day -le 90 ] ; then LT=March; fi |
|
63 |
if [ $day -ge 91 ] && [ $day -le 120 ] ; then LT=April ; fi |
|
64 |
if [ $day -ge 121 ] && [ $day -le 151 ] ; then LT=May ; fi |
|
65 |
if [ $day -ge 152 ] && [ $day -le 181 ] ; then LT=June ; fi |
|
66 |
if [ $day -ge 182 ] && [ $day -le 212 ] ; then LT=July ; fi |
|
67 |
if [ $day -ge 213 ] && [ $day -le 243 ] ; then LT=August ; fi |
|
68 |
if [ $day -ge 244 ] && [ $day -le 273 ] ; then LT=September ; fi |
|
69 |
if [ $day -ge 274 ] && [ $day -le 304 ] ; then LT=October ; fi |
|
70 |
if [ $day -ge 305 ] && [ $day -le 334 ] ; then LT=November ; fi |
|
71 |
if [ $day -ge 335 ] && [ $day -le 365 ] ; then LT=December ; fi |
|
72 |
|
|
73 |
gdal_translate -projwin $(getCorners4Gtranslate /mnt/data2/scratch/GMTED2010/tiles/be75_grd_tif/$file) /mnt/data2/scratch/GMTED2010/linke_turbidity/${LT}.tif /mnt/data2/scratch/GMTED2010/grassdb/linke_turbidity_clip/${LT}_${filename}_day${day}.tif |
|
74 |
|
|
75 |
r.in.gdal -o input=/mnt/data2/scratch/GMTED2010/grassdb/linke_turbidity_clip/${LT}_${filename}_day${day}.tif output=${LT}_${filename}_day${day} --overwrite |
|
76 |
rm -f /mnt/data2/scratch/GMTED2010/grassdb/linke_turbidity_clip/${LT}_${filename}_day${day}.tif |
|
77 |
|
|
78 |
r.mapcalc ${LT}_${filename}_day${day}_coef = "${LT}_${filename}_day${day} * 0.05 " |
|
79 |
|
|
80 |
echo run r.sun |
|
81 |
|
|
82 |
r.sun -s elevin=$file aspin=aspect_$filename slopein=slope_$filename linkein=${LT}_${filename}_day${day}_coef albedo=${filename}_albWS_day${day}_coef day=$day step=0.5 \ |
|
83 |
glob_rad=glob_rad_day$day"_"$filename \ |
|
84 |
diff_rad=diff_rad_day$day"_"$filename \ |
|
85 |
beam_rad=beam_rad_day$day"_"$filename \ |
|
86 |
refl_rad=refl_rad_day$day"_"$filename |
|
87 |
|
|
88 |
g.remove rast=${LT}_${filename}_day${day}_coef |
|
89 |
|
|
90 |
r.out.gdal -c type=Float32 nodata=-1 createopt="COMPRESS=LZW,ZLEVEL=9" input=glob_rad_day$day"_"$filename output=/media/data/grassdb1/glob_rad/${day}/glob_rad_day$day"_"$file |
|
91 |
r.out.gdal -c type=Float32 nodata=-1 createopt="COMPRESS=LZW,ZLEVEL=9" input=diff_rad_day$day"_"$filename output=/media/data/grassdb1/diff_rad/${day}/diff_rad_day$day"_"$file |
|
92 |
r.out.gdal -c type=Float32 nodata=-1 createopt="COMPRESS=LZW,ZLEVEL=9" input=beam_rad_day$day"_"$filename output=/media/data/grassdb1/beam_rad/${day}/beam_rad_day$day"_"$file |
|
93 |
r.out.gdal -c type=Float32 nodata=-1 createopt="COMPRESS=LZW,ZLEVEL=9" input=refl_rad_day$day"_"$filename output=/media/data/grassdb1/refl_rad/${day}/refl_rad_day$day"_"$file |
|
94 |
|
|
95 |
if [ ${filename:0:1} -eq 0 ] ; then |
|
96 |
# this was inserted becouse the r.out.gdal of the 0_? was overpassing the -180 border and it was attach the tile to the right border |
|
97 |
gdal_translate -a_ullr $(getCorners4Gtranslate $file) /media/data/grassdb1/glob_rad/${day}/glob_rad_day$day"_"$file /media/data/grassdb1/glob_rad/${day}/glob_rad_day$day"_"$file"_tmp" |
|
98 |
gdal_translate -a_ullr $(getCorners4Gtranslate $file) /media/data/grassdb1/diff_rad/${day}/diff_rad_day$day"_"$file /media/data/grassdb1/diff_rad/${day}/diff_rad_day$day"_"$file"_tmp" |
|
99 |
gdal_translate -a_ullr $(getCorners4Gtranslate $file) /media/data/grassdb1/beam_rad/${day}/beam_rad_day$day"_"$file /media/data/grassdb1/beam_rad/${day}/beam_rad_day$day"_"$file"_tmp" |
|
100 |
gdal_translate -a_ullr $(getCorners4Gtranslate $file) /media/data/grassdb1/refl_rad/${day}/refl_rad_day$day"_"$file /media/data/grassdb1/refl_rad/${day}/refl_rad_day$day"_"$file"_tmp" |
|
101 |
|
|
102 |
mv /media/data/grassdb1/glob_rad/${day}/glob_rad_day$day"_"$file"_tmp" /media/data/grassdb1/glob_rad/${day}/glob_rad_day$day"_"$file |
|
103 |
mv /media/data/grassdb1/diff_rad/${day}/diff_rad_day$day"_"$file"_tmp" /media/data/grassdb1/diff_rad/${day}/diff_rad_day$day"_"$file |
|
104 |
mv /media/data/grassdb1/beam_rad/${day}/beam_rad_day$day"_"$file"_tmp" /media/data/grassdb1/beam_rad/${day}/beam_rad_day$day"_"$file |
|
105 |
mv /media/data/grassdb1/refl_rad/${day}/refl_rad_day$day"_"$file"_tmp" /media/data/grassdb1/refl_rad/${day}/refl_rad_day$day"_"$file |
|
106 |
|
|
107 |
fi |
|
108 |
done |
|
109 |
|
|
110 |
rm -f $file ~/.grassrc6$$ |
|
111 |
|
|
112 |
) 2>&1 | tee /tmp/log_of_$file".txt" |
|
113 |
|
|
114 |
exit |
|
115 |
|
|
116 |
|
|
117 |
# To compute the |
|
118 |
|
|
119 |
# actual surface albedo, MODIS-estimated black sky albedo (reflectance of direct beam radiation at solar noon) |
|
120 |
# and white sky albedo (reflectance of isotropic diffuse radiation) |
|
121 |
|
|
122 |
|
|
123 |
# coefbh=string |
|
124 |
# Name of real-sky beam radiation coefficient (thick cloud) input raster map [0-1] |
|
125 |
# coefdh=string |
|
126 |
# Name of real-sky diffuse radiation coefficient (haze) input raster map [0-1] |
|
127 |
# κL is the extinction coefficient for diffuse radiation |
terrain/procedures/dem_variables/gmted2010_rad/scripts_r_sun/sc3_merge_solar_radiation.sh | ||
---|---|---|
1 |
|
|
2 |
# echo 001 017 033 049 065 081 097 113 129 145 161 177 193 209 225 241 257 273 289 305 321 337 353 | xargs -n 1 -P 4 bash /mnt/data2/scratch/GMTED2010/scripts/sc3_merge_solar_radiation.sh |
|
3 |
|
|
4 |
day=$1 |
|
5 |
INDIR=/media/data/grassdb1/glob_rad_$day |
|
6 |
|
|
7 |
rm -f $INDIR/glob_rad_day${day}.tif |
|
8 |
gdal_merge.py -n -1 -co COMPRESS=LZW -co ZLEVEL=9 -ul_lr -180 +90 +180 -90 -o $INDIR/glob_rad_day${day}.tif $INDIR/glob_rad_day${day}_?_?.tif |
|
9 |
|
|
10 |
|
terrain/procedures/dem_variables/gmted2010_rad/scripts_valid/nrel_station_shp.sh | ||
---|---|---|
1 |
cd /mnt/data2/scratch/GMTED2010/solar_radiation/nrel |
|
2 |
|
|
3 |
echo '"X","Y"' > /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.csv |
|
4 |
awk -F "," '{ if (NR>1) print $5","$4 }' /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv/TMY3_StationsMeta.csv >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.csv |
|
5 |
|
|
6 |
echo "<OGRVRTDataSource>" > /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
7 |
echo " <OGRVRTLayer name=\"point\">" >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
8 |
echo " <SrcDataSource>/mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.csv</SrcDataSource>" >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
9 |
echo " <GeometryType>wkbPoint</GeometryType>" >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
10 |
echo " <GeometryField encoding=\"PointFromColumns\" x=\"X\" y=\"Y\" /> " >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
11 |
echo " </OGRVRTLayer>" >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
12 |
echo "</OGRVRTDataSource>" >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
13 |
|
|
14 |
rm -f /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.shp |
|
15 |
ogr2ogr /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.shp /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/shp/point.vrt |
|
16 |
|
terrain/procedures/dem_variables/gmted2010_rad/scripts_valid/sc1_nrel_day_sum.sh | ||
---|---|---|
1 |
|
|
2 |
# cd /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv |
|
3 |
# ls /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv/*TY.csv | xargs -n 1 -P 10 bash /mnt/data2/scratch/GMTED2010/solar_radiation/scripts/sc1_nrel_day_sum.sh |
|
4 |
|
|
5 |
INDIR=/mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv |
|
6 |
file=$1 |
|
7 |
filename=$(basename $file .csv) |
|
8 |
|
|
9 |
awk -F "," '{ if(NR>2) { for (col=1;col<=NF-1;col++) {printf ("%s ", $col )} ; printf ("%s\n", $NF)}}' $INDIR/${filename}.csv | sort -k 1,1 -g > $INDIR/${filename}_s.txt |
|
10 |
|
|
11 |
/mnt/data2/scratch/GMTED2010/solar_radiation/scripts/sum.sh $INDIR/${filename}_s.txt $INDIR/${filename}_sum.txt <<EOF |
|
12 |
n |
|
13 |
1 |
|
14 |
0 |
|
15 |
EOF |
|
16 |
|
|
17 |
cat header.txt > $INDIR/${filename}_sumH.txt |
|
18 |
# inserted to remove the last space after NF |
|
19 |
awk '{ for (col=1;col<=(NF-1);col++) {printf ("%s ", $col )} ; printf ("%s\n", $NF) }' $INDIR/${filename}_sum.txt >> $INDIR/${filename}_sumH.txt |
|
20 |
rm $INDIR/${filename}_sum.txt $INDIR/${filename}_s.txt |
|
21 |
|
|
22 |
|
terrain/procedures/dem_variables/gmted2010_rad/scripts_valid/sc2_rad_extraction.sh | ||
---|---|---|
1 |
|
|
2 |
# cd /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv |
|
3 |
# ls /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv/*TY.csv | xargs -n 1 -P 10 bash /mnt/data2/scratch/GMTED2010/solar_radiation/scripts/sc2_rad_extraction.sh |
|
4 |
|
|
5 |
INDIR=/mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv |
|
6 |
file=$1 |
|
7 |
filename=$(basename $file .csv) |
|
8 |
|
|
9 |
LAT=$(grep ${filename:0:6} $INDIR/TMY3_StationsMeta.csv | awk -F "," '{ print $4 }') |
|
10 |
LON=$(grep ${filename:0:6} $INDIR/TMY3_StationsMeta.csv | awk -F "," '{ print $5 }') |
|
11 |
|
|
12 |
# echo $LON $LAT |
|
13 |
# check if the point fall inside the tile |
|
14 |
|
|
15 |
|
|
16 |
intile=$(gdallocationinfo -geoloc -wgs84 /mnt/data2/scratch/GMTED2010/grassdb/glob_rad/1/glob_rad_day1_2_1.tif $LON $LAT |tail -1 | awk '{ print $1}') |
|
17 |
|
|
18 |
# echo $intile |
|
19 |
|
|
20 |
if [ $intile = "Location" ] ; then |
|
21 |
exit |
|
22 |
else |
|
23 |
echo extract data from rad_grass_data using file $file |
|
24 |
rm -f /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/txt_grass_rad/${filename:0:6}_rad.txt |
|
25 |
for day in `seq 1 80` ; do |
|
26 |
echo $day $(gdallocationinfo -valonly -geoloc -wgs84 /mnt/data2/scratch/GMTED2010/grassdb/glob_rad/$day/glob_rad_day${day}_2_1.tif $LON $LAT) >> /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/txt_grass_rad/${filename:0:6}_rad.txt |
|
27 |
# gdallocationinfo -valonly -geoloc -wgs84 /mnt/data2/scratch/GMTED2010/grassdb/diff_rad/$day/diff_rad_day${day}_2_1.tif $LON $LAT |
|
28 |
# gdallocationinfo -valonly -geoloc -wgs84 /mnt/data2/scratch/GMTED2010/grassdb/beam_rad/$day/beam_rad_day${day}_2_1.tif $LON $LAT |
|
29 |
# gdallocationinfo -valonly -geoloc -wgs84 /mnt/data2/scratch/GMTED2010/grassdb/refl_rad/$day/refl_rad_day${day}_2_1.tif $LON $LAT |
|
30 |
done |
|
31 |
fi |
|
32 |
|
|
33 |
# paste <(awk '{ if ( NR>1 && NR<82 ) print $5 }' /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/csv/690190TY_sumH.txt) <( awk '{ print $2 }' /mnt/data2/scratch/GMTED2010/solar_radiation/nrel/txt_grass_rad/690190_rad.txt )> test.txt |
terrain/procedures/dem_variables/gmted2010_rad/scripts_valid/sum.sh | ||
---|---|---|
1 |
#!/bin/sh |
|
2 |
# derived by average.sh remove the /obs |
|
3 |
# calculate average of column txt files base on CLASS/ID column |
|
4 |
# the CLASS/ID column can be a number or a string |
|
5 |
# all the row and column are processed |
|
6 |
# in case no CLASS/ID column in the file crate a dummy variable (e.g 1 ) for all che row |
|
7 |
# the file has to be sorted base on the CLASS/ID column!!! |
|
8 |
# input_s.asc |
|
9 |
# ID V1 V2 V3 |
|
10 |
# 1 3 5 3 |
|
11 |
# 1 5 7 5 |
|
12 |
# 2 2 1 1 |
|
13 |
# output.asc |
|
14 |
# 1 4 6 4 |
|
15 |
# 2 2 1 1 |
|
16 |
# |
|
17 |
# $ $1 input.asc |
|
18 |
# $ $2 output.asc |
|
19 |
# e.g. sort -k 1,1 input.asc > input_s.asc |
|
20 |
# e.g. sh ~/sh/average.sh input_s.asc output.asc |
|
21 |
# in case of bash script use EOF sintax |
|
22 |
# sh ./average.sh input_s.asc output.asc <<EOF |
|
23 |
# y/n |
|
24 |
# 1/2/3/4/... |
|
25 |
# 1/2/3/4/... |
|
26 |
# EOF |
|
27 |
|
|
28 |
|
|
29 |
echo -n "The first row is an header (y/n) = " |
|
30 |
read header |
|
31 |
|
|
32 |
echo -n "Position of the master ClASS/ID column (1/2/3/4/....) = " |
|
33 |
read colID |
|
34 |
|
|
35 |
echo -n "Precision of the average results (Decimal number 1/2/3/... ) = " |
|
36 |
read Dec |
|
37 |
|
|
38 |
if [ $header = "y" ] ; then |
|
39 |
awk -v Dec=$Dec -v colID=$colID '{ |
|
40 |
if (NR ==1) |
|
41 |
print $0; |
|
42 |
else{ |
|
43 |
if (NR == 2) |
|
44 |
old = $colID |
|
45 |
if($colID == old){ |
|
46 |
nobs++; |
|
47 |
for(a=1; a<colID ; a++) |
|
48 |
sum[a] = sum[a]+$a |
|
49 |
for(i=colID+1 ; i<= NF ; i++) |
|
50 |
sum[i] = sum[i]+$i |
|
51 |
} else { |
|
52 |
for(a=1; a<colID ; a++){ |
|
53 |
printf("%."Dec"f ",sum[a]) |
|
54 |
sum[a]=$a |
|
55 |
} |
|
56 |
printf("%s ",old); |
|
57 |
for(i=colID+1; i<= NF ; i++){ |
|
58 |
printf("%."Dec"f ",sum[i]) |
|
59 |
sum[i]=$i |
|
60 |
} |
|
61 |
printf("\n") |
|
62 |
old = $colID |
|
63 |
nobs = 1; |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
END{ |
|
68 |
for(a=1; a<colID ; a++){ printf("%."Dec"f ",sum[a]) } ; |
|
69 |
printf("%s ",old); |
|
70 |
for(i=colID+1; i<= NF ; i++){ printf("%."Dec"f ",sum[i])} ; |
|
71 |
printf("\n") ; |
|
72 |
}' $1 > $2 |
|
73 |
|
|
74 |
else |
|
75 |
|
|
76 |
awk -v Dec=$Dec -v colID=$colID '{ |
|
77 |
if (NR == 1) |
|
78 |
old = $colID |
|
79 |
if($colID == old){ |
|
80 |
nobs++; |
|
81 |
for(a=1; a<colID ; a++) |
|
82 |
sum[a] = sum[a]+$a |
|
83 |
for(i=colID+1 ; i<= NF ; i++) |
|
84 |
sum[i] = sum[i]+$i |
|
85 |
|
|
86 |
} else { |
|
87 |
for(a=1; a<colID ; a++){ |
|
88 |
printf("%."Dec"f ",sum[a]) |
|
89 |
sum[a]=$a } |
|
90 |
printf("%s ",old); |
|
91 |
for(i=colID+1; i<= NF ; i++){ |
|
92 |
printf("%."Dec"f ",sum[i]) |
|
93 |
sum[i]=$i } |
|
94 |
printf("\n") |
|
95 |
old = $colID |
|
96 |
nobs = 1; |
|
97 |
} |
|
98 |
} |
|
99 |
END{ |
|
100 |
for(a=1; a<colID ; a++){ printf("%."Dec"f ",sum[a]) } ; |
|
101 |
printf("%s ",old); |
|
102 |
for(i=colID+1; i<= NF ; i++){ printf("%."Dec"f ",sum[i])} ; |
|
103 |
printf("\n") ; |
|
104 |
}' $1 > $2 |
|
105 |
fi |
|
106 |
|
terrain/procedures/dem_variables/gmted2010_res_x10/sc01_reproject_be75_bj.sh | ||
---|---|---|
1 |
# rm /lustre0/scratch/ga254/stdout/* /lustre0/scratch/ga254/stderr/* |
|
2 |
# for file in /lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/be75_grd_tif/?_?.tif ; do qsub -v file=$file /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc01_reproject_be75_bj.sh ; done |
|
3 |
|
|
4 |
|
|
5 |
#PBS -S /bin/bash |
|
6 |
#PBS -q fas_normal |
|
7 |
#PBS -l mem=4gb |
|
8 |
#PBS -l walltime=1:00:00 |
|
9 |
#PBS -l nodes=1:ppn=4 |
|
10 |
#PBS -V |
|
11 |
#PBS -o /lustre0/scratch/ga254/stdout |
|
12 |
#PBS -e /lustre0/scratch/ga254/stderr |
|
13 |
|
|
14 |
|
|
15 |
OUTDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/ |
|
16 |
filename=`basename $file` |
|
17 |
|
|
18 |
gdalwarp -r cubicspline -co COMPRESS=LZW -t_srs /lustre0/scratch/ga254/dem_bj/GMTED2010/prj/6974.prj $file $OUTDIR/be75_grd_tif_SR-ORG6974/$filename -multi -overwrite |
terrain/procedures/dem_variables/gmted2010_res_x10/sc1_slope_treshold_percent.sh | ||
---|---|---|
1 |
# calculate slope or area percent above a specific treshold eg 0-4.9 put 0 ; 5-9.9 put 5 |
|
2 |
# for this case the treshold is set every 5 degrees |
|
3 |
# geting the integer of the altitued / 100 |
|
4 |
|
|
5 |
# ls /mnt/data/jetzlab/Data/environ/global/dem_variables/slope/tiles/Smoothed_N*E*.tif | xargs -n 1 -P 36 bash /mnt/data/jetzlab/Data/environ/global/dem_variables/scripts/sc1_slope_treshold_percent.sh |
|
6 |
# too check |
|
7 |
# ny=45 ; for n in `seq 1 9` ;do echo ` gdallocationinfo -valonly tiles/Smoothed_N00E005.tif 2$n $ny` `gdallocationinfo -valonly class/class/Smoothed_N00E005_class.tif 2$n $ny` ; done |
|
8 |
|
|
9 |
export file=$1 |
|
10 |
export filename=`basename $file .tif` |
|
11 |
( |
|
12 |
INDIR=/mnt/data/jetzlab/Data/environ/global/dem_variables/slope/tiles |
|
13 |
OUTDIR=/mnt/data/jetzlab/Data/environ/global/dem_variables/slope/class/class |
|
14 |
|
|
15 |
# calcualte slope every 5 degree using the the Int16 factors |
|
16 |
|
|
17 |
oft-calc -ot Byte $INDIR/$filename.tif $OUTDIR/$filename"_class_tmp1.tif" <<EOF |
|
18 |
1 |
|
19 |
#1 2.5 - 5 / |
|
20 |
EOF |
|
21 |
|
|
22 |
oft-calc -inv -ot Byte $OUTDIR/$filename"_class_tmp1.tif" $OUTDIR/$filename"_class_tmp2.tif" <<EOF |
|
23 |
1 |
|
24 |
#1 5 * |
|
25 |
EOF |
|
26 |
|
|
27 |
oft-calc -inv -ot Byte $OUTDIR/$filename"_class_tmp2.tif" $OUTDIR/$filename"_class_tmp3.tif" <<EOF |
|
28 |
1 |
|
29 |
#1 0 < 0 #1 ? |
|
30 |
EOF |
|
31 |
|
|
32 |
gdal_translate -co COMPRESS=LZW -co ZLEVEL=9 $OUTDIR/$filename"_class_tmp3.tif" $OUTDIR/$filename"_class.tif" |
|
33 |
rm $OUTDIR/$filename"_class_tmp1.tif" $OUTDIR/$filename"_class_tmp2.tif" $OUTDIR/$filename"_class_tmp3.tif" |
|
34 |
|
|
35 |
gdalinfo -mm $OUTDIR/$filename"_class.tif" | grep Computed | awk '{ gsub ("[=,]"," "); print int($(NF-1)), int($(NF))}' > $OUTDIR/txt/$filename"_min_max.txt" |
|
36 |
|
|
37 |
for class in $(seq `awk '{ print $1}' $OUTDIR/txt/${filename}_min_max.txt` 5 `awk '{ print $2}' $OUTDIR/txt/${filename}_min_max.txt`) ; do |
|
38 |
|
|
39 |
class_start=$class |
|
40 |
class_end=$(awk '{ print $2}' $OUTDIR/txt/$filename"_min_max.txt") |
|
41 |
class_string=$(for class_unique in $(seq $class_start 5 $class_end ) ; do echo -n "-class $class_unique " ; done) |
|
42 |
|
|
43 |
echo applaid the filter for the classes $class_string |
|
44 |
|
|
45 |
pkfilter -dx 10 -dy 10 $class_string -f density -d 10 -i $OUTDIR/$filename"_class.tif" -o $OUTDIR/../class$class/$filename"_C"$class"Perc.tif" -co COMPRESS=LZW -co ZLEVEL=9 -ot Byte |
|
46 |
|
|
47 |
done |
|
48 |
|
|
49 |
|
|
50 |
) 2>&1 | tee /mnt/data/jetzlab/Data/environ/global/tif_tmp/log_of_$filename".txt" |
terrain/procedures/dem_variables/gmted2010_res_x10/sc2_green_land_bj.sh | ||
---|---|---|
8 | 8 |
|
9 | 9 |
SHP=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/shp |
10 | 10 |
REFER=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/reference_tif |
11 |
TILES=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles |
|
11 | 12 |
|
13 |
# rasterize green_land poligon 30 arc sec |
|
12 | 14 |
rm -f $SHP/green_land30arc-sec.tif |
13 | 15 |
gdal_rasterize -co COMPRESS=LZW -ot Byte -a id -l green_land -tr 0.008333333333333 0.008333333333333 -te $(/home2/ga254/bin/getCorners4Gwarp $REFER/geo30arcsec_reference.tif) $SHP/green_land.shp $SHP/green_land30arc-sec.tif |
14 | 16 |
|
... | ... | |
16 | 18 |
# clip the tif |
17 | 19 |
gdal_translate -srcwin $geo_string -co COMPRESS=LZW -ot Byte $SHP/green_land30arc-sec.tif $SHP/green_land30arc-sec_msk.tif |
18 | 20 |
|
19 |
rm -f $SHP/green_land7.5arc-sec.tif |
|
20 | 21 |
|
22 |
# rasterize green_land poligon 30 arc sec |
|
23 |
rm -f $SHP/green_land7.5arc-sec.tif |
|
21 | 24 |
gdal_rasterize -co COMPRESS=LZW -ot Byte -a id -l green_land -tr 0.002083333333333 0.002083333333333 -te $(/home2/ga254/bin/getCorners4Gwarp $REFER/geo30arcsec_reference.tif) $SHP/green_land.shp $SHP/green_land7.5arc-sec.tif |
22 | 25 |
|
23 | 26 |
geo_string=$(/home2/ga254/bin/oft-bb $SHP/green_land7.5arc-sec.tif 1 | grep BB | awk '{ print $6,$7,$8-$6,$9-$7 }') |
... | ... | |
25 | 28 |
gdal_translate -srcwin $geo_string -co COMPRESS=LZW -ot Byte $SHP/green_land7.5arc-sec.tif $SHP/green_land7.5arc-sec_msk.tif |
26 | 29 |
|
27 | 30 |
|
28 |
|
|
29 | 31 |
# prepare the integration of greeland mn for mn md mx mn |
30 | 32 |
|
31 |
TILES=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles
|
|
33 |
gdal_translate -a_nodata -1 -co COMPRESS=LZW -projwin $(~/bin/getCorners4Gtranslate $SHP/green_land7.5arc-sec_msk.tif) $TILES/mn30_grd_tif/mn30_grd.tif $TILES/mn30_grd_tif/mn30_grd_greenland.tif
|
|
32 | 34 |
|
33 | 35 |
rm -f $TILES/mn75_grd_tif/green_land.tif |
34 |
|
|
35 |
gdalwarp -r cubic -te $(~/bin/getCorners4Gwarp $TILES/shp/green_land7.5arc-sec_msk.tif ) -tr 0.002083333333333 0.002083333333333 $TILES/mn30_grd_tif/mn30_grd.tif $TILES/mn75_grd_tif/green_land.tif |
|
36 |
gdalwarp -srcnodata -1 -dstnodata -1 -r cubicspline -co COMPRESS=LZW -tr 0.002083333333333 0.002083333333333 $TILES/mn30_grd_tif/mn30_grd_greenland.tif $TILES/mn75_grd_tif/green_land.tif |
|
36 | 37 |
|
37 | 38 |
pksetmask -i $TILES/mn75_grd_tif/green_land.tif -m $SHP/green_land7.5arc-sec_msk.tif -t 0 -f 0 -o $TILES/mn75_grd_tif/green_land_msk.tif |
38 | 39 |
|
39 | 40 |
|
41 |
gdal_translate -a_nodata -1 -co COMPRESS=LZW -projwin $(~/bin/getCorners4Gtranslate $SHP/green_land7.5arc-sec_msk.tif) $TILES/ds30_grd_tif/mn30_grd.tif $TILES/ds30_grd_tif/mn30_grd_greenland.tif |
|
42 |
|
|
40 | 43 |
rm -f $TILES/ds75_grd_tif/green_land.tif |
41 | 44 |
|
42 |
gdalwarp -r cubic -te $(~/bin/getCorners4Gwarp $TILES/shp/green_land7.5arc-sec_msk.tif ) -tr 0.002083333333333 0.002083333333333 $TILES/ds30_grd_tif/ds30_grd.tif $TILES/ds75_grd_tif/green_land.tif
|
|
45 |
gdalwarp -srcnodata -1 -dstnodata -1 -r cubicspline -co COMPRESS=LZW -tr 0.002083333333333 0.002083333333333 $TILES/ds30_grd_tif/ds30_grd.tif $TILES/ds75_grd_tif/green_land.tif
|
|
43 | 46 |
|
44 | 47 |
pksetmask -i $TILES/ds75_grd_tif/green_land.tif -m $SHP/green_land7.5arc-sec_msk.tif -t 0 -f 0 -o $TILES/ds75_grd_tif/green_land_msk.tif |
45 | 48 |
|
46 | 49 |
|
50 |
# cp the grenland mn to the other directory |
|
51 |
cp $TILES/mn75_grd_tif/green_land_msk.tif $TILES/mi75_grd_tif/green_land_msk.tif |
|
52 |
cp $TILES/mn75_grd_tif/green_land_msk.tif $TILES/mx75_grd_tif/green_land_msk.tif |
|
53 |
cp $TILES/mn75_grd_tif/green_land_msk.tif $TILES/md75_grd_tif/green_land_msk.tif |
|
54 |
cp $TILES/mn75_grd_tif/green_land_msk.tif $TILES/be75_grd_tif/green_land_msk.tif |
|
47 | 55 |
|
48 |
rm -f $TILES/be75_grd_tif/green_land.tif |
|
49 | 56 |
|
50 |
gdalwarp -r cubic -te $(~/bin/getCorners4Gwarp $TILES/shp/green_land7.5arc-sec_msk.tif ) -tr 0.002083333333333 0.002083333333333 $TILES/be30_grd_tif/be30_grd.tif $TILES/be75_grd_tif/green_land.tif |
|
51 | 57 |
|
52 |
pksetmask -i $TILES/be75_grd_tif/green_land.tif -m $SHP/green_land7.5arc-sec_msk.tif -t 0 -f 0 -o $TILES/be75_grd_tif/green_land_msk.tif |
terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tilingLarg_gmted2010-7.5_bj.sh | ||
---|---|---|
1 |
# download unzip and tif conversion of the Global Multi-resolution Terrain Elevation Data 2010 (GMTED2010) |
|
2 |
# setting working directory |
|
3 |
|
|
4 |
# transform to tif and tiling them using multiprocess approch |
|
5 |
# be75_grd.zip Breakline Emphasis , 7.5 arc-seconds |
|
6 |
# ds75_grd.zip Systematic Subsample , 7.5 arc-seconds |
|
7 |
# md75_grd.zip Median Statistic , 7.5 arc-seconds |
|
8 |
# mi75_grd.zip Minimum Statistic , 7.5 arc-seconds |
|
9 |
# mn75_grd.zip Mean Statistic , 7.5 arc-seconds |
|
10 |
# mx75_grd.zip Maximum Statistic , 7.5 arc-seconds |
|
11 |
# sd75_grd.zip Standard Dev. Statistic, 7.5 arc-seconds |
|
12 |
|
|
13 |
# rm /lustre0/scratch/ga254/stdout/* /lustre0/scratch/ga254/stderr/* |
|
14 |
# for DIR in md75_grd mi75_grd mn75_grd mx75_grd be75_grd ds75_grd sd75_grd ; do qsub -v DIR=$DIR /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh ; done |
|
15 |
|
|
16 |
# for DIR in be75_grd ; do bash /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh $DIR ; done |
|
17 |
|
|
18 |
|
|
19 |
#PBS -S /bin/bash |
|
20 |
#PBS -q fas_normal |
|
21 |
#PBS -l mem=4gb |
|
22 |
#PBS -l walltime=4:00:00 |
|
23 |
#PBS -l nodes=1:ppn=4 |
|
24 |
#PBS -V |
|
25 |
#PBS -o /lustre0/scratch/ga254/stdout |
|
26 |
#PBS -e /lustre0/scratch/ga254/stderr |
|
27 |
|
|
28 |
|
|
29 |
DIR=$1 |
|
30 |
|
|
31 |
echo processing $DIR |
|
32 |
|
|
33 |
INDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles |
|
34 |
cd $INDIR |
|
35 |
|
|
36 |
# load moduels |
|
37 |
|
|
38 |
module load Tools/Python/2.7.3 |
|
39 |
module load Libraries/GDAL/1.10.0 |
|
40 |
module load Tools/PKTOOLS/2.4.2 |
|
41 |
module load Libraries/OSGEO/1.10.0 |
|
42 |
|
|
43 |
|
|
44 |
# -projwin ulx uly lrx lry |
|
45 |
gdal_translate -projwin -180 +90 0 0 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_NW.tif" |
|
46 |
gdal_translate -projwin 0 +90 180 0 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_NE.tif" |
|
47 |
gdal_translate -projwin -180 0 0 -90 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_SW.tif" |
|
48 |
gdal_translate -projwin 0 0 180 -90 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_SE.tif" |
|
49 |
|
|
50 |
|
|
51 |
gdal_edit.py -a_ullr -180 +90 0 0 $INDIR/$DIR"_tif"/$DIR"_NW.tif" |
|
52 |
gdal_edit.py -a_ullr 0 +90 180 0 $INDIR/$DIR"_tif"/$DIR"_NE.tif" |
|
53 |
gdal_edit.py -a_ullr -180 0 0 -90 $INDIR/$DIR"_tif"/$DIR"_SW.tif" |
|
54 |
gdal_edit.py -a_ullr 0 0 180 -90 $INDIR/$DIR"_tif"/$DIR"_SE.tif" |
|
55 |
|
|
56 |
gdalbuildvrt -overwrite $INDIR/$DIR"_tif"/$DIR.vrt $INDIR/$DIR"_tif"/$DIR"_"??.tif |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
for nx in `seq 0 9` ; do for ny in `seq 0 4` ; do echo $nx $ny $DIR; done ; done | xargs -n 3 -P 4 bash -c $' |
|
61 |
nx=$1 |
|
62 |
ny=$2 |
|
63 |
DIR=$3 |
|
64 |
INDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/$DIR"_tif" |
|
65 |
|
|
66 |
xoff=$(echo 17280 \* $nx | bc) |
|
67 |
yoff=$(echo 2879 + 13440 \* $ny | bc) # 2879 the ofset of no data value in the northen part |
|
68 |
xsize=18270 # increase 1000 pixel to avoid border effect, 4 in the aggregate version |
|
69 |
ysize=14440 # increase 1000 pixel to avoid border effect |
|
70 |
gdal_translate -co ZLEVEL=9 -srcwin $xoff $yoff $xsize $ysize -co COMPRESS=LZW $INDIR/$DIR.vrt $INDIR/$nx"_"$ny.tif |
|
71 |
|
|
72 |
' _ |
|
73 |
|
|
74 |
|
|
75 |
rm $DIR"_tif"/${DIR}_??.tif |
|
76 |
|
|
77 |
echo start to integrate greenland |
|
78 |
|
|
79 |
|
|
80 |
for tile in 2_0 3_0 4_0 2_1 3_1 4_1 ; do echo $tile $DIR ; done | xargs -n 2 -P 6 bash -c $' |
|
81 |
|
|
82 |
tile=$1 |
|
83 |
DIR=$2 |
|
84 |
INDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles |
|
85 |
|
|
86 |
# get greenland mn and paste in mn md mx mn be |
|
87 |
if [ $DIR = mn75_grd ] || [ $DIR=md75_grd ] || [ $DIR=mx75_grd ] || [ $DIR=mn75_grd ] || $DIR = be75_grd ] ; then |
|
88 |
echo $DIR $tile |
|
89 |
pkmosaic -t 0 -min -30000 $(pkinfo -bb -i $INDIR/$DIR"_tif"/${tile}.tif) -co COMPRESS=LZW -co ZLEVEL=9 -m max -i $INDIR/$DIR"_tif"/${tile}.tif -i $INDIR/mn75_grd_tif/green_land_msk.tif -o $INDIR/$DIR"_tif"/${tile}g.tif |
|
90 |
fi |
|
91 |
# get greenland ds and paste in ds |
|
92 |
if [ $DIR = ds75_grd ] ; then |
|
93 |
echo $DIR $tile |
|
94 |
pkmosaic -t 0 -min -30000 $(pkinfo -bb -i $INDIR/$DIR"_tif"/${tile}.tif) -co COMPRESS=LZW -co ZLEVEL=9 -m max -i $INDIR/$DIR"_tif"/${tile}.tif -i $INDIR/ds75_grd_tif/green_land_msk.tif -o $INDIR/$DIR"_tif"/${tile}g.tif |
|
95 |
fi |
|
96 |
# standard deviation not computed for greenland becouse == to 0 |
|
97 |
|
|
98 |
mv $INDIR/$DIR"_tif"/${tile}.tif $INDIR/$DIR"_tif"/${tile}_no_green.tiff |
|
99 |
|
|
100 |
mv $INDIR/$DIR"_tif"/${tile}g.tif $INDIR/$DIR"_tif"/${tile}.tif |
|
101 |
|
|
102 |
' _ |
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh | ||
---|---|---|
11 | 11 |
# sd75_grd.zip Standard Dev. Statistic, 7.5 arc-seconds |
12 | 12 |
|
13 | 13 |
# rm /lustre0/scratch/ga254/stdout/* /lustre0/scratch/ga254/stderr/* |
14 |
# for DIR in md75_grd mi75_grd mn75_grd mx75_grd be75_grd ds75_grd sd75_grd ; do qsub -v DIR=$DIR /lustre0/scratch/ga254/scripts_bj_bk/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh ; done
|
|
14 |
# for DIR in md75_grd mi75_grd mn75_grd mx75_grd be75_grd ds75_grd sd75_grd ; do qsub -v DIR=$DIR /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh ; done |
|
15 | 15 |
|
16 |
# for DIR in md75_grd mi75_grd mn75_grd mx75_grd be75_grd ds75_grd sd75_grd ; do bash /lustre0/scratch/ga254/scripts_bj_bk/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh $DIR ; done
|
|
16 |
# for DIR in md75_grd mi75_grd mn75_grd mx75_grd be75_grd ds75_grd sd75_grd ; do bash /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_tiling_gmted2010-7.5_bj.sh $DIR ; done |
|
17 | 17 |
|
18 | 18 |
|
19 | 19 |
#PBS -S /bin/bash |
... | ... | |
26 | 26 |
#PBS -e /lustre0/scratch/ga254/stderr |
27 | 27 |
|
28 | 28 |
|
29 |
# DIR=$1 |
|
29 |
DIR=$1 |
|
30 |
|
|
31 |
echo processing $DIR |
|
30 | 32 |
|
31 | 33 |
INDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles |
32 | 34 |
cd $INDIR |
... | ... | |
39 | 41 |
module load Libraries/OSGEO/1.10.0 |
40 | 42 |
|
41 | 43 |
|
42 |
# -projwin ulx uly lrx lry |
|
43 |
gdal_translate -projwin -180 +90 0 0 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_NW.tif" |
|
44 |
gdal_translate -projwin 0 +90 180 0 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_NE.tif" |
|
45 |
gdal_translate -projwin -180 0 0 -90 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_SW.tif" |
|
46 |
gdal_translate -projwin 0 0 180 -90 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_SE.tif" |
|
44 |
# # -projwin ulx uly lrx lry
|
|
45 |
# gdal_translate -projwin -180 +90 0 0 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_NW.tif"
|
|
46 |
# gdal_translate -projwin 0 +90 180 0 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_NE.tif"
|
|
47 |
# gdal_translate -projwin -180 0 0 -90 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_SW.tif"
|
|
48 |
# gdal_translate -projwin 0 0 180 -90 -co COMPRESS=LZW -ot Int16 $INDIR/$DIR/$DIR $INDIR/$DIR"_tif"/$DIR"_SE.tif"
|
|
47 | 49 |
|
48 | 50 |
|
49 |
gdal_edit.py -a_ullr -180 +90 0 0 $INDIR/$DIR"_tif"/$DIR"_NW.tif" |
|
50 |
gdal_edit.py -a_ullr 0 +90 180 0 $INDIR/$DIR"_tif"/$DIR"_NE.tif" |
|
51 |
gdal_edit.py -a_ullr -180 0 0 -90 $INDIR/$DIR"_tif"/$DIR"_SW.tif" |
|
52 |
gdal_edit.py -a_ullr 0 0 180 -90 $INDIR/$DIR"_tif"/$DIR"_SE.tif" |
|
51 |
# gdal_edit.py -a_ullr -180 +90 0 0 $INDIR/$DIR"_tif"/$DIR"_NW.tif"
|
|
52 |
# gdal_edit.py -a_ullr 0 +90 180 0 $INDIR/$DIR"_tif"/$DIR"_NE.tif"
|
|
53 |
# gdal_edit.py -a_ullr -180 0 0 -90 $INDIR/$DIR"_tif"/$DIR"_SW.tif"
|
|
54 |
# gdal_edit.py -a_ullr 0 0 180 -90 $INDIR/$DIR"_tif"/$DIR"_SE.tif"
|
|
53 | 55 |
|
54 |
gdalbuildvrt -overwrite $INDIR/$DIR"_tif"/$DIR.vrt $INDIR/$DIR"_tif"/$DIR"_"??.tif |
|
56 |
# gdalbuildvrt -overwrite $INDIR/$DIR"_tif"/$DIR.vrt $INDIR/$DIR"_tif"/$DIR"_"??.tif
|
|
55 | 57 |
|
56 | 58 |
|
57 | 59 |
|
58 |
for nx in `seq 0 9` ; do for ny in `seq 0 4` ; do echo $nx $ny $DIR; done ; done | xargs -n 3 -P 4 bash -c $' |
|
59 |
nx=$1 |
|
60 |
ny=$2 |
|
61 |
DIR=$3 |
|
62 |
INDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/$DIR"_tif" |
|
60 |
# for nx in `seq 0 9` ; do for ny in `seq 0 4` ; do echo $nx $ny $DIR; done ; done | xargs -n 3 -P 4 bash -c $'
|
|
61 |
# nx=$1
|
|
62 |
# ny=$2
|
|
63 |
# DIR=$3
|
|
64 |
# INDIR=/lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/$DIR"_tif"
|
|
63 | 65 |
|
64 |
xoff=$(echo 17280 \* $nx | bc) |
|
65 |
yoff=$(echo 2879 + 13440 \* $ny | bc) # 2879 the ofset of no data value in the northen part |
|
66 |
xsize=17296 # increase 16 pixel to avoid border effect, 4 in the aggregate version |
|
67 |
ysize=13456 # increase 16 pixel to avoid border effect |
|
68 |
gdal_translate -co ZLEVEL=9 -srcwin $xoff $yoff $xsize $ysize -co COMPRESS=LZW $INDIR/$DIR.vrt $INDIR/$nx"_"$ny.tif |
|
66 |
# xoff=$(echo 17280 \* $nx | bc)
|
|
67 |
# yoff=$(echo 2879 + 13440 \* $ny | bc) # 2879 the ofset of no data value in the northen part
|
|
68 |
# xsize=17296 # increase 16 pixel to avoid border effect, 4 in the aggregate version
|
|
69 |
# ysize=13456 # increase 16 pixel to avoid border effect
|
|
70 |
# gdal_translate -co ZLEVEL=9 -srcwin $xoff $yoff $xsize $ysize -co COMPRESS=LZW $INDIR/$DIR.vrt $INDIR/$nx"_"$ny.tif
|
|
69 | 71 |
|
70 |
' _ |
|
72 |
# ' _
|
|
71 | 73 |
|
72 | 74 |
|
73 |
rm $DIR"_tif"/${DIR}_??.tif |
|
75 |
# rm $DIR"_tif"/${DIR}_??.tif
|
|
74 | 76 |
|
75 | 77 |
echo start to integrate greenland |
76 | 78 |
|
terrain/procedures/dem_variables/gmted2010_res_x10/sc4_pixel_correction_bj.sh | ||
---|---|---|
1 | 1 |
# correct immage with anomalus pixel valus. |
2 | 2 |
# the file |
3 |
|
|
4 |
# chek the -mm |
|
5 |
|
|
6 |
# dir=md75_grd_tif ; ls $dir/?_?.tif | xargs -n 1 -P 25 bash -c $' echo $1 ` gdalinfo -mm $1 | grep Min | awk \'{ gsub ("[=,]"," ") ; print $3 ,$4 }\' ` ' _ | sort -g -k 2,2 |
|
7 |
|
|
3 | 8 |
# giuseppea@turaco:/mnt/data2/dem_variables/GMTED2010/altitude/class_mi$ pkinfo -hist -i ../../tiles/mi75_grd_tif/5_1.tif | more |
4 | 9 |
# -931 1 anomalus |
5 | 10 |
# -898 1 anomalus |
... | ... | |
15 | 20 |
mv 5_1_fill.tif 5_1.tif |
16 | 21 |
rm 5_1_mask.tif |
17 | 22 |
|
18 |
# corretta |
|
23 |
# corretta mx mi non inclusi perche non hanno pixel < di -600
|
|
19 | 24 |
|
20 | 25 |
cd /lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/ |
21 | 26 |
|
22 |
for dir in md75_grd_tif be75_grd_tif ds75_grd_tif mn75_grd_tif ;do |
|
23 |
cd $dir |
|
27 |
for dir in md75_grd_tif be75_grd_tif ds75_grd_tif mn75_grd_tif ;do
|
|
28 |
cd /lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/$dir
|
|
24 | 29 |
cp 5_1.tif 5_1_orig.tiff |
25 | 30 |
pkgetmask -co COMPRESS=LZW -i 5_1.tif -min -600 -max 10000 -t 1 -f 0 -o 5_1_mask.tif |
26 | 31 |
pkfillnodata -i 5_1.tif -m 5_1_mask.tif -o 5_1_fill.tif |
... | ... | |
43 | 48 |
|
44 | 49 |
for dir in mi75_grd_tif mn75_grd_tif md75_grd_tif ds75_grd_tif be75_grd_tif mx75_grd_tif ; do |
45 | 50 |
|
46 |
cd $dir |
|
51 |
cd /lustre0/scratch/ga254/dem_bj/GMTED2010/tiles/$dir
|
|
47 | 52 |
gdal_translate -srcwin 10070 3830 500 500 2_1.tif 2_1_clip.tif |
48 | 53 |
|
49 | 54 |
pksetmask -co COMPRESS=LZW -t 0 -f 179 -i 2_1.tif -m 2_1_clip.tif -o 2_1_correct.tif |
... | ... | |
65 | 70 |
gdal_translate -srcwin 6700 7550 1050 1100 6_1.tif 6_1_clip5.tif |
66 | 71 |
gdal_translate -srcwin 7150 8000 1050 1150 6_1.tif 6_1_clip6.tif |
67 | 72 |
|
68 |
pksetmask -co COMPRESS=LZW -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -m 6_1_clip1.tif -m 6_1_clip2.tif -m 6_1_clip3.tif -m 6_1_clip4.tif -m 6_1_clip5.tif -m 6_1_clip6.tif -i 6_1.tif -o 6_1_correct.tif
|
|
73 |
pksetmask -co COMPRESS=LZW -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -t 0 -f -27 -m 6_1_clip1.tif -m 6_1_clip2.tif -m 6_1_clip3.tif -m 6_1_clip4.tif -m 6_1_clip5.tif -m 6_1_clip6.tif -i 6_1.tif -o 6_1_correct.tif |
|
69 | 74 |
mv 6_1.tif 6_1_orig.tiff |
70 | 75 |
mv 6_1_correct.tif 6_1.tif |
71 | 76 |
rm 6_1_clip*.tif |
... | ... | |
73 | 78 |
done |
74 | 79 |
|
75 | 80 |
|
81 |
|
|
82 |
# il 4_0.tif presenta pixel < 500 ma c'e' consistenci in the mn mi mx md quindi non vengon corretti |
terrain/procedures/dem_variables/gmted2010_res_x10/sc5a_class_treshold_percent_bj.sh | ||
---|---|---|
13 | 13 |
|
14 | 14 |
# rm /lustre0/scratch/ga254/stderr/* ; rm /lustre0/scratch/ga254/stdout/* ; |
15 | 15 |
|
16 |
# for file in /home2/ga254/scratch/dem_bj/GMTED2010/tiles/mi75_grd_tif/*.tif ; do qsub -v file=$file,mm=mi /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc2_class_treshold_percent_bj.sh ; done
|
|
16 |
# for file in /home2/ga254/scratch/dem_bj/GMTED2010/tiles/mi75_grd_tif/*.tif ; do qsub -v file=$file,mm=mi /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc5a_class_treshold_percent_bj.sh ; done
|
|
17 | 17 |
|
18 |
# for file in /home2/ga254/scratch/dem_bj/GMTED2010/tiles/md75_grd_tif/*.tif ; do qsub -v file=$file,mm=md /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc2_class_treshold_percent_bj.sh ; done
|
|
18 |
# for file in /home2/ga254/scratch/dem_bj/GMTED2010/tiles/md75_grd_tif/*.tif ; do qsub -v file=$file,mm=md /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc5a_class_treshold_percent_bj.sh ; done
|
|
19 | 19 |
|
20 |
# for file in /home2/ga254/scratch/dem_bj/GMTED2010/tiles/mx75_grd_tif/*.tif ; do qsub -v file=$file,mm=mx /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc2_class_treshold_percent_bj.sh ; done
|
|
20 |
# for file in /home2/ga254/scratch/dem_bj/GMTED2010/tiles/mx75_grd_tif/*.tif ; do qsub -v file=$file,mm=mx /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc5a_class_treshold_percent_bj.sh ; done
|
|
21 | 21 |
|
22 | 22 |
# to check |
23 | 23 |
# ny=45 ; for n in `seq 1 9` ;do echo `gdallocationinfo -valonly altitude/class/5_1_class_tmp3.tif 2$n $ny` `gdallocationinfo -valonly tiles/mn75_grd_tif/5_1.tif 2$n $ny` ; done |
... | ... | |
25 | 25 |
#PBS -S /bin/bash |
26 | 26 |
#PBS -q fas_normal |
27 | 27 |
#PBS -l mem=4gb |
28 |
#PBS -l walltime=10:00:00
|
|
28 |
#PBS -l walltime=14:00:00
|
|
29 | 29 |
#PBS -l nodes=10:ppn=4 |
30 | 30 |
#PBS -V |
31 | 31 |
#PBS -o /lustre0/scratch/ga254/stdout |
... | ... | |
56 | 56 |
|
57 | 57 |
time ( |
58 | 58 |
|
59 |
gdal_calc.py -A $INDIR/$filename.tif --calc="(A / 100)" --outfile=$OUTDIR/../tmp/$filename"_class_tmp1.tif" --type=Int16 --overwrite --co=COMPRESS=LZW |
|
60 |
gdal_calc.py -A $OUTDIR/../tmp/$filename"_class_tmp1.tif" --calc="(A * 100)" --outfile=$OUTDIR/../tmp/$filename"_class_tmp2.tif" --type=Int16 --overwrite --co=COMPRESS=LZW |
|
59 |
gdal_calc.py -A $INDIR/$filename.tif --calc="(A / 100)" --outfile=/tmp/$filename"_class_tmp1.tif" --type=Int16 --overwrite --co=COMPRESS=LZW |
|
60 |
gdal_calc.py -A /tmp/$filename"_class_tmp1.tif" --calc="(A * 100)" --outfile=/tmp/$filename"_class_tmp2.tif" --type=Int16 --overwrite --co=COMPRESS=LZW |
|
61 |
rm /tmp/$filename"_class_tmp1.tif" |
|
61 | 62 |
|
62 |
|
|
63 |
rm $OUTDIR/../tmp/$filename"_class_tmp1.tif" |
|
64 |
|
|
65 |
gdal_translate -co COMPRESS=LZW -co ZLEVEL=9 $OUTDIR/../tmp/$filename"_class_tmp2.tif" $OUTDIR/$filename"_class.tif" |
|
66 |
rm $OUTDIR/../tmp/$filename"_class_tmp2.tif" |
|
63 |
gdal_translate -co COMPRESS=LZW -co ZLEVEL=9 /tmp/$filename"_class_tmp2.tif" $OUTDIR/$filename"_class.tif" |
|
64 |
rm /tmp/$filename"_class_tmp2.tif" |
|
67 | 65 |
|
68 | 66 |
|
69 | 67 |
gdalinfo -mm $OUTDIR/$filename"_class.tif" | grep Computed | awk '{ gsub ("[=,]"," "); print int($(NF-1)), int($(NF))}' > $OUTDIR/../tmp/$filename"_min_max_"$mm.txt |
... | ... | |
80 | 78 |
|
81 | 79 |
echo applaid the filter for the classes $class_string |
82 | 80 |
|
83 |
pkfilter -dx 4 -dy 4 $class_string -f density -d 4 -i $OUTDIR/$filename"_class.tif" -o $OUTDIR/../class$class/$filename"_C"$class"Perc.tif" -co COMPRESS=LZW -co ZLEVEL=9 -ot Byte
|
|
81 |
/home2/ga254/bin/bin/pkfilter -dx 4 -dy 4 $class_string -f density -d 4 -i $OUTDIR/$filename"_class.tif" -o $OUTDIR/../class$class/$filename"_C"$class"Perc.tif" -co COMPRESS=LZW -co ZLEVEL=9 -ot Byte
|
|
84 | 82 |
|
85 | 83 |
done |
86 | 84 |
|
87 | 85 |
) |
86 |
|
|
87 |
checkjob -v $PBS_JOBID |
terrain/procedures/dem_variables/gmted2010_res_x10/sc5b_dem_variables_bj.sh | ||
---|---|---|
17 | 17 |
#PBS -l walltime=5:00:00 |
18 | 18 |
#PBS -l nodes=1:ppn=4 |
19 | 19 |
#PBS -V |
20 |
#PBS -o /lustre0/scratch/ga254/stdout |
|
21 |
#PBS -e /lustre0/scratch/ga254/stderr |
|
20 |
#PBS -o /lustre0/scratch/ga254/stdout/dem_var
|
|
21 |
#PBS -e /lustre0/scratch/ga254/stderr/dem_var
|
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
# load moduels |
... | ... | |
162 | 162 |
|
163 | 163 |
# r1 aspect , r2 slope |
164 | 164 |
|
165 |
gdal_calc.py --co=COMPRESS=LZW --NoDataValue -9999 -A $OUTDIR/aspect/tiles/${filename}_${mm}.tif --calc="(sin(A))" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" --overwrite --type Float32 |
|
166 |
gdal_calc.py --co=COMPRESS=LZW --NoDataValue -9999 -A $OUTDIR/aspect/tiles/${filename}_${mm}.tif --calc="(cos(A))" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" --overwrite --type Float32 |
|
165 |
gdal_calc.py --co=COMPRESS=LZW --NoDataValue -9999 -A $OUTDIR/aspect/tiles/${filename}_${mm}.tif --calc="(sin(A * 3.141592 / 180 ))" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" --overwrite --type Float32
|
|
166 |
gdal_calc.py --co=COMPRESS=LZW --NoDataValue -9999 -A $OUTDIR/aspect/tiles/${filename}_${mm}.tif --calc="(cos(A * 3.141592 / 180))" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" --overwrite --type Float32
|
|
167 | 167 |
|
168 | 168 |
gdal_calc.py --co=COMPRESS=LZW --NoDataValue -9999 -A $OUTDIR/slope/tiles/${filename}_${mm}.tif -B $OUTDIR/aspect/tiles/${filename}_${mm}"_sin.tif" --calc="((sin(A))*B)" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_Ew.tif" --overwrite --type Float32 |
169 | 169 |
gdal_calc.py --co=COMPRESS=LZW --NoDataValue -9999 -A $OUTDIR/slope/tiles/${filename}_${mm}.tif -B $OUTDIR/aspect/tiles/${filename}_${mm}"_cos.tif" --calc="((sin(A))*B)" --outfile $OUTDIR/aspect/tiles/${filename}_${mm}"_Nw.tif" --overwrite --type Float32 |
terrain/procedures/dem_variables/gmted2010_res_x10/sc6a_class_treshold_density_merge_bj.sh | ||
---|---|---|
2 | 2 |
# perform a merging action for the /mnt/data2/dem_variables/GMTED2010/altitude/class_mi and /mnt/data2/dem_variables/GMTED2010/altitude/class_mx |
3 | 3 |
# create in avery clever way missing tiles. The missing tiles were appear if all the pixel where above or below a treshold, therfore all 100% or 0% |
4 | 4 |
|
5 |
# for dir in `seq -500 100 8600` ; do echo $dir mi ; done | xargs -n 2 -P 20 bash /mnt/data2/dem_variables/scripts/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_class_treshold_density_merge.sh |
|
6 |
|
|
7 |
# for dir in `seq -500 100 8700` ; do echo $dir mx ; done | xargs -n 2 -P 20 bash /mnt/data2/dem_variables/scripts/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_class_treshold_density_merge.sh |
|
8 |
|
|
9 | 5 |
|
10 | 6 |
|
11 | 7 |
# run the script in the @bulldogj |
... | ... | |
14 | 10 |
|
15 | 11 |
# create tif with value 0 or 100 used to refeel the area |
16 | 12 |
|
17 |
# xargs controllare il risultato di qeusta linea sotto. |
|
18 |
|
|
19 |
# ls /home2/ga254/scratch/dem_bj/GMTED2010/tiles/md75_grd_tif/*.tif | xargs -n 1 -P 100 bash -c $' file=$1 ; filename=`basename $file .tif` ; pkgetmask -min 10000 -max 10001 -t 0 -ot Byte -i $file -co COMPRESS=LZW -co ZLEVEL=9 -o /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value0/$filename.tif ; gdalwarp -tr 0.008333333333333 0.008333333333333 -co COMPRESS=LZW -co ZLEVEL=9 /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value0/tmp_$filename.tif /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value0/$filename.tif; pkgetmask -min 10000 -max 10001 -t 0 -f 100 -ot Byte -i $file -co COMPRESS=LZW -co ZLEVEL=9 -o /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value100/tmp_$filename.tif ; gdalwarp -tr 0.008333333333333 0.008333333333333 -co COMPRESS=LZW -co ZLEVEL=9 /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value100/tmp_$filename.tif /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value100/$filename.tif ; rm /home2/ga254/scratch/dem_bj/GMTED2010/altitude/value100/tmp_$filename.tif ' _ |
|
20 |
|
|
21 |
|
|
22 | 13 |
# to que after the completition of sc2 |
23 | 14 |
|
24 | 15 |
# n=`qstat | grep percent_bj | wc -l` ; for time in `seq 1 100` ; do if [ $n -eq 0 ] ; then echo run the script ; ; exit ; else sleep 60 ; echo sleeping ; fi ; done |
25 | 16 |
|
26 |
# for dir in `seq -400 100 8600` ; do qsub -v dir=$dir,mm=mi /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_class_treshold_density_merge_bj.sh ; done # 400 8600 range confirrmed (-500 tutti i valore == 100)
|
|
27 |
# for dir in `seq -500 100 8700` ; do qsub -v dir=$dir,mm=md /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_class_treshold_density_merge_bj.sh ; done # -500 8700 range confirrmed
|
|
28 |
# for dir in `seq -500 100 8700` ; do qsub -v dir=$dir,mm=mx /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc3_class_treshold_density_merge_bj.sh ; done # -500 8700 range confirrmed
|
|
17 |
# for dir in `seq -500 100 8600` ; do qsub -v dir=$dir,mm=mi /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc6a_class_treshold_density_merge_bj.sh ; done # 400 8600 range confirrmed (-500 tutti i valore == 100)
|
|
18 |
# for dir in `seq -500 100 8700` ; do qsub -v dir=$dir,mm=md /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc6a_class_treshold_density_merge_bj.sh ; done # -500 8700 range confirrmed
|
|
19 |
# for dir in `seq -500 100 8700` ; do qsub -v dir=$dir,mm=mx /lustre0/scratch/ga254/scripts_bj/environmental-layers/terrain/procedures/dem_variables/gmted2010_res_x10/sc6a_class_treshold_density_merge_bj.sh ; done # -500 8700 range confirrmed
|
|
29 | 20 |
|
30 | 21 |
|
31 | 22 |
#PBS -S /bin/bash |
32 | 23 |
#PBS -q fas_normal |
33 | 24 |
#PBS -l mem=4gb |
34 |
#PBS -l walltime=2:00:00 # portato a 2 ore perche a 1 ora veniva bloccato.
|
|
25 |
#PBS -l walltime=2:00:00 |
|
35 | 26 |
#PBS -l nodes=1:ppn=4 |
36 | 27 |
#PBS -V |
37 |
#PBS -o /lustre0/scratch/ga254/stdout |
|
38 |
#PBS -e /lustre0/scratch/ga254/stderr |
|
28 |
#PBS -o /lustre0/scratch/ga254/stdout/merge_tr
|
|
29 |
#PBS -e /lustre0/scratch/ga254/stderr/merge_tr
|
|
39 | 30 |
|
40 | 31 |
|
41 | 32 |
# load moduels |
... | ... | |
54 | 45 |
INDIR_C=/home2/ga254/scratch/dem_bj/GMTED2010/altitude/class_${mm}/class # this has pixel value = 0.002083333333333 |
55 | 46 |
INDIR_Cm100=/home2/ga254/scratch/dem_bj/GMTED2010/altitude/class_${mm}/class-100 # this has pixel value = 0.008333333333333 this is the only class with all (50) tiles |
56 | 47 |
OUTDIR=/home2/ga254/scratch/dem_bj/GMTED2010/altitude/percent_class_${mm} |
57 |
TMP=/home2/ga254/scratch/dem_bj/GMTED2010/tmp
|
|
48 |
TMP=/tmp |
|
58 | 49 |
|
59 | 50 |
|
60 | 51 |
rm -f $OUTDIR/file_processed_sc3.txt # the file has ben processed by the script sc1_dem_treshold_percent.sh |
terrain/procedures/dem_variables/gmted2010_res_x10/sc7_renameTif_bj.sh | ||
---|---|---|
15 | 15 |
|
16 | 16 |
# aspect cos |
17 | 17 |
|
18 |
|
|
19 |
Offset: 0, Scale:0.0001 |
|
20 |
|
|
18 | 21 |
mv aspect/max/aspect_max_md__cos_t10k.tif aspect/max/aspect-cosine_mx_GMTED2010_md.tif |
19 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/max/aspect-cosine_mx_GMTED2010_md.tif
|
|
22 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/max/aspect-cosine_mx_GMTED2010_md.tif
|
|
20 | 23 |
mv aspect/max/aspect_max_md__sin_t10k.tif aspect/max/aspect-sine_mx_GMTED2010_md.tif |
21 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/max/aspect-sine_mx_GMTED2010_md.tif
|
|
24 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/max/aspect-sine_mx_GMTED2010_md.tif
|
|
22 | 25 |
|
23 | 26 |
mv aspect/min/aspect_min_md__cos_t10k.tif aspect/min/aspect-cosine_mi_GMTED2010_md.tif |
24 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/min/aspect-cosine_mi_GMTED2010_md.tif
|
|
27 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/min/aspect-cosine_mi_GMTED2010_md.tif
|
|
25 | 28 |
mv aspect/min/aspect_min_md__sin_t10k.tif aspect/min/aspect-sine_mi_GMTED2010_md.tif |
26 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/min/aspect-sine_mi_GMTED2010_md.tif
|
|
29 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/min/aspect-sine_mi_GMTED2010_md.tif
|
|
27 | 30 |
|
28 | 31 |
mv aspect/mean/aspect_mean_md__cos_t10k.tif aspect/mean/aspect-cosine_mn_GMTED2010_md.tif |
29 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/mean/aspect-cosine_mn_GMTED2010_md.tif
|
|
32 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/mean/aspect-cosine_mn_GMTED2010_md.tif
|
|
30 | 33 |
mv aspect/mean/aspect_mean_md__sin_t10k.tif aspect/mean/aspect-sine_mn_GMTED2010_md.tif |
31 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/mean/aspect-sine_mn_GMTED2010_md.tif
|
|
34 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/mean/aspect-sine_mn_GMTED2010_md.tif
|
|
32 | 35 |
|
33 | 36 |
mv aspect/median/aspect_median_md__cos_t10k.tif aspect/median/aspect-cosine_md_GMTED2010_md.tif |
34 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/median/aspect-cosine_md_GMTED2010_md.tif
|
|
37 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/median/aspect-cosine_md_GMTED2010_md.tif
|
|
35 | 38 |
mv aspect/median/aspect_median_md__sin_t10k.tif aspect/median/aspect-sine_md_GMTED2010_md.tif |
36 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/median/aspect-sine_md_GMTED2010_md.tif
|
|
39 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/median/aspect-sine_md_GMTED2010_md.tif
|
|
37 | 40 |
|
38 | 41 |
mv aspect/stdev/aspect_stdev_md__cos_t10k.tif aspect/stdev/aspect-cosine_sd_GMTED2010_md.tif |
39 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/stdev/aspect-cosine_sd_GMTED2010_md.tif
|
|
42 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/stdev/aspect-cosine_sd_GMTED2010_md.tif
|
|
40 | 43 |
mv aspect/stdev/aspect_stdev_md__sin_t10k.tif aspect/stdev/aspect-sine_sd_GMTED2010_md.tif |
41 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/stdev/aspect-sine_sd_GMTED2010_md.tif
|
|
44 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/stdev/aspect-sine_sd_GMTED2010_md.tif
|
|
42 | 45 |
|
43 | 46 |
# eastness and northness |
44 | 47 |
|
45 | 48 |
mv aspect/max/aspect_max_md__Ew_t10k.tif aspect/max/eastness_mx_GMTED2010_md.tif |
46 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/max/eastness_mx_GMTED2010_md.tif
|
|
49 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/max/eastness_mx_GMTED2010_md.tif
|
|
47 | 50 |
mv aspect/max/aspect_max_md__Nw_t10k.tif aspect/max/northness_mx_GMTED2010_md.tif |
48 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/max/northness_mx_GMTED2010_md.tif
|
|
51 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/max/northness_mx_GMTED2010_md.tif
|
|
49 | 52 |
|
50 | 53 |
mv aspect/min/aspect_min_md__Ew_t10k.tif aspect/min/eastness_mi_GMTED2010_md.tif |
51 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/min/eastness_mi_GMTED2010_md.tif
|
|
54 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/min/eastness_mi_GMTED2010_md.tif
|
|
52 | 55 |
mv aspect/min/aspect_min_md__Nw_t10k.tif aspect/min/northness_mi_GMTED2010_md.tif |
53 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/min/northness_mi_GMTED2010_md.tif
|
|
56 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/min/northness_mi_GMTED2010_md.tif
|
|
54 | 57 |
|
55 | 58 |
mv aspect/mean/aspect_mean_md__Ew_t10k.tif aspect/mean/eastness_mn_GMTED2010_md.tif |
56 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/mean/eastness_mn_GMTED2010_md.tif
|
|
59 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/mean/eastness_mn_GMTED2010_md.tif
|
|
57 | 60 |
mv aspect/mean/aspect_mean_md__Nw_t10k.tif aspect/mean/northness_mn_GMTED2010_md.tif |
58 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/mean/northness_mn_GMTED2010_md.tif
|
|
61 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/mean/northness_mn_GMTED2010_md.tif
|
|
59 | 62 |
|
60 | 63 |
mv aspect/median/aspect_median_md__Ew_t10k.tif aspect/median/eastness_md_GMTED2010_md.tif |
61 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/median/eastness_md_GMTED2010_md.tif
|
|
64 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/median/eastness_md_GMTED2010_md.tif
|
|
62 | 65 |
mv aspect/median/aspect_median_md__Nw_t10k.tif aspect/median/northness_md_GMTED2010_md.tif |
63 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/median/northness_md_GMTED2010_md.tif
|
|
66 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/median/northness_md_GMTED2010_md.tif
|
|
64 | 67 |
|
65 | 68 |
mv aspect/stdev/aspect_stdev_md__Ew_t10k.tif aspect/stdev/eastness_sd_GMTED2010_md.tif |
66 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/stdev/eastness_sd_GMTED2010_md.tif
|
|
69 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/stdev/eastness_sd_GMTED2010_md.tif
|
|
67 | 70 |
mv aspect/stdev/aspect_stdev_md__Nw_t10k.tif aspect/stdev/northness_sd_GMTED2010_md.tif |
68 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10000" aspect/stdev/northness_sd_GMTED2010_md.tif
|
|
71 |
gdal_edit.py -mo "Offset: 0, Scale:0.0001" aspect/stdev/northness_sd_GMTED2010_md.tif
|
|
69 | 72 |
|
70 | 73 |
|
71 | 74 |
# roughness |
... | ... | |
88 | 91 |
# tpi |
89 | 92 |
|
90 | 93 |
mv tpi/max/tpi_max_md.tif tpi/max/tpi_mx_GMTED2010_md.tif |
91 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10" tpi/max/tpi_mx_GMTED2010_md.tif
|
|
94 |
gdal_edit.py -mo "Offset: 0, Scale:0.1" tpi/max/tpi_mx_GMTED2010_md.tif
|
|
92 | 95 |
mv tpi/min/tpi_min_md.tif tpi/max/tpi_mi_GMTED2010_md.tif |
93 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10" tpi/max/tpi_mi_GMTED2010_md.tif
|
|
96 |
gdal_edit.py -mo "Offset: 0, Scale:0.1" tpi/max/tpi_mi_GMTED2010_md.tif
|
|
94 | 97 |
mv tpi/mean/tpi_mean_md.tif tpi/max/tpi_mn_GMTED2010_md.tif |
95 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10" tpi/max/tpi_mn_GMTED2010_md.tif
|
|
98 |
gdal_edit.py -mo "Offset: 0, Scale:0.1" tpi/max/tpi_mn_GMTED2010_md.tif
|
|
96 | 99 |
mv tpi/median/tpi_median_md.tif tpi/max/tpi_md_GMTED2010_md.tif |
97 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10" tpi/max/tpi_md_GMTED2010_md.tif
|
|
100 |
gdal_edit.py -mo "Offset: 0, Scale:0.1" tpi/max/tpi_md_GMTED2010_md.tif
|
|
98 | 101 |
mv tpi/stdev/tpi_stdev_md.tif tpi/max/tpi_sd_GMTED2010_md.tif |
99 |
gdal_edit.py -mo "PIXEL VALUE = multiplied by 10" tpi/max/tpi_sd_GMTED2010_md.tif
|
|
102 |
gdal_edit.py -mo "Offset: 0, Scale:0.1" tpi/max/tpi_sd_GMTED2010_md.tif
|
|
100 | 103 |
|
101 | 104 |
# tri |
102 | 105 |
|
Also available in: Unified diff
Solara radiation first commint; top var last run v3