Commit 2e544eaa authored by PENGUEN Julien's avatar PENGUEN Julien

ajout ecriture output sur montage volume

parent 416d0280
......@@ -7,6 +7,10 @@
INPUT_FILE_SURVEYS=./template_inputs/surveys.dat
INPUT_FILE_AREAS=./template_inputs/areas.csv
OUTPUT_FOLDER_LINUX=$HOME
OUTPUT_FOLDER_MACOS=/Users/$USER
VOLUME_MOUNT="NONE"
SCRIPT_VERSION=0.1
......
......@@ -187,6 +187,10 @@ function_message()
echo -e " the default file define on .env file. the area ${ITALIC_BEGIN}FILE${ITALIC_END}"
echo -e " must be on format '.csv'"
echo -e ""
echo -e "${BOLD_BEGIN}--output_folder${BOLD_END} ${ITALIC_BEGIN}FOLDER${ITALIC_END} run photos_montage_aladin with this output folder ${ITALIC_BEGIN}FOLDER${ITALIC_END} instead of "
echo -e " the default folder define on .env file. the user must have"
echo -e " the rights to write on the output folder ${ITALIC_BEGIN}FOLDER${ITALIC_END}"
echo -e ""
echo -e "${BOLD_BEGIN}--angular${BOLD_END} ${ITALIC_BEGIN}NUMBER${ITALIC_END} run photos_montage_aladin with this angular dimension value (${ITALIC_BEGIN}NUMBER${ITALIC_END}) "
echo -e " instead of the default angular value define on .env file."
echo -e " the angular value (${ITALIC_BEGIN}NUMBER${ITALIC_END}) must be on second of arc"
......@@ -251,6 +255,7 @@ function_build_tab_hach()
ARRAY["--version"]="None";
ARRAY["--survey"]="PATH FILE SURVEYS";
ARRAY["--area"]="PATH FILE AREAS";
ARRAY["--output_folder"]="PATH OUTPUT FOLDER";
ARRAY["--angular"]="NUMBER";
ARRAY["--resolution_line"]="NUMBER";
ARRAY["--resolution_col"]="NUMBER";
......@@ -287,6 +292,7 @@ function_build_tab_hach()
ARGS_WEIGHT["--version"]=1;
ARGS_WEIGHT["--survey"]=2;
ARGS_WEIGHT["--area"]=2;
ARGS_WEIGHT["--output_folder"]=2;
ARGS_WEIGHT["--angular"]=2;
ARGS_WEIGHT["--resolution_line"]=2;
ARGS_WEIGHT["--resolution_col"]=2;
......@@ -899,6 +905,37 @@ if [ ! -f $INPUT_FILE_AREAS ]; then
exit 0
fi
#------------------------------#
#check output_folder args
OUTPUT_FOLDER_ON_VOLUME_MOUNT="FALSE"
OLD_OUTPUT_FOLDER_LINUX=$OUTPUT_FOLDER_LINUX
OUTPUT_FOLDER_LINUX=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--output_folder" $OUTPUT_FOLDER_LINUX`
#----------------------------------------#
#check if OUTPUT_FOLDER is on VOLUME_MOUNT
if [[ $OUTPUT_FOLDER_LINUX != $OLD_OUTPUT_FOLDER_LINUX && $VOLUME_MOUNT != "NONE" ]]; then
CHAINE=$(echo $OUTPUT_FOLDER_LINUX | grep "^$VOLUME_MOUNT")
if [ "$CHAINE" != "" ]; then
OUTPUT_FOLDER_ON_VOLUME_MOUNT="TRUE"
fi
fi
#----------------------------------------#
if [ ! -d $OUTPUT_FOLDER_LINUX ]; then
function_message "TYPE_FILE_ERROR" "$OUTPUT_FOLDER_LINUX not found" "--output_folder"
exit 0
fi
#-------------------------------------#
#check angular input arg
......@@ -1091,7 +1128,7 @@ case ${sort_arg_keys[0]} in
#------------------------#
#creation of main_folder
main_folder=$HOME"/.photos_montage_aladin"
main_folder=${OUTPUT_FOLDER_LINUX}"/datas_photos_montage_aladin"
if [ -d ${main_folder} ]; then
echo "=> ${main_folder} exist"
......@@ -1154,6 +1191,15 @@ case ${sort_arg_keys[0]} in
force='FALSE'
fi
#------------------------#
#check OUTPUT_FOLDER_ON_VOLUME_MOUNT
if [ $OUTPUT_FOLDER_ON_VOLUME_MOUNT == "TRUE" ]; then
container_mount="/mnt/"
else
container_mount=""
fi
#------------------------#
area_folder[$k]=${main_folder}"/"${list_zone[$k]}
tempo_folder[$k]=${area_folder[$k]}
......@@ -1196,7 +1242,9 @@ case ${sort_arg_keys[0]} in
else
echo -e "=> ${RED}WARNING${COLOR_OFF} : ${area_ajs[$k]} not found"
echo "=> construction of ${area_ajs[$k]} in progress ..."
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${images_folder[$k]}
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${container_mount}${images_folder[$k]}
echo "=> construction of ${area_ajs[$k]} OK"
rm -rf ${images_folder[$k]}
......@@ -1255,7 +1303,7 @@ case ${sort_arg_keys[0]} in
rm ${log_aladin_file[$k]}
echo "=> construction of ${area_ajs[$k]} in progress ..."
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${images_folder[$k]}
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${container_mount}${images_folder[$k]}
echo "=> construction of ${area_ajs[$k]} OK"
......@@ -1284,12 +1332,12 @@ case ${sort_arg_keys[0]} in
#construction of docker script and montage
echo "=> Construction in progress ..."
script_images[$k]="macro "${area_ajs[$k]}
script_montages[$k]="montage -geometry ${RESOLUTION_BY_LINE}x${RESOLUTION_BY_COL} -tile ${NB_TILE_BY_LINE}x${NB_TILE_BY_COL} ${images_folder[$k]}/*jpg ${montages_folder[$k]}/${list_zone[$k]}.png"
script_images[$k]="macro "${container_mount}${area_ajs[$k]}
script_montages[$k]="montage -geometry ${RESOLUTION_BY_LINE}x${RESOLUTION_BY_COL} -tile ${NB_TILE_BY_LINE}x${NB_TILE_BY_COL} ${container_mount}${images_folder[$k]}/*jpg ${container_mount}${montages_folder[$k]}/${list_zone[$k]}.png"
if [[ "${sort_arg_keys[@]}" =~ "--mount" && $VOLUME_MOUNT != "NONE" ]]; then
sudo docker run --name photos_montage_aladin --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME -v ${VOLUME_MOUNT}:"/mnt/${VOLUME_MOUNT}" --network host -e DISPLAY=$DISPLAY -e USER=$USER -e HOME=$HOME image_photos_montage_aladin-${version} /bin/bash -c "java -jar /var/aladin/Aladin-${version}.jar -nogui -trace -script=${script_images[$k]};${script_montages[$k]} " > ${log_aladin_file[$k]} 2>&1
sudo docker run --name photos_montage_aladin --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME -v ${VOLUME_MOUNT}:"/mnt/"${VOLUME_MOUNT} --network host -e DISPLAY=$DISPLAY -e USER=$USER -e HOME=$HOME image_photos_montage_aladin-${version} /bin/bash -c "java -jar /var/aladin/Aladin-${version}.jar -nogui -trace -script=${script_images[$k]};${script_montages[$k]} " > ${log_aladin_file[$k]} 2>&1
else
sudo docker run --name photos_montage_aladin --rm -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME --network host -e DISPLAY=$DISPLAY -e USER=$USER -e HOME=$HOME image_photos_montage_aladin-${version} /bin/bash -c "java -jar /var/aladin/Aladin-${version}.jar -nogui -trace -script=${script_images[$k]};${script_montages[$k]} " > ${log_aladin_file[$k]} 2>&1
......
......@@ -187,6 +187,10 @@ function_message()
echo -e " the default file define on .env file. the area ${ITALIC_BEGIN}FILE${ITALIC_END}"
echo -e " must be on format '.csv'"
echo -e ""
echo -e "${BOLD_BEGIN}--output_folder${BOLD_END} ${ITALIC_BEGIN}FOLDER${ITALIC_END} run photos_montage_aladin with this output folder ${ITALIC_BEGIN}FOLDER${ITALIC_END} instead of "
echo -e " the default folder define on .env file. the user must have"
echo -e " the rights to write on the output folder ${ITALIC_BEGIN}FOLDER${ITALIC_END}"
echo -e ""
echo -e "${BOLD_BEGIN}--angular${BOLD_END} ${ITALIC_BEGIN}NUMBER${ITALIC_END} run photos_montage_aladin with this angular dimension value (${ITALIC_BEGIN}NUMBER${ITALIC_END}) "
echo -e " instead of the default angular value define on .env file."
echo -e " the angular value (${ITALIC_BEGIN}NUMBER${ITALIC_END}) must be on second of arc"
......@@ -251,6 +255,7 @@ function_build_tab_hach()
ARRAY["--version"]="None";
ARRAY["--survey"]="PATH FILE SURVEYS";
ARRAY["--area"]="PATH FILE AREAS";
ARRAY["--output_folder"]="PATH OUTPUT FOLDER";
ARRAY["--angular"]="NUMBER";
ARRAY["--resolution_line"]="NUMBER";
ARRAY["--resolution_col"]="NUMBER";
......@@ -287,6 +292,7 @@ function_build_tab_hach()
ARGS_WEIGHT["--version"]=1;
ARGS_WEIGHT["--survey"]=2;
ARGS_WEIGHT["--area"]=2;
ARGS_WEIGHT["--output_folder"]=2;
ARGS_WEIGHT["--angular"]=2;
ARGS_WEIGHT["--resolution_line"]=2;
ARGS_WEIGHT["--resolution_col"]=2;
......@@ -916,6 +922,35 @@ if [ ! -f $INPUT_FILE_AREAS ]; then
function_message "TYPE_FILE_ERROR" "$INPUT_FILE_AREAS not found" "--area"
exit 0
fi
#------------------------------#
#check output_folder args
OUTPUT_FOLDER_ON_VOLUME_MOUNT="FALSE"
OLD_OUTPUT_FOLDER_MACOS=$OUTPUT_FOLDER_MACOS
OUTPUT_FOLDER_MACOS=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--output_folder" $OUTPUT_FOLDER_MACOS`
#----------------------------------------#
#check if OUTPUT_FOLDER is on VOLUME_MOUNT
if [[ $OUTPUT_FOLDER_MACOS != $OLD_OUTPUT_FOLDER_MACOS && $VOLUME_MOUNT != "NONE" ]]; then
CHAINE=$(echo $OUTPUT_FOLDER_MACOS | grep "^$VOLUME_MOUNT")
if [ "$CHAINE" != "" ]; then
OUTPUT_FOLDER_ON_VOLUME_MOUNT="TRUE"
fi
fi
#----------------------------------------#
if [ ! -d $OUTPUT_FOLDER_MACOS ]; then
function_message "TYPE_FILE_ERROR" "$OUTPUT_FOLDER_MACOS not found" "--output_folder"
exit 0
fi
#-------------------------------------#
#check angular input arg
......@@ -1108,7 +1143,7 @@ case ${sort_arg_keys[0]} in
#------------------------#
#creation of main_folder
main_folder=$HOME"/.photos_montage_aladin"
main_folder=${OUTPUT_FOLDER_MACOS}"/datas_photos_montage_aladin"
if [ -d ${main_folder} ]; then
echo "=> ${main_folder} exist"
......@@ -1170,6 +1205,18 @@ case ${sort_arg_keys[0]} in
force='FALSE'
fi
#------------------------#
#check OUTPUT_FOLDER_ON_VOLUME_MOUNT
if [ $OUTPUT_FOLDER_ON_VOLUME_MOUNT == "TRUE" ]; then
container_mount="/mnt/"
new_main_folder=${container_mount}${OUTPUT_FOLDER_MACOS}"/datas_photos_montage_aladin"
else
container_mount=""
new_main_folder="/home/"$USER"/datas_photos_montage_aladin"
fi
#------------------------#
area_folder[$k]=${main_folder}"/"${list_zone[$k]}
tempo_folder[$k]=${area_folder[$k]}
......@@ -1212,7 +1259,7 @@ case ${sort_arg_keys[0]} in
else
echo -e "=> ${RED}WARNING${COLOR_OFF} : ${area_ajs[$k]} not found"
echo "=> construction of ${area_ajs[$k]} in progress ..."
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} "/home/"$USER"/.photos_montage_aladin/"${list_zone[$k]}"/images"
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${container_mount}${images_folder[$k]}
echo "=> construction of ${area_ajs[$k]} OK"
rm -rf ${images_folder[$k]}
rm -rf ${montages_folder[$k]}
......@@ -1274,7 +1321,7 @@ case ${sort_arg_keys[0]} in
rm ${log_aladin_file[$k]}
echo "=> construction of ${area_ajs[$k]} in progress ..."
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${images_folder[$k]}
function_create_ajs_file ${INPUT_FILE_SURVEYS} ${area_ajs[$k]} ${list_zone[$k]} ${list_ra[k]} ${list_dec[k]} ${container_mount}${images_folder[$k]}
echo "=> construction of ${area_ajs[$k]} OK"
state="RUN"
......@@ -1301,7 +1348,6 @@ case ${sort_arg_keys[0]} in
#construction of docker script and montage
echo "=> Construction in progress ..."
new_main_folder="/home/"$USER"/.photos_montage_aladin"
new_area_folder[$k]=${new_main_folder}"/"${list_zone[$k]}
new_tempo_folder[$k]=${new_area_folder[$k]}
new_images_folder[$k]=${new_area_folder[$k]}"/images"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment