1 | #!/bin/ksh |
---|
2 | |
---|
3 | #D--------------------------------------------------------------------== |
---|
4 | |
---|
5 | function FLUXNET_initialize |
---|
6 | { |
---|
7 | IGCM_debug_PushStack "FLUXNET_initialize" |
---|
8 | |
---|
9 | # config.card : |
---|
10 | # ------------- |
---|
11 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices |
---|
12 | typeset option |
---|
13 | for option in ${config_UserChoices[*]} ; do |
---|
14 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option} |
---|
15 | done |
---|
16 | |
---|
17 | DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) |
---|
18 | IGCM_date_GetYearMonth ${DateBegin} year month |
---|
19 | |
---|
20 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card SRF |
---|
21 | typeset option |
---|
22 | for option in ${config_SRF[*]} ; do |
---|
23 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card SRF ${option} |
---|
24 | done |
---|
25 | if [ X"${fluxnet_UserChoices_ok_stomate}" = "Xy" ] ; then |
---|
26 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card SBG |
---|
27 | typeset option |
---|
28 | for option in ${config_SBG[*]} ; do |
---|
29 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card SBG ${option} |
---|
30 | done |
---|
31 | fi |
---|
32 | |
---|
33 | # Subjobs configuration : |
---|
34 | # ----------------------- |
---|
35 | |
---|
36 | # 1) UserChoices section of fluxnet.card |
---|
37 | |
---|
38 | # This section groups standard options to be passed to ORCHIDEE. |
---|
39 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/fluxnet.card UserChoices |
---|
40 | set +A fluxnet_UserChoices -- ${fluxnet_UserChoices[*]} > /dev/null 2>&1 |
---|
41 | typeset option |
---|
42 | for option in ${fluxnet_UserChoices[*]} ; do |
---|
43 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/fluxnet.card UserChoices ${option} |
---|
44 | done |
---|
45 | |
---|
46 | # 2) FLUXNET section : |
---|
47 | |
---|
48 | # This section groups specific options for FLUXNET spinup : |
---|
49 | # - Fluxnet files path |
---|
50 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/fluxnet.card FLUXNET FluxnetPath |
---|
51 | |
---|
52 | # - List of the sites/information to be treated : |
---|
53 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/fluxnet.card FLUXNET Sites |
---|
54 | echo ${fluxnet_FLUXNET_Sites[*]} |
---|
55 | # Number of columns by site in variable site : name, filename, length, + 13 PFT |
---|
56 | NumInfosBySite=30 |
---|
57 | # Number of sites : |
---|
58 | NumSites=$(( ${#fluxnet_FLUXNET_Sites[*]} / NumInfosBySite )) |
---|
59 | # Num of Columns : name, filename, length, + 13 PFT |
---|
60 | ColumnName=0 |
---|
61 | ColumnFilename=1 |
---|
62 | ColumnYear=2 |
---|
63 | ColumnLength=3 |
---|
64 | ColumnPFT=4 |
---|
65 | ColumnLAI=17 |
---|
66 | |
---|
67 | # 3) SPINUP section : files path and spinup parameters |
---|
68 | # This section groups specific options for SPINUP : |
---|
69 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/fluxnet.card SPINUP |
---|
70 | set +A fluxnet_SPINUP -- ${fluxnet_SPINUP[*]} > /dev/null 2>&1 |
---|
71 | typeset option |
---|
72 | for option in ${fluxnet_SPINUP[*]} ; do |
---|
73 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/fluxnet.card SPINUP ${option} |
---|
74 | done |
---|
75 | |
---|
76 | # 4) Subjob orchidee.def parametrisation : SubJobParams in fluxnet.card |
---|
77 | # This section give flags to put in orchidee.def of Subjobs. |
---|
78 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/fluxnet.card SubJobParams |
---|
79 | set +A fluxnet_SubJobParams -- ${fluxnet_SubJobParams[*]} > /dev/null 2>&1 |
---|
80 | eval first_option=${fluxnet_SubJobParams[0]} > /dev/null 2>&1 |
---|
81 | if [ X${first_option} != X"Error:" ] ; then |
---|
82 | typeset option |
---|
83 | for option in ${fluxnet_SubJobParams[*]} ; do |
---|
84 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/fluxnet.card SubJobParams ${option} |
---|
85 | done |
---|
86 | fi |
---|
87 | |
---|
88 | IGCM_debug_PopStack "FLUXNET_initialize" |
---|
89 | } |
---|
90 | |
---|
91 | # Function to sed orchidee.def in Subjob dirs |
---|
92 | function ORCHIDEE_sed |
---|
93 | { |
---|
94 | IGCM_debug_PushStack "ORCHIDEE_sed" |
---|
95 | |
---|
96 | sed -e "s/^${1}\ *=.*/${1}= ${2}/" \ |
---|
97 | ${New_SUBMIT_DIR}/PARAM/orchidee.def > ${New_SUBMIT_DIR}/PARAM/orchidee.def.tmp |
---|
98 | RET=$? |
---|
99 | echo "ORCHIDEE_sed : ${1} ${2}" |
---|
100 | \mv ${New_SUBMIT_DIR}/PARAM/orchidee.def.tmp ${New_SUBMIT_DIR}/PARAM/orchidee.def |
---|
101 | |
---|
102 | IGCM_debug_PopStack "ORCHIDEE_sed" |
---|
103 | return $RET |
---|
104 | } |
---|
105 | |
---|