Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120693966
exec_intersect_pixels_w_roofs.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
Sun, Jul 6, 09:14
Size
3 KB
Mime Type
text/x-shellscript
Expires
Tue, Jul 8, 09:14 (2 d)
Engine
blob
Format
Raw Data
Handle
27217252
Attached To
R8797 solarPV
exec_intersect_pixels_w_roofs.sh
View Options
#!/bin/bash
## == Settings
#SBATCH --account=leso-pb
#SBATCH --job-name=sjoin_roofs
#SBATCH --nodes=1
#SBATCH --mem=60G
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --time=48:00:00
#SBATCH --partition=serial
#SBATCH --chdir ./output
#SBATCH --mail-type=ALL
#SBATCH --mail-user=alina.walch@epfl.ch
#SBATCH --array=1-26
#SBATCH -o sjoin_roofs_%A_%a.out # Standard output
#SBATCH -e sjoin_roofs_%A_%a.err # Standard error
echo STARTING AT $(date)
echo
## ====== Specify here the needed modules
module purge
module load gcc python/3.7.3
## ====== Get slurm array ID
N=${SLURM_ARRAY_TASK_ID}
echo Slurm array task ID: $N
echo
# variable(s) to be read from file. Copy and change -f1 to -f2 if more than one column is read in control file
CANTON=`head -n ${N} /work/hyenergy/output/CNN_pv_predictions_CH/cantons.txt | tail -n 1 | cut -d',' -f2`
echo Post-processing of canton $CANTON
echo
#########################################################
################# VARIABLES TO CHANGE ###################
# change --mail-user=alina.walch@epfl.ch to appropriate email
# make sure --chdir ./output exists
# directory of the python scripts
CODEDIR='/home/walch/code/solarPV_identification/PV_postprocessing'
# directory for saving output data
OUTPATH=/scratch/walch/pv_linking/files_CH/PV_data_$CANTON
# file with pixel predictions (2 or 3 columns: [1, x, y]) where the first column is optional
PV_FP=/work/hyenergy/output/CNN_pv_predictions_CH/pv_predictions_switzerland.csv
# boundary of predicted region, shapefile (mask_GE and mask_ZH exist in /work/hyenergy/output/CNN_pv_predictions)
MASK_FP=/work/hyenergy/output/CNN_pv_predictions_CH/masks/mask_$CANTON
#########################################################
#########################################################
## ====== Hyperparameters
DEFAULT_TILT=0 # Default tilt angle assumed on roofs without rooftop info
DEFAULT_ASPECT='-180' # Default roof aspect assumed on roofs without rooftop info
BLD_BUFFER=3 # Distance to consider around BLD footprints
MIN_SIZE_CLUSTER=3 # Minimum size of individual clusters of PV panels (in m2)
MIN_SIZE_INSTALLATION=6 # Minimum size of PV installations per building (in m2)
# DBSCAN PARAMETERS
EPS="1.1"
MIN_SAMPLES=10
## ====== Python scripts
PATH_TO_SCRIPT1=$CODEDIR\/spatial_join_pv.py
PATH_TO_SCRIPT2=$CODEDIR\/cluster_pv.py
PATH_TO_SCRIPT3=$CODEDIR\/group_PV_to_buildings.py
## ===== Definition of file names
PIXEL_FP=$OUTPATH\/PV_pixels_detected_buf$BLD_BUFFER\m.csv
CLUSTER_FP=$OUTPATH\/PV_pixels_clustered_buf$BLD_BUFFER\m_min$MIN_SIZE_CLUSTER\m2.csv
ROOF_OUT=$OUTPATH\/PV_per_roof_buf$BLD_BUFFER\m_min$MIN_SIZE_CLUSTER\m2.csv
BLD_OUT=$OUTPATH\/PV_installations_buf$BLD_BUFFER\m_min$MIN_SIZE_CLUSTER\m2.csv
## ===== Execute scripts
mkdir $OUTPATH
source activate py3_geo
python $PATH_TO_SCRIPT1 $PV_FP $MASK_FP $PIXEL_FP $BLD_BUFFER $DEFAULT_TILT $DEFAULT_ASPECT
if test -f "$PIXEL_FP"; then
echo "$PIXEL_FP exists"
python $PATH_TO_SCRIPT2 $PIXEL_FP $CLUSTER_FP $MIN_SIZE_CLUSTER $EPS $MIN_SAMPLES
fi
if test -f "$CLUSTER_FP"; then
echo "$CLUSTER_FP exists"
python $PATH_TO_SCRIPT3 $CLUSTER_FP $ROOF_OUT $BLD_OUT $MIN_SIZE_INSTALLATION
fi
source deactivate
echo
echo FINISHED AT $(date)
Event Timeline
Log In to Comment