#!/bin/bash

RUN_NR=${1}
RUN_DIR="../processed_runs/r_${RUN_NR}/"


if [ -d $RUN_DIR ]
    then 
        echo creating formatted .h5 file for run $RUN_NR in $RUN_DIR
#         module load exfel
#         module load exfel_anaconda3
        python format_data.py --run-number $RUN_NR --run-folder $RUN_DIR
        #chgrp -R 60002711-part $RUN_DIR
        chmod -R 777 $RUN_DIR
    else
        echo run folder $RUN_DIR does not exist
        echo please provide a valid run number
fi
