rc-qlc 0.3.24__cp310-cp310-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. qlc/__init__.py +8 -0
  2. qlc/cli/__init__.py +21 -0
  3. qlc/cli/installer.py +16 -0
  4. qlc/cli/qlc_main.py +185 -0
  5. qlc/cli/qlc_py_main.py +74 -0
  6. qlc/config/json/qlc_config.json +41 -0
  7. qlc/config/json/qlc_config_example_1a_all-obs.json +237 -0
  8. qlc/config/json/qlc_config_example_1b_all-mod.json +353 -0
  9. qlc/config/json/qlc_config_example_1c_all-coll.json +266 -0
  10. qlc/config/json/qlc_config_example_2a_all-obs.json +237 -0
  11. qlc/config/json/qlc_config_example_2b_all-mod.json +353 -0
  12. qlc/config/json/qlc_config_example_2c_all-coll.json +265 -0
  13. qlc/config/json/qlc_config_example_3a-us_obs.json +82 -0
  14. qlc/config/json/qlc_config_example_3b-us_mod.json +122 -0
  15. qlc/config/json/qlc_config_example_3c-us_coll.json +46 -0
  16. qlc/config/json/qlc_config_example_4a_eu-obs.json +41 -0
  17. qlc/config/json/qlc_config_example_4b_eu-mod.json +122 -0
  18. qlc/config/json/qlc_config_example_4c_eu-coll.json +45 -0
  19. qlc/config/nml/mars_A1_sfc.nml +19 -0
  20. qlc/config/nml/mars_A2_sfc.nml +19 -0
  21. qlc/config/nml/mars_A3_sfc.nml +19 -0
  22. qlc/config/nml/mars_B1_pl.nml +19 -0
  23. qlc/config/nml/mars_B2_pl.nml +19 -0
  24. qlc/config/nml/mars_C1_pl.nml +19 -0
  25. qlc/config/nml/mars_C2_pl.nml +19 -0
  26. qlc/config/nml/mars_C3_ml.nml +19 -0
  27. qlc/config/nml/mars_D.nml +19 -0
  28. qlc/config/nml/mars_E.nml +19 -0
  29. qlc/config/nml/mars_F.nml +19 -0
  30. qlc/config/nml/mars_G.nml +19 -0
  31. qlc/config/qlc_cams.conf +26 -0
  32. qlc/config/qlc_test.conf +26 -0
  33. qlc/config/qlc_tex.conf +107 -0
  34. qlc/doc/CONTRIBUTING.md +105 -0
  35. qlc/doc/README.md +116 -0
  36. qlc/doc/USAGE.md +58 -0
  37. qlc/examples/cams_case_1/config/json/qlc_config.json +41 -0
  38. qlc/examples/cams_case_1/config/nml/mars_A3_sfc.nml +19 -0
  39. qlc/examples/cams_case_1/config/nml/mars_B1_pl.nml +19 -0
  40. qlc/examples/cams_case_1/config/nml/mars_C1_pl.nml +19 -0
  41. qlc/examples/cams_case_1/config/qlc_cams.conf +122 -0
  42. qlc/examples/cams_case_1/mod/b2ro/2018/b2ro_20181215-20181231_A3_sfc.grb +0 -0
  43. qlc/examples/cams_case_1/mod/iqi9/2018/iqi9_20181215-20181231_A3_sfc.grb +0 -0
  44. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181201.nc +0 -0
  45. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181202.nc +0 -0
  46. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181203.nc +0 -0
  47. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181204.nc +0 -0
  48. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181205.nc +0 -0
  49. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181206.nc +0 -0
  50. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181207.nc +0 -0
  51. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181208.nc +0 -0
  52. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181209.nc +0 -0
  53. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181210.nc +0 -0
  54. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181211.nc +0 -0
  55. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181212.nc +0 -0
  56. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181213.nc +0 -0
  57. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181214.nc +0 -0
  58. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181215.nc +0 -0
  59. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181216.nc +0 -0
  60. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181217.nc +0 -0
  61. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181218.nc +0 -0
  62. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181219.nc +0 -0
  63. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181220.nc +0 -0
  64. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181221.nc +0 -0
  65. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181222.nc +0 -0
  66. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181223.nc +0 -0
  67. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181224.nc +0 -0
  68. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181225.nc +0 -0
  69. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181226.nc +0 -0
  70. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181227.nc +0 -0
  71. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181228.nc +0 -0
  72. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181229.nc +0 -0
  73. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181230.nc +0 -0
  74. qlc/examples/cams_case_1/obs/ebas_daily/v_20240216/201812/ebas_20181231.nc +0 -0
  75. qlc/examples/cams_case_1/obs/ebas_station-locations.csv +50 -0
  76. qlc/install.py +285 -0
  77. qlc/py/__main__.cp310-win32.pyd +0 -0
  78. qlc/py/averaging.cp310-win32.pyd +0 -0
  79. qlc/py/bias_plots.cp310-win32.pyd +0 -0
  80. qlc/py/control.cp310-win32.pyd +0 -0
  81. qlc/py/io.cp310-win32.pyd +0 -0
  82. qlc/py/loadmod.cp310-win32.pyd +0 -0
  83. qlc/py/loadobs.cp310-win32.pyd +0 -0
  84. qlc/py/logging_utils.cp310-win32.pyd +0 -0
  85. qlc/py/map_plots.cp310-win32.pyd +0 -0
  86. qlc/py/matched.cp310-win32.pyd +0 -0
  87. qlc/py/plot_config.cp310-win32.pyd +0 -0
  88. qlc/py/plotting.cp310-win32.pyd +0 -0
  89. qlc/py/plugin_loader.cp310-win32.pyd +0 -0
  90. qlc/py/processing.cp310-win32.pyd +0 -0
  91. qlc/py/scatter_plots.cp310-win32.pyd +0 -0
  92. qlc/py/stations.cp310-win32.pyd +0 -0
  93. qlc/py/statistics.cp310-win32.pyd +0 -0
  94. qlc/py/style.cp310-win32.pyd +0 -0
  95. qlc/py/timeseries_plots.cp310-win32.pyd +0 -0
  96. qlc/py/utils.cp310-win32.pyd +0 -0
  97. qlc/py/version.cp310-win32.pyd +0 -0
  98. qlc/sh/qlc_A1.sh +127 -0
  99. qlc/sh/qlc_B1a.sh +123 -0
  100. qlc/sh/qlc_B2.sh +258 -0
  101. qlc/sh/qlc_C5.sh +825 -0
  102. qlc/sh/qlc_D1.sh +130 -0
  103. qlc/sh/qlc_Z1.sh +165 -0
  104. qlc/sh/qlc_common_functions.sh +157 -0
  105. qlc/sh/qlc_main.sh +127 -0
  106. qlc/sh/qlc_start.sh +23 -0
  107. qlc/sh/qlc_start_batch.sh +46 -0
  108. rc_qlc-0.3.24.dist-info/METADATA +142 -0
  109. rc_qlc-0.3.24.dist-info/RECORD +113 -0
  110. rc_qlc-0.3.24.dist-info/WHEEL +5 -0
  111. rc_qlc-0.3.24.dist-info/entry_points.txt +6 -0
  112. rc_qlc-0.3.24.dist-info/licenses/LICENSE +21 -0
  113. rc_qlc-0.3.24.dist-info/top_level.txt +1 -0
qlc/sh/qlc_D1.sh ADDED
@@ -0,0 +1,130 @@
1
+ #!/bin/sh -e
2
+
3
+ # Source the configuration file to load the settings
4
+ . "$CONFIG_FILE"
5
+ # Include common functions
6
+ source $FUNCTIONS
7
+
8
+ PLOTTYPE="python"
9
+ SCRIPT="$0"
10
+ log "________________________________________________________________________________________"
11
+ log "Start ${SCRIPT} at `date`"
12
+ log "Create Python plots for selected variables (to be defined in $CONFIG_FILE) "
13
+ #log "----------------------------------------------------------------------------------------"
14
+ #log "Copyright (c) 2021-2025 ResearchConcepts io GmbH. All Rights Reserved. "
15
+ #log "Questions / comments to: Swen M. Metzger <sm@researchconcepts.io> "
16
+ log "----------------------------------------------------------------------------------------"
17
+
18
+ # Loop through and process the parameters received
19
+ for param in "$@"; do
20
+ log "Subscript $0 received parameter: $param"
21
+ done
22
+
23
+ log "$0 ANALYSIS_DIRECTORY = $ANALYSIS_DIRECTORY"
24
+ pwd -P
25
+
26
+ # module load for ATOS
27
+ myOS="`uname -s`"
28
+ HOST=`hostname -s | awk '{printf $1}' | cut -c 1`
29
+ #log ${HOST} ${ARCH}
30
+ if [ "${HOST}" == "a" ] && [ "${myOS}" != "Darwin" ]; then
31
+ module load python3/3.10.10-01
32
+ fi
33
+
34
+ # Check if python exists
35
+ if ! command_exists python; then
36
+ log "Error: python command not found" >&2
37
+ exit 1
38
+ else
39
+ log "Success: python command found"
40
+ which python
41
+ fi
42
+
43
+ # Create output directory if not existent
44
+ if [ ! -d "$PLOTS_DIRECTORY" ]; then
45
+ mkdir -p "$PLOTS_DIRECTORY"
46
+ fi
47
+
48
+ # get script name without path and extension
49
+ script_name="${SCRIPT##*/}" # Remove directory path
50
+ script_name="${script_name%.*}" # Remove extension
51
+ QLTYPE="$script_name"
52
+
53
+ # Assign the command line input parameters to variables
54
+ exp1="$1"
55
+ exp2="$2"
56
+ sDat="$3"
57
+ eDat="$4"
58
+ sDate="${sDat//[-:]/}"
59
+ eDate="${eDat//[-:]/}"
60
+ mDate="$sDate-$eDate"
61
+ ext="${QLTYPE}.pdf"
62
+
63
+ exps="$exp1 $exp2"
64
+ for exp in $exps ; do
65
+ log "Processing ${PLOTTYPE} plot for experiment: $exp"
66
+
67
+ log "TEAM_PREFIX : $TEAM_PREFIX"
68
+ log "EVALUATION_PREFIX: $EVALUATION_PREFIX"
69
+ log "MODEL_RESOLUTION : $MODEL_RESOLUTION"
70
+ log "TIME_RESOLUTION : $TIME_RESOLUTION"
71
+ log "mDate : $mDate"
72
+ log "ext : $ext"
73
+ log "exp1 : $exp1"
74
+ log "exp2 : $exp2"
75
+
76
+ ipath="$ANALYSIS_DIRECTORY/$exp"
77
+ tpath="$PLOTS_DIRECTORY/$exp"
78
+ hpath="$PLOTS_DIRECTORY/${exp1}-${exp2}_${mDate}"
79
+
80
+ # Create help directory if not existent
81
+ if [ ! -d "$hpath" ]; then
82
+ mkdir -p "$hpath"
83
+ fi
84
+
85
+ # Create output directory if not existent
86
+ if [ ! -d "$tpath" ]; then
87
+ mkdir -p "$tpath"
88
+ fi
89
+
90
+ for name in "${MARS_RETRIEVALS[@]}"; do
91
+
92
+ log "name : $name"
93
+
94
+ # Define the corresponding arrays based on the name
95
+ param_var="param_${name}[@]"
96
+ ncvar_var="ncvar_${name}[@]"
97
+ myvar_var="myvar_${name}[@]"
98
+
99
+ # Use variable indirection to access the arrays
100
+ param=("${!param_var}")
101
+ ncvar=("${!ncvar_var}")
102
+ myvar=("${!myvar_var}")
103
+
104
+ cd $ipath
105
+
106
+ # Loop through the variables for this $name
107
+ for ((i = 0; i < ${#ncvar[@]}; i++)); do
108
+
109
+ myvar_name="${myvar[i]}"
110
+ log "myvar_name : $myvar_name"
111
+
112
+ tfile="${EVALUATION_PREFIX}_${exp1}-${exp2}_${myvar_name}_${mDate}_${name}_$ext"
113
+ log "${PLOTTYPE} plot for: $myvar_name - $tpath/$tfile"
114
+ log "work in progress, plot scripts to be implemented ..."
115
+
116
+ touch $tpath/$tfile
117
+ ls -lh $tpath/$tfile
118
+
119
+ done # ncvar
120
+ done # name
121
+ done # exps
122
+
123
+ log "$ipath"
124
+ log "$tpath"
125
+
126
+ log "----------------------------------------------------------------------------------------"
127
+ log "End ${SCRIPT} at `date`"
128
+ log "________________________________________________________________________________________"
129
+
130
+ exit 0
qlc/sh/qlc_Z1.sh ADDED
@@ -0,0 +1,165 @@
1
+ #!/bin/sh -e
2
+
3
+ # Source the configuration file to load the settings
4
+ . "$CONFIG_FILE"
5
+ # Include common functions
6
+ source $FUNCTIONS
7
+
8
+ CUSR="`echo $USER`"
9
+ PLOTTYPE="pdftex"
10
+ SCRIPT="$0"
11
+ log "________________________________________________________________________________________"
12
+ log "Start ${SCRIPT} at `date`"
13
+ #log "----------------------------------------------------------------------------------------"
14
+ #log "Copyright (c) 2021-2025 ResearchConcepts io GmbH. All Rights Reserved. "
15
+ #log "Questions / comments to: Swen M. Metzger <sm@researchconcepts.io> "
16
+ log "----------------------------------------------------------------------------------------"
17
+
18
+ # Loop through and process the parameters received
19
+ for param in "$@"; do
20
+ log "Subscript $0 received parameter: $param"
21
+ done
22
+
23
+ log "$0 TEX_DIRECTORY = $TEX_DIRECTORY"
24
+ pwd -P
25
+
26
+ # module load for ATOS
27
+ myOS="`uname -s`"
28
+ HOST=`hostname -s | awk '{printf $1}' | cut -c 1`
29
+ #log ${HOST} ${ARCH}
30
+ if [ "${HOST}" == "a" ] && [ "${myOS}" != "Darwin" ]; then
31
+ module load texlive/2022
32
+ fi
33
+ # Check if pdflatex exists
34
+ if ! command_exists pdflatex; then
35
+ log "Error: pdflatex command not found" >&2
36
+ exit 1
37
+ else
38
+ log "Success: pdflatex command found"
39
+ TEX="`which pdflatex` -interaction=batchmode -shell-escape"
40
+ log "${TEX}"
41
+ fi
42
+
43
+ # get script name without path and extension
44
+ script_name="${SCRIPT##*/}" # Remove directory path
45
+ script_name="${script_name%.*}" # Remove extension
46
+ QLTYPE="$script_name" # qlc script type
47
+ base_name="${QLTYPE%_*}" # Remove subscript
48
+ CDATE="20`date +"%y%m%d%H"`" # pdf creation date
49
+ CDATE="20`date +"%y%m%d%H%M"`" # pdf creation date
50
+ ext="$PLOTEXTENSION" # embedded plot type
51
+
52
+ # Assign the command line input parameters to variables
53
+ exp1="$1"
54
+ exp2="$2"
55
+ sDat="$3"
56
+ eDat="$4"
57
+ sDate="${sDat//[-:]/}"
58
+ eDate="${eDat//[-:]/}"
59
+ mDate="$sDate-$eDate"
60
+
61
+ # definition of tex file name
62
+ pfile="${TEAM_PREFIX}_${exp1}-${exp2}_${mDate}_${QLTYPE}-${ext}_${CDATE}"
63
+ log "pfile base name : $pfile"
64
+
65
+ tpath="${TEX_DIRECTORY}/${pfile}"
66
+ hpath="$PLOTS_DIRECTORY/${exp1}-${exp2}_${mDate}"
67
+
68
+ # Create help directory if not existent
69
+ if [ ! -d "$hpath" ]; then
70
+ mkdir -p "$hpath"
71
+ fi
72
+
73
+ # Create output directory if not existent
74
+ if [ ! -d "$tpath" ]; then
75
+ mkdir -p "$tpath"
76
+ fi
77
+
78
+ cd ${tpath}
79
+ pwd -P
80
+
81
+ if [ -d "$SCRIPTS_PATH/tex_template" ]; then
82
+ rm -rf ${tpath}/tex
83
+ cp -rp $SCRIPTS_PATH/tex_template ${tpath}/tex
84
+ else
85
+ log "Error: tex template not found! : $SCRIPTS_PATH/tex_template"
86
+ exit 1
87
+ fi
88
+
89
+ log "----------------------------------------------------------------------------------------"
90
+ log "Processing ${PLOTTYPE}:"
91
+
92
+ log "QLTYPE : $QLTYPE"
93
+ log "TEAM_PREFIX : $TEAM_PREFIX"
94
+ log "EVALUATION_PREFIX: $EVALUATION_PREFIX"
95
+ log "MODEL_RESOLUTION : $MODEL_RESOLUTION"
96
+ log "TIME_RESOLUTION : $TIME_RESOLUTION"
97
+ log "mDate : $mDate"
98
+ log "ext : $ext"
99
+ log "exp1 : $exp1"
100
+ log "exp2 : $exp2"
101
+ log "USER : $CUSR"
102
+ log "DATE : $CDATE"
103
+
104
+ cd ${tpath}/tex
105
+ pwd -P
106
+
107
+ rm -f texPlotfiles.tex
108
+ touch texPlotfiles.tex
109
+
110
+ log "----------------------------------------------------------------------------------------"
111
+ for subname in "${SUBSCRIPT_NAMES[@]}"; do
112
+
113
+ name="${base_name}_${subname}"
114
+ log "name : $name"
115
+
116
+ # list name for plot files used for final tex pdf
117
+ texPlots="${hpath}/texPlotfiles_${name}.tex"
118
+ if [ -f "${texPlots}" ]; then
119
+ log "${texPlots}"
120
+ cat ${texPlots} >> texPlotfiles.tex
121
+ else
122
+ log "Note: No texPlotfiles_${name}.tex found!"
123
+ log "${texPlots}"
124
+ fi
125
+
126
+ done # name
127
+ log "----------------------------------------------------------------------------------------"
128
+ ls -lh texPlotfiles.tex
129
+ log "----------------------------------------------------------------------------------------"
130
+ cat texPlotfiles.tex > ./CAMS_PLOTS.tex
131
+ log "----------------------------------------------------------------------------------------"
132
+ log "./CAMS_PLOTS.tex"
133
+ cat ./CAMS_PLOTS.tex
134
+ log "----------------------------------------------------------------------------------------"
135
+ # Replace placeholders in the template file
136
+ # XXTIT, XXRES, XEXP1, XEXP2, XXDAT, XXAVG, XXUSR, XXTEAM
137
+ TEAM=$(echo "$TEAM_PREFIX" | sed 's/_/\\\\_/g')
138
+ log "TEAM $TEAM"
139
+ sed -e "s/XXTIT/${EVALUATION_PREFIX}/g" \
140
+ -e "s/XXRES/${MODEL_RESOLUTION}/g" \
141
+ -e "s/XEXP1/${exp1}/g" \
142
+ -e "s/XEXP2/${exp2}/g" \
143
+ -e "s/XXAVG/${TIME_RESOLUTION}/g" \
144
+ -e "s/XXDAT/${mDate}/g" \
145
+ -e "s/XXUSR/${CUSR}/g" \
146
+ -e "s|XTEAM|${TEAM}|g" \
147
+ "template.tex" > "./${pfile}.tex"
148
+ log "${TEX} ./${pfile}.tex"
149
+ ${TEX} ./${pfile}.tex
150
+ ${TEX} ./${pfile}.tex
151
+ mv ./${pfile}.pdf $TEX_DIRECTORY/
152
+ if [ "${myOS}" == "Darwin" ]; then
153
+ open $TEX_DIRECTORY/${pfile}.pdf
154
+ fi
155
+ ls -lh $TEX_DIRECTORY/${pfile}.pdf
156
+ rm -f *.aux *.nav *.out *.snm *.toc *.log
157
+ log "----------------------------------------------------------------------------------------"
158
+ log "$tpath"
159
+ log "----------------------------------------------------------------------------------------"
160
+
161
+ log "----------------------------------------------------------------------------------------"
162
+ log "End ${SCRIPT} at `date`"
163
+ log "________________________________________________________________________________________"
164
+
165
+ exit 0
@@ -0,0 +1,157 @@
1
+ #!/bin/sh
2
+
3
+ # Source the configuration file to load the settings
4
+ . "$CONFIG_FILE"
5
+
6
+ #log "----------------------------------------------------------------------------------------"
7
+ #log "Copyright (c) 2021-2025 ResearchConcepts io GmbH. All Rights Reserved. "
8
+ #log "Questions / comments to: Swen M. Metzger <sm@researchconcepts.io> "
9
+ #log "----------------------------------------------------------------------------------------"
10
+
11
+ myOS="`uname -s`"
12
+ HOST=`hostname -s | awk '{printf $1}' | cut -c 1`
13
+
14
+ # Function to log messages to a file
15
+ log() {
16
+ local timestamp
17
+ timestamp1=$(date +"%Y-%m-%d %H:%M:%S")
18
+ timestamp2=$(date +"%Y%m%d%H%M")
19
+ # timestamp2=$(date +"%Y%m%d%H")
20
+ local log_message="[$timestamp1] $1"
21
+
22
+ # Create log directory if not existent
23
+ if [ ! -d "$WORKING_DIRECTORY/log" ]; then
24
+ mkdir -p $WORKING_DIRECTORY/log
25
+ fi
26
+
27
+ # Specify the log file path
28
+ # local log_file="$WORKING_DIRECTORY/log/qlc_${timestamp2}_$$.log"
29
+ local log_file="$WORKING_DIRECTORY/log/qlc_${timestamp2}.log"
30
+
31
+ # Append the log message to the log file
32
+ echo "$log_message" >> "$log_file"
33
+ # echo "$log_message" | tee -a "$log_file"
34
+
35
+ # Also print the log message to the standard output (console)
36
+ echo "$log_message"
37
+ }
38
+
39
+ # Define the sorting function
40
+ sort_files() {
41
+ local script_name="$1"
42
+ local exp1="$2"
43
+ local exp2="$3"
44
+ local files_list="$4"
45
+ local ext="$5"
46
+ local hpath="$6"
47
+ local fnam
48
+ local fvar
49
+ local sorted_file_list="${hpath}/sorted_files_${script_name}.list"
50
+ local temp_file_list="${hpath}/temp_file_list_${script_name}.list"
51
+ local variable_list="${hpath}/var_list_${script_name}.list"
52
+
53
+ # Initialize arrays
54
+ fnam=()
55
+
56
+ # workaround for system dependency
57
+ if [ "${myOS}" == "Darwin" ]; then
58
+ # var_element=8
59
+ var_element=9
60
+ exp_element=10
61
+ else
62
+ # var_element=7
63
+ var_element=8
64
+ exp_element=9
65
+ fi
66
+
67
+ # Read the list of files from the file list
68
+ while read -r file; do
69
+ fnam+=("$file")
70
+ # Extract the variable name from the file name
71
+ IFS="_" read -ra parts <<< "$file"
72
+ var="${parts[$var_element]}"
73
+ fvar+=("$var")
74
+ vars+=" $var" # Create a space-separated list of variable names
75
+ done < "$files_list"
76
+
77
+ # Get unique variable list
78
+ echo "$vars" | tr ' ' '\n' | sort -u > $variable_list
79
+ var_list="`cat $variable_list`"
80
+ # echo $var_list
81
+
82
+ set -f # Disable globbing
83
+
84
+ # Split the var_list string into separate variables
85
+ set -- $var_list
86
+
87
+ # Create an array to store the variables
88
+ variables=()
89
+
90
+ # Store all variables from the var_list in the array
91
+ while [ "$#" -ge 1 ]; do
92
+ variables+=("$1")
93
+ shift
94
+ done
95
+
96
+ # Loop through the variables
97
+ for file_var in "${variables[@]}"; do
98
+ # Loop through the files and populate the temporary file
99
+ for file_nam in "${fnam[@]}"; do
100
+ fxxx="$file_nam"
101
+ # Extract the file name without directory and extension
102
+ file_xxx="${fxxx##*/}" # Remove directory path
103
+ file_yyy="${file_xxx%.*}" # Remove extension
104
+
105
+ # Split the file name into parts
106
+ IFS="_" read -ra parts <<< "$file_yyy"
107
+
108
+ tvar="${parts[$var_element]}"
109
+ texp="${parts[$exp_element]}"
110
+ ftype="$(echo "${parts[@]:$exp_element}.${ext}2" | sed 's| |_|g')"
111
+
112
+ if [ "$file_var" == "$tvar" ]; then
113
+ # echo "Processing file: $file_nam"
114
+ echo "$file_nam $ftype" >> "${temp_file_list}_${file_var}.$$"
115
+ # ls -lh ${temp_file_list}_${file_var}.$$
116
+ fi
117
+ done
118
+ done
119
+
120
+ set +f # Enable globbing
121
+
122
+ # Define the desired sorting order
123
+ # sorting_order=("${exp1}.${ext}2" "${exp2}.${ext}2" "${exp2}_diff.${ext}2" "${exp1}_log.${ext}2" "${exp2}_log.${ext}2" "${exp2}_log_diff.${ext}2")
124
+ # sorting_order=("${exp1}.${ext}2" "${exp2}.${ext}2" "${exp1}_diff.${ext}2" "${exp1}_log.${ext}2" "${exp2}_log.${ext}2" "${exp1}_log_diff.${ext}2")
125
+ sorting_order=("${exp1}_surface.${ext}2" "${exp2}_surface.${ext}2" "${exp1}_surface_diff.${ext}2" "${exp1}_surface_log.${ext}2" "${exp2}_surface_log.${ext}2" "${exp1}_surface_log_diff.${ext}2" \
126
+ "${exp1}_burden.${ext}2" "${exp2}_burden.${ext}2" "${exp1}_burden_diff.${ext}2" "${exp1}_burden_log.${ext}2" "${exp2}_burden_log.${ext}2" "${exp1}_burden_log_diff.${ext}2" \
127
+ "${exp1}_meridional.${ext}2" "${exp2}_meridional.${ext}2" "${exp1}_meridional_diff.${ext}2" "${exp1}_meridional_log.${ext}2" "${exp2}_meridional_log.${ext}2" "${exp1}_meridional_log_diff.${ext}2" \
128
+ "${exp1}_zonal.${ext}2" "${exp2}_zonal.${ext}2" "${exp1}_zonal_diff.${ext}2" "${exp1}_zonal_log.${ext}2" "${exp2}_zonal_log.${ext}2" "${exp1}_zonal_log_diff.${ext}2" \
129
+ "${exp1}_utls.${ext}2" "${exp2}_utls.${ext}2" "${exp1}_utls_diff.${ext}2" "${exp1}_utls_log.${ext}2" "${exp2}_utls_log.${ext}2" "${exp1}_utls_log_diff.${ext}2" \
130
+ )
131
+
132
+ # Sort the temporary files and write the sorted files to sorted_file.list
133
+ for file_var in "${variables[@]}"; do
134
+ for type in "${sorting_order[@]}"; do
135
+ grep -w "$type" "${temp_file_list}_${file_var}.$$" | sed "s|$type||g" >> "${sorted_file_list}_${file_var}.$$"
136
+ done
137
+ # ls -lh ${sorted_file_list}_${file_var}.$$
138
+ done
139
+ # Concatenate the sorted files into the final sorted_file_list
140
+ cat "${sorted_file_list}"*".$$" > "$sorted_file_list"
141
+ # ls -lh "$sorted_file_list"
142
+
143
+ sorted_list="$(cat "$sorted_file_list")"
144
+
145
+ # echo "Sorted file list: $sorted_file_list"
146
+ # echo "$sorted_list"
147
+
148
+ # Clean up the temporary file
149
+ rm -f ${sorted_file_list}*.$$ ${temp_file_list}*.$$
150
+ }
151
+
152
+ # Custom function to check if a command exists
153
+ command_exists() {
154
+ command -v "$1" >/dev/null 2>&1
155
+ }
156
+
157
+
qlc/sh/qlc_main.sh ADDED
@@ -0,0 +1,127 @@
1
+ #!/bin/sh -e
2
+ umask 0022
3
+
4
+ ARCH="`uname -m`"
5
+ myOS="`uname -s`"
6
+ HOST="`hostname -s`"
7
+ CUSR="`echo $USER`"
8
+ # user specific configuration file
9
+ QLC_DIR="$HOME/qlc"
10
+ CONFIG_DIR="$QLC_DIR/config"
11
+ CONFIG_FILE="$CONFIG_DIR/qlc.conf"
12
+ CONFIG_TEX="$CONFIG_DIR/qlc_tex.conf"
13
+
14
+ # Source the configuration file to load the settings
15
+ . "$CONFIG_FILE"
16
+ export CONFIG_DIR
17
+ export CONFIG_FILE
18
+ . "$CONFIG_TEX"
19
+ export CONFIG_TEX
20
+
21
+ # Include common functions
22
+ FUNCTIONS="$SCRIPTS_PATH/qlc_common_functions.sh"
23
+ source $FUNCTIONS
24
+ export FUNCTIONS
25
+
26
+ SCRIPT="$0"
27
+ log "________________________________________________________________________________________"
28
+ log "Start ${SCRIPT} at `date`"
29
+ log "----------------------------------------------------------------------------------------"
30
+ log "Purpose of QLC = Quick Look CAMS/IFS results -- ${HOST} on ${myOS} / ${ARCH} - ${CUSR} "
31
+ log " QLC uses subscripts defined in $CONFIG_FILE "
32
+ log " see $QLC_DIR/doc/README.md for details "
33
+ log "Don^t expect too much, as we follow the KISS principle >Keep it simple, stupid!< ;-) ..."
34
+ log "________________________________________________________________________________________"
35
+ log "Copyright (c) 2021-2025 ResearchConcepts io GmbH. All Rights Reserved. "
36
+ log "Questions / comments to: Swen M. Metzger <sm@researchconcepts.io> "
37
+ log "----------------------------------------------------------------------------------------"
38
+
39
+ # Check if the required parameters are provided
40
+ if [ $# -eq 0 ]; then
41
+ log "Error: No parameters provided. Please provide your parameters in the following syntax:"
42
+ log "$0 exp1 exp2 startDate endDate, e.g.:"
43
+ log "$0 b2ro iqi9 2018-12-15 2018-12-31 mars"
44
+ log "$0 b2ro iqi9 2019-01-01 2019-01-31"
45
+ log "________________________________________________________________________________________"
46
+ log "End ${SCRIPT} at `date`"
47
+ log "________________________________________________________________________________________"
48
+ exit 1
49
+ fi
50
+
51
+ # Loop through the provided parameters
52
+ for param in "$@"; do
53
+ log "Command line input: $param"
54
+ done
55
+
56
+ # Check if the configuration file exists
57
+ if [ -f "$CONFIG_FILE" ]; then
58
+ # Read and export the variables from the configuration file
59
+ while IFS= read -r line; do
60
+ var_name=$(echo "$line" | cut -d= -f1)
61
+ var_value=$(echo "$line" | cut -d= -f2-)
62
+
63
+ # Check if the variable is an array
64
+ if [[ "$var_value" =~ "^[[:space:]]*\(.*\)[[:space:]]*$" ]]; then
65
+ eval "array=($var_value)"
66
+ for element in "${array[@]}"; do
67
+ log "Configuration file: $var_name=$element"
68
+ # export "$var_name"
69
+ done
70
+ else
71
+ log "Configuration file: $var_name=$var_value"
72
+ # export "$var_name"
73
+ fi
74
+ done < "$CONFIG_FILE"
75
+ else
76
+ log "Error: Config file '$CONFIG_FILE' not found."
77
+ exit 1
78
+ fi
79
+
80
+ # Check if the SUBSCRIPT_NAMES array is defined
81
+ if [ -z "${SUBSCRIPT_NAMES[*]}" ]; then
82
+ log "Error: SUBSCRIPT_NAMES is not defined in the configuration file."
83
+ exit 1
84
+ fi
85
+
86
+ # Create working directory if not existent
87
+ if [ ! -d "$WORKING_DIRECTORY" ]; then
88
+ mkdir -p $WORKING_DIRECTORY
89
+ fi
90
+
91
+ # Create a temporary directory and store its path in a variable
92
+ #TEMP_DIR=$(mktemp -d)
93
+ TEMP_DIR=$WORKING_DIRECTORY
94
+ export TEMP_DIR
95
+
96
+ # Change to the temporary directory
97
+ cd "$TEMP_DIR"
98
+ PWD="`pwd -P`"
99
+ log "changed to directory: $PWD"
100
+
101
+ # Loop through and call the specified subscripts individually
102
+ for name in "${SUBSCRIPT_NAMES[@]}"; do
103
+ script_name="qlc_${name}.sh"
104
+ log "processing subscript: $script_name"
105
+
106
+ if [ -f "$SCRIPTS_PATH/$script_name" ]; then
107
+ # Call the subscript
108
+ log "$SCRIPTS_PATH/$script_name" "$@"
109
+ "$SCRIPTS_PATH/$script_name" "$@"
110
+
111
+ if [ "$5" == "mars" ]; then
112
+ log "Only calling the mars retrieval script, the other processes can be called in the second qlc submission step (without option: mars)"
113
+ exit 1
114
+ fi
115
+
116
+ else
117
+ log "Error: $script_name not found in $SCRIPTS_PATH."
118
+ fi
119
+ done
120
+
121
+ pwd -P
122
+ log "----------------------------------------------------------------------------------------"
123
+ log "End ${SCRIPT} at `date`"
124
+ log "________________________________________________________________________________________"
125
+
126
+ exit 0
127
+
qlc/sh/qlc_start.sh ADDED
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+ SCRIPT="$0"
3
+ echo "________________________________________________________________________________________"
4
+ echo "Start ${SCRIPT} at `date`"
5
+ #echo "----------------------------------------------------------------------------------------"
6
+ #echo "Copyright (c) 2021-2025 ResearchConcepts io GmbH. All Rights Reserved. "
7
+ #echo "Questions / comments to: Swen M. Metzger <sm@researchconcepts.io> "
8
+ echo "----------------------------------------------------------------------------------------"
9
+ if [ "$1" == "" ] ;then
10
+ ls -lrth $HOME/qlc/log/qlc*
11
+ echo "type, e.g.:"
12
+ echo "$HOME/qlc/bin/qlc_start.sh b2ro iqi9 2018-12-01 2018-12-31 mars log001"
13
+ echo "________________________________________________________________________________________"
14
+ echo "End ${SCRIPT} at `date`"
15
+ echo "________________________________________________________________________________________"
16
+ exit 0
17
+ fi
18
+ $HOME/qlc/bin/qlc $1 $2 $3 $4 $5 mars >& $HOME/qlc/log/qlc.$6 &
19
+ echo "tail -f $HOME/qlc/log/qlc.$6"
20
+ echo "________________________________________________________________________________________"
21
+ echo "End ${SCRIPT} at `date`"
22
+ echo "________________________________________________________________________________________"
23
+ exit 0
@@ -0,0 +1,46 @@
1
+ #!/bin/sh -e
2
+ SCRIPT="$0"
3
+ echo "________________________________________________________________________________________"
4
+ echo "Start ${SCRIPT} at `date`"
5
+ #echo "----------------------------------------------------------------------------------------"
6
+ #echo "Copyright (c) 2021-2025 ResearchConcepts io GmbH. All Rights Reserved. "
7
+ #echo "Questions / comments to: Swen M. Metzger <sm@researchconcepts.io> "
8
+ echo "----------------------------------------------------------------------------------------"
9
+ if [ "$1" == "" ] ;then
10
+ echo "type, e.g.:"
11
+ echo "$HOME/qlc/bin/sqlc b2ro iqi9 2018-12-01 2018-12-31"
12
+ echo "$HOME/qlc/bin/sqlc b2ro iqi9 2018-12-01 2018-12-31 mars"
13
+ echo "Use option 'mars' to retrieve files and then submit a dependency job once all data have been retrieved."
14
+ echo "Or, option 'mars' can be skipped, if all data are already present in $HOME/qlc/Results"
15
+ echo "________________________________________________________________________________________"
16
+ echo "End ${SCRIPT} at `date`"
17
+ echo "________________________________________________________________________________________"
18
+ exit 0
19
+ fi
20
+ if [ "$5" == "mars" ] ;then
21
+ jobid='${SLURM_JOB_ID}'
22
+ cat > $HOME/qlc/run/qlc_batch.sh$$<<EOF
23
+ #!/bin/ksh -e
24
+ #SBATCH --job-name=$HOME/qlc/run/qlc_batch.sh$$
25
+ #SBATCH --output=log-%J.out
26
+ #SBATCH --error=err-%J.out
27
+ #SBATCH --export=ALL
28
+ $HOME/qlc/bin/qlc $1 $2 $3 $4 $5
29
+ echo "SLURM_JOB_ID = ${jobid}"
30
+ sbatch --dependency=afterok:${jobid} --mail-user=$USER@ecmwf.int $HOME/qlc/bin/qlc $1 $2 $3 $4
31
+ EOF
32
+ else
33
+ cat > $HOME/qlc/run/qlc_batch.sh$$<<EOF
34
+ #!/bin/ksh -e
35
+ #SBATCH --job-name=$HOME/qlc/run/qlc_batch.sh$$
36
+ #SBATCH --output=log-%J.out
37
+ #SBATCH --error=err-%J.out
38
+ $HOME/qlc/bin/qlc $1 $2 $3 $4
39
+ EOF
40
+ fi
41
+ sbatch $HOME/qlc/run/qlc_batch.sh$$
42
+ squeue -u "$USER"
43
+ echo "________________________________________________________________________________________"
44
+ echo "End ${SCRIPT} at `date`"
45
+ echo "________________________________________________________________________________________"
46
+ exit 0