diff --git a/templates/real-from-dwd-ana/prepare_date_local.sh b/templates/real-from-dwd-ana/prepare_date_local.sh index d077f3dd0cad6df0dfcd046ca39c1e643b2e304e..6cca59fc26f481336001bc2f22564cf1a373ea61 100644 --- a/templates/real-from-dwd-ana/prepare_date_local.sh +++ b/templates/real-from-dwd-ana/prepare_date_local.sh @@ -33,18 +33,42 @@ if [ "${IS_LOCAL}" == "True" ]; then exit 1 fi - # Create member folder and go there - mkdir -p ${COMMON_DATE_FOLDER} - cd ${COMMON_DATE_FOLDER} || exit - # Save filenames to be used later by other scripts. - echo "${AN_FILE}" > an_file.txt - echo "${FG_FILE}" > fg_file.txt + # Check if we copy the initial conditions from the local system or the remote one + if [ "${IS_LOCAL}" != "True" ]; then + # Create member folder + ssh "${HPCUSER}@${HPCHOST}" mkdir -p ${COMMON_DATE_FOLDER} - # Copy the first-guess and analysis files. - cp "${FG_SOURCE}" "${FG_FILE}" - cp "${AN_SOURCE}" "${AN_FILE}" + # Save filenames to be used later by other scripts. + echo "${AN_FILE}" > an_file.txt + echo "${FG_FILE}" > fg_file.txt + rsync -v an_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/an_file.txt" + rsync -v fg_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/fg_file.txt" - # Change permissions to read only. - chmod 440 ./* + # Remove temporary files. + rm an_file.txt + rm fg_file.txt + + # Copy the first-guess and analysis files. + rsync -v "${FG_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${FG_FILE}" + rsync -v "${AN_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${AN_FILE}" + + # Change permissions to read only. + ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/*" + else + # Create member folder and go there + mkdir -p ${COMMON_DATE_FOLDER} + cd ${COMMON_DATE_FOLDER} || exit + + # Save filenames to be used later by other scripts. + echo "${AN_FILE}" > an_file.txt + echo "${FG_FILE}" > fg_file.txt + + # Copy the first-guess and analysis files. + cp "${FG_SOURCE}" "${FG_FILE}" + cp "${AN_SOURCE}" "${AN_FILE}" + + # Change permissions to read only. + chmod 440 ./* + fi fi \ No newline at end of file diff --git a/templates/real-from-dwd-ana/prepare_date_remote.sh b/templates/real-from-dwd-ana/prepare_date_remote.sh index 9c0e95676625f033e8a9c1e94561f6c9ba8043d1..8fec0cec09abbd5b6487628a67c43161abe78515 100644 --- a/templates/real-from-dwd-ana/prepare_date_remote.sh +++ b/templates/real-from-dwd-ana/prepare_date_remote.sh @@ -2,7 +2,7 @@ IS_LOCAL=%SIMULATION.INITIAL_CONDITIONS.LOCAL% -if [ "${IS_LOCAL}" == "False" ]; then +if [ "${IS_LOCAL}" == "0" ]; then # Get some variables provided by autosubmit. WORKDIR=%HPCROOTDIR% STARTDATE=%SDATE% @@ -32,25 +32,42 @@ if [ "${IS_LOCAL}" == "False" ]; then exit 1 fi + # Check if we copy the initial conditions from the local system or the remote one - # Create member folder - ssh "${HPCUSER}@${HPCHOST}" mkdir -p ${COMMON_DATE_FOLDER} + if [ "${IS_LOCAL}" == "True" ]; then + # Create member folder + ssh "${HPCUSER}@${HPCHOST}" mkdir -p ${COMMON_DATE_FOLDER} + + # Save filenames to be used later by other scripts. + echo "${AN_FILE}" > an_file.txt + echo "${FG_FILE}" > fg_file.txt + rsync -v an_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/an_file.txt" + rsync -v fg_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/fg_file.txt" - # Save filenames to be used later by other scripts. - echo "${AN_FILE}" > an_file.txt - echo "${FG_FILE}" > fg_file.txt - rsync -v an_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/an_file.txt" - rsync -v fg_file.txt "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/fg_file.txt" + # Remove temporary files. + rm an_file.txt + rm fg_file.txt - # Remove temporary files. - rm an_file.txt - rm fg_file.txt + # Copy the first-guess and analysis files. + rsync -v "${FG_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${FG_FILE}" + rsync -v "${AN_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${AN_FILE}" - # Copy the first-guess and analysis files. - rsync -v "${FG_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${FG_FILE}" - rsync -v "${AN_SOURCE}" "${HPCUSER}@${HPCHOST}":"${COMMON_DATE_FOLDER}/${AN_FILE}" + # Change permissions to read only. + ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/*" + else + # Create member folder and go there + mkdir -p ${COMMON_DATE_FOLDER} + cd ${COMMON_DATE_FOLDER} || exit - # Change permissions to read only. - ssh "${HPCUSER}@${HPCHOST}" chmod 440 "${COMMON_DATE_FOLDER}/*" + # Save filenames to be used later by other scripts. + echo "${AN_FILE}" > an_file.txt + echo "${FG_FILE}" > fg_file.txt + # Copy the first-guess and analysis files. + cp "${FG_SOURCE}" "${FG_FILE}" + cp "${AN_SOURCE}" "${AN_FILE}" + + # Change permissions to read only. + chmod 440 ./* + fi fi \ No newline at end of file