Skip to content
Snippets Groups Projects
Commit e7a4288f authored by Oriol Tintó's avatar Oriol Tintó
Browse files

Refactor examples.

parent f26cc8d9
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
####################################################################################################################### #######################################################################################################################
# Three variables are required to define the test case # Variables that are required to define the test case
EXPID="rfipsp" EXPID="rfipsp"
ICON_CASE="real-from-ideal" ICON_CASE="real-from-ideal"
ICON_VERSION="psp" ICON_VERSION="psp"
PLATFORM="LOCAL"
EXTRA_NAMELIST=$( EXTRA_NAMELIST=$(
cat <<-END cat <<-END
atmosphere_namelist: | atmosphere_namelist: |
...@@ -16,6 +17,7 @@ atmosphere_namelist_ideal: | ...@@ -16,6 +17,7 @@ atmosphere_namelist_ideal: |
psp_scale: 5.0 psp_scale: 5.0
END END
) )
EXTRA_CONFIGURATION=""
####################################################################################################################### #######################################################################################################################
set -euo pipefail set -euo pipefail
...@@ -23,12 +25,8 @@ set -euo pipefail ...@@ -23,12 +25,8 @@ set -euo pipefail
# Get path to the script directory # Get path to the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Import the function setup_autoicon_example # Import the function run_autoicon_example
source ${SCRIPT_DIR}/example_utils.sh source ${SCRIPT_DIR}/example_utils.sh
# Setup the experiment # Setup and run the experiment
# setup_autoicon_example takes the following arguments: run_autoicon_example "$EXPID" "$ICON_CASE" "$ICON_VERSION" "$PLATFORM" "${EXTRA_NAMELIST}" "${EXTRA_CONFIGURATION}"
# case: right now it can be real-from-ideal or real-from-dwd-ana
# ICON_VERSION: it can be master, psp, plexrt or a specific version like 2.6.5-nwp0 (the latest at that moment)
# EXTRA_NAMELIST: In case we want to provide extra parameters we can use it
run_autoicon_example "$EXPID" "$ICON_CASE" "$ICON_VERSION" "${EXTRA_NAMELIST}"
#!/bin/bash #!/bin/bash
####################################################################################################################### #######################################################################################################################
# Three variables are required to define the test case # Variables that are required to define the test case
EXPID="rfi" EXPID="rfi"
ICON_CASE="real-from-ideal" ICON_CASE="real-from-ideal"
ICON_VERSION="2.6.5-nwp0" ICON_VERSION="2.6.5-nwp0"
PLATFORM="LOCAL"
EXTRA_NAMELIST="" EXTRA_NAMELIST=""
EXTRA_CONFIGURATION=""
####################################################################################################################### #######################################################################################################################
set -euo pipefail set -euo pipefail
...@@ -12,14 +14,11 @@ set -euo pipefail ...@@ -12,14 +14,11 @@ set -euo pipefail
# Get path to the script directory # Get path to the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Import the function setup_autoicon_example # Import the function run_autoicon_example
source ${SCRIPT_DIR}/example_utils.sh source ${SCRIPT_DIR}/example_utils.sh
# Setup the experiment # Setup and run the experiment
# setup_autoicon_example takes the following arguments: run_autoicon_example "$EXPID" "$ICON_CASE" "$ICON_VERSION" "$PLATFORM" "${EXTRA_NAMELIST}" "${EXTRA_CONFIGURATION}"
# case: right now it can be real-from-ideal or real-from-dwd-ana
# ICON_VERSION: it can be master, psp, plexrt or a specific version like 2.6.5-nwp0 (the latest at that moment)
# EXTRA_NAMELIST: In case we want to provide extra parameters we can use it
run_autoicon_example "$EXPID" "$ICON_CASE" "$ICON_VERSION" "${EXTRA_NAMELIST}"
#!/bin/bash #!/bin/bash
####################################################################################################################### #######################################################################################################################
# Three variables are required to define the test case # Variables that are required to define the test case
EXPID="rfda" EXPID="rfda"
ICON_CASE="real-from-dwd-ana" ICON_CASE="real-from-dwd-ana"
ICON_VERSION="2.6.5-nwp0" ICON_VERSION="2.6.5-nwp0"
PLATFORM="LOCAL"
EXTRA_NAMELIST="" EXTRA_NAMELIST=""
EXTRA_CONFIGURATION=""
####################################################################################################################### #######################################################################################################################
set -euo pipefail set -euo pipefail
...@@ -12,12 +14,8 @@ set -euo pipefail ...@@ -12,12 +14,8 @@ set -euo pipefail
# Get path to the script directory # Get path to the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Import the function setup_autoicon_example # Import the function run_autoicon_example
source ${SCRIPT_DIR}/example_utils.sh source ${SCRIPT_DIR}/example_utils.sh
# Setup the experiment # Setup and run the experiment
# setup_autoicon_example takes the following arguments: run_autoicon_example "$EXPID" "$ICON_CASE" "$ICON_VERSION" "$PLATFORM" "${EXTRA_NAMELIST}" "${EXTRA_CONFIGURATION}"
# case: right now it can be real-from-ideal or real-from-dwd-ana
# ICON_VERSION: it can be master, psp, plexrt or a specific version like 2.6.5-nwp0 (the latest at that moment)
# EXTRA_NAMELIST: In case we want to provide extra parameters we can use it
run_autoicon_example "$EXPID" "$ICON_CASE" "$ICON_VERSION" "${EXTRA_NAMELIST}"
# setup_autoicon_example function that sets up an AutoSub environment for the ICON model #/bin/bash
# run_autoicon_example function that sets up an Autosubmit environment for the ICON model
function run_autoicon_example() { function run_autoicon_example() {
# Read the input parameters # Read the input parameters
local EXPID=$1 local EXPID=$1
local ICON_CASE=$2 local ICON_CASE=$2
local ICON_VERSION=$3 local ICON_VERSION=$3
local EXTRA_NAMELIST=$4 local PLATFORM=$4
local EXTRA_NAMELIST=${5:-""}
local EXTRA_CONFIGURATION=${6:-""}
# Setup environment # Setup environment
...@@ -16,6 +20,7 @@ function run_autoicon_example() { ...@@ -16,6 +20,7 @@ function run_autoicon_example() {
# Set up project # Set up project
setup_project "$EXPID" setup_project "$EXPID"
# Create and run the experiment
create_and_run_experiment "$EXPID" create_and_run_experiment "$EXPID"
} }
...@@ -85,7 +90,7 @@ CONFIG: ...@@ -85,7 +90,7 @@ CONFIG:
RETRIALS: 0 RETRIALS: 0
DEFAULT: DEFAULT:
EXPID: "$EXPID" EXPID: "$EXPID"
HPCARCH: "LOCAL" # use LMU to run on cluster HPCARCH: "${PLATFORM}" # use LMU to run on cluster
CUSTOM_CONFIG: CUSTOM_CONFIG:
PRE: PRE:
- "%PROJDIR%/conf/common" - "%PROJDIR%/conf/common"
...@@ -123,14 +128,21 @@ icon: ...@@ -123,14 +128,21 @@ icon:
data_management: data_management:
# Where do we put the output files afterwards? # Where do we put the output files afterwards?
local_destination_folder: $OUTPUTDIR/ local_destination_folder: $OUTPUTDIR/
Platforms: Platforms:
DUMMY: Dummy:
TYPE: ps type: ps
EOF EOF
# If EXTRA_NAMELIST is provided, create and write the extra namelist file # If EXTRA_NAMELIST is provided, create and write the extra namelist file
if [ -z "$EXTRA_NAMELIST" ]; then if [ ! -z "$EXTRA_CONFIGURATION" ]; then
cat >autosubmit/${EXPID}/conf/extra_conf.yml <<EOF
$EXTRA_CONFIGURATION
EOF
fi
# If EXTRA_NAMELIST is provided, create and write the extra namelist file
if [ ! -z "$EXTRA_NAMELIST" ]; then
cat >autosubmit/${EXPID}/conf/extra_namelist.yml <<EOF cat >autosubmit/${EXPID}/conf/extra_namelist.yml <<EOF
$EXTRA_NAMELIST $EXTRA_NAMELIST
EOF EOF
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment