Skip to content
Extraits de code Groupes Projets
update_experiment.bash 1,23 ko
Newer Older
  • Learn to ignore specific revisions
  • 
    # This script can be used on a machine where a NEMO experiment is set up to automatically update
    # this experiment up to the last date with ERA5 data. In practice, it will extend the experiment
    # plan with a restart frequency of 1 day, and launch the experiment. It should be used as:
    #
    #   ./update_experiment.bash version configuration name
    
    
    # technicalities
    set -e
    
    script_path=$(realpath $(dirname $0))
    climate_toolbox_path=$(realpath $script_path/../../..)
    source $climate_toolbox_path/utilities/generic.bash
    
    # prepare logs
    current_log_file_path="$script_path/logs/update_experiment_\
    ${experiment}_${configuration}_${version}_$(get_log_tag)"
    
    exec > "$current_log_file_path" 2>&1
    
    # recover arguments
    if [ "$#" -lt 3 ]
    then
      echo -e "\nError! Three arguments are required to specify the experiment to update:"
      echo -e "  - version\n  - configuration\n  - name\n"
      exit 1
    fi
    
    version=$1
    configuration=$2
    name=$3
    
    # find the last date with ERA5 data
    last_date_with_era5_data=$(date -d "$(get_era5_data_availability_delay) days ago" +"%Y-%m-%d")
    
    # extend and launch the experiment
    cd $climate_toolbox_path
    python3 -m models.nemo.extend_experiment -v $version -c $configuration -n $name \
      -ed $last_date_with_era5_data -rf 1-days -l