source: CONFIG_DEVT/ORCHIDEE_OL_TP/ENSEMBLE/post_FLUXNET @ 5570

Last change on this file since 5570 was 5570, checked in by aclsce, 3 years ago

Created ORCHIDEE_OL_TP configuration : temporary configuration to be used during prectical session.

  • Property svn:executable set to *
File size: 7.1 KB
Line 
1#!/bin/ksh
2
3########################################################################
4
5#D- Flag to determine if this job in a standalone mode
6#D- Default : value from AA_job if any
7StandAlone=${StandAlone:=true}
8
9#D- Increased verbosity (1, 2, 3)
10#D- Default : value from AA_job if any
11Verbosity=${Verbosity:=3}
12
13#D- Low level debug : to bypass lib test checks and stack construction
14#D- Default : value from AA_job if any
15DEBUG_debug=${DEBUG_debug:=false}
16
17
18########################################################################
19
20MODIPSL=$1
21libIGCM=${libIGCM:=${MODIPSL}/libIGCM}
22
23. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
24. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
25. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
26#-------
27. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
28. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
29. ${libIGCM}/libIGCM_comp/libIGCM_comp.ksh
30. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
31#-------
32( ${DEBUG_debug} ) && IGCM_debug_Check
33( ${DEBUG_debug} ) && IGCM_card_Check
34( ${DEBUG_debug} ) && IGCM_date_Check
35
36#D--------------------------------------------------------------------==
37#D- 0.1 COMMON ENVIRONMENT
38#D-     - Read libIGCM compatibility version in config.card
39#D-     - Read UserChoices section
40#D-     - Read Ensemble section
41#D-     - Read Post section
42#D-     - Define all netcdf output directories
43#D--------------------------------------------------------------------==
44IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card
45
46
47#D--------------------------------------------------------------------==
48#D- 1. INITIALIZE CONFIGURATION
49#D-    - Simulation configuration
50#D-    - Simulation parameters
51#D-    - Execution parameter
52#D-    - Define input files directory
53#D-    - Read or initialize CumulPeriod
54#D-    - run.card
55#D---------------------------------------------------------------------==
56IGCM_config_Initialize
57
58
59
60########################################################################
61#set -vx
62########################################################################
63# Script input parameters
64
65Group=$2
66# Site name
67SiteArg=$3
68Site=${SiteArg:=Gu}
69export Site
70## Time in years in file for this site :
71#DureeArg=$4
72#DUREE=${DureeArg:=1}
73#export DUREE
74#
75## First year in file for this site :
76#FirstArg=$5
77#FYEAR=${FirstArg:=1}
78#export FYEAR
79#
80#(( LYEAR=FYEAR+DUREE-1 ))
81#export LYEAR
82
83
84# Atlas Name :
85AtlasCfgArg=$4
86AtlasCfg=${AtlasCfgArg:=atlas_FLUXNET.cfg}
87
88# observation_file
89eval observation_file_pathArg=$5
90observation_file=${observation_file_pathArg}
91echo observation_file=${observation_file}
92
93# Modulo for SpinUp years
94ModuloArg=${8}
95echo "ModuloArg:" $ModuloArg
96
97IGCM_sys_MkdirWork ${RUN_DIR_PATH}
98echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
99IGCM_sys_Cd ${RUN_DIR_PATH}
100
101if [ ${StandAlone} = true ] ; then
102    CARD_DIR=${SUBMIT_DIR}
103else
104    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
105    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
106fi
107
108#
109# First of all
110#
111IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card UserChoices
112typeset option
113for option in ${config_UserChoices[*]} ; do
114    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
115done
116#
117echo
118IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
119IGCM_debug_PrintVariables 3 config_UserChoices_JobName
120if [ 3 -le ${Verbosity} ] ; then
121    echo "--------------Debug3-->" "config_UserChoices_LongName="
122    echo "--------------Debug3-->" \"${config_UserChoices_LongName}\"
123fi
124IGCM_debug_PrintVariables 3 config_UserChoices_TagName
125IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
126IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
127IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
128IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
129echo
130
131
132# FLAG = SECHIBA, OK_STOMATE
133IGCM_card_DefineVariableFromOption ${CARD_DIR}/ensemble.card UserChoices ok_stomate
134if [ X${ensemble_UserChoices_ok_stomate} = Xn ] ; then
135    export FLAG=SECHIBA
136else
137    export FLAG=OK_STOMATE
138fi
139
140
141#==================================
142
143SpinUpJob=${Site}${config_UserChoices_JobName}
144set -A liste_fichiers_with_path -- $( \ls -rt ${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_UserChoices_JobName}/${SpinUpJob}HIST/SRF/Output/MO/*_sechiba_history.nc )
145echo liste_fichiers_with_path=${liste_fichiers_with_path}
146ii=0
147for filetmp in ${liste_fichiers_with_path[@]} ; do
148    (( ii = ii + 1 ))
149    file=$( echo ${filetmp} | xargs basename )
150done
151if [ $ii -ne 1 ] ; then
152  echo "Error. More than one file found. ii=$ii"
153  exit
154fi
155echo file=$file
156
157# Get and sed atlas
158IGCM_sys_Cp ${CARD_DIR}/${AtlasCfg} ./atlas.cfg
159IGCM_sys_Cp ${CARD_DIR}/ORCHIDEE_3dif.jnl ./ORCHIDEE_3dif.jnl
160   
161IGCM_sys_Cp -Rp ${liste_fichiers_with_path[0]} .
162
163# old history file
164reference_file_pathArg=$6
165if [ X${reference_file_pathArg} == XNONE ] ; then
166    reference_file_path=${liste_fichiers_with_path}
167else
168    reference_file_path=${reference_file_pathArg}
169fi
170
171eval reference_file=${reference_file_path}
172sed -e "s,RRRRRRR,${reference_file},g" -e "s,VVVVVVV,${observation_file},g" atlas.cfg > atlas_.cfg
173
174echo "REFERENCE ATLAS for file : " ${file} ${reference_file} ${observation_file}
175reference_config=$7
176atlas -o ${SpinUpJob}_${reference_config} atlas_.cfg ${file}
177
178# Remove small files before saving
179if [ X$CleanSmallFiles = Xyes ] ; then
180  tmpdir=${SpinUpJob}_${reference_config}
181  # Remove .info .tex .jnl .stdout .jpg .pdf (deuxieme niveau )
182  echo "Remove small files before saving : "
183  sumfilestoremove=$(( $( find ${tmpdir} -name "*.info" | wc -l ) +  $( find ${tmpdir} -name "*.tex" | wc -l ) +  $( find ${tmpdir} -name "*.jnl" | wc -l ) + $( find ${tmpdir} -name "*.stdout" | wc -l ) + $( find ${tmpdir} -name "*.pdf" | wc -l ) ))
184  echo "Following $sumfilestoremove files listed below will be removed: "
185
186  find ${tmpdir} -name "*.info"
187  find ${tmpdir} -name "*.tex" 
188  find ${tmpdir} -name "*.jnl" 
189  find ${tmpdir} -name "*.stdout"
190  find ${tmpdir} -name "*.pdf" 
191
192  # Now remove them
193  find ${tmpdir} -name "*.info" -print -exec rm -f '{}' \;
194  find ${tmpdir} -name "*.tex" -print -exec rm -f '{}' \;
195  find ${tmpdir} -name "*.jnl" -print -exec rm -f '{}' \;
196  find ${tmpdir} -name "*.stdout" -print -exec rm -f '{}' \;
197  find ${tmpdir} -name "*.pdf" -print -exec rm -f '{}' \;
198
199else
200  echo "No clean of small files will be done."
201fi
202
203
204# Save files
205R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_UserChoices_JobName}/fluxnet_taylor_diff_${config_UserChoices_JobName}_${reference_config}_${Group}
206
207echo "Before IGCM_sys_Put_Dir : destination= ${R_SAVE}"
208IGCM_sys_Put_Dir ${SpinUpJob}_${reference_config} ${R_SAVE}
209
210IGCM_sys_Rm -Rf ${SpinUpJob}_${reference_config}
211
212
213
214# # Get and Apply Patch
215# . ${MODIPSL}/libIGCM/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh
216# for file in ${liste_fichiers[*]} ; do
217#     IGCM_Patch_20070220_histcom_time_axis ${file}
218# done
219
220# # look at files
221# echo "after Patch" IGCM_Patch_20070220_histcom_time_axis
222# \ls -lrt  *_sechiba_history.nc
223
224# Concat files
225#IGCM_sys_ncrcat -o ${SpinUpJob}_1M_sechiba_history.nc ${liste_fichiers[*]}
226
227IGCM_sys_Rm -Rf  ${liste_fichiers[*]}
228
229IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.