#!/bin/bash TEMPLATE="TEMPLATE_v10m.py" ##WORKING_SCRIPT="download_script.py" # Loop over years and months using brace expansion for year in {1993..2016}; do for month in {1..12}; do # Format month with leading zero month_padded=$(printf "%02d" "$month") WORKING_SCRIPT="downloading_v10m_script_"$year$month_padded".py" # Copy the template to a working file cp "$TEMPLATE" "$WORKING_SCRIPT" # Replace placeholders in the working script sed -i "s/\"year\"\: \[\"1993\"\]/\"year\"\: \[\"$year\"\]/g" "$WORKING_SCRIPT" sed -i "s/\"month\"\: \[\"01\"\]/\"month\"\: \[\"$month_padded\"\]/g" "$WORKING_SCRIPT" # Replace the download file name sed -i "s/filename=\"ECMWF_SEAS5_v10m_1993_01_6hourly.grib\"/filename=\"ECMWF_SEAS5_v10m_${year}_${month_padded}_6hourly.grib\"/g" "$WORKING_SCRIPT" # Run the modified Python script python3 "$WORKING_SCRIPT" done done