Changeset 3047


Ignore:
Timestamp:
12/02/16 16:23:58 (8 years ago)
Author:
jgipsl
Message:

Enhancement on the use of WriteFrequency? for sechiba component. This variable can now activate and set the frequency for 2 files. Following is now possible and will give sechiba_history.nc with monthly frequency and sechiba_out_2.nc with daily frequency : [SRF] WriteFrequency?="1M 1D"

Note: to change the frequency of the 2nd file, it is needed rev 3946 or later of ORCHIDEE/trunk. Otherwise the freq will be 10800s.

Location:
CONFIG/UNIFORM/v6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver

    r2907 r3047  
    11#!/bin/ksh 
    2 #D- Driver du script pour ORCHIDEE 
     2## Driver for the component SRF corresponding to the sechiba part of ORCHIDEE 
    33#----------------------------------------------------------------- 
    44function SRF_Initialize 
     
    6363    ## 2. Mangement of output and modifications of related xml files 
    6464 
    65     # Set default values for sechiba1_enabled, sechiba1_freq and sechiba2_enabled. 
     65    # Set default values for sechiba1_enabled and sechiba1_freq. 
     66    # These variables are used only to modify file_def_orchidee.xml 
    6667    sechiba1_enabled=.FALSE. 
    6768    sechiba2_enabled=.FALSE. 
    6869    sechiba1_freq=0s 
     70    sechiba2_freq=0s 
    6971 
    70     # Get WriteFrenquecies from config.card for SECHIBA 
    71     # Note that it is only possible to have one HF and one other option.  
    72     # If more options are set in config.card only the latest will be used. 
     72 
     73    # Get WriteFrenquecy for SRF (SECHIBA) from config.card 
     74    # 1 or 2 frequencies can be set in WriteFrenquecy for SRF 
     75    # The first frequency will always be used for the sechiba_history file and the  
     76    # second frequency will be used for the sechiba_out_2.nc file.  
     77    # The files are activated only if its corresponding frequency is set in WriteFrequency 
     78    ifreq=0 
    7379    for frequency in ${config_SRF_WriteFrequency} ; do 
    7480        case ${frequency} in 
     
    7682                NbYears=$( echo ${frequency} | awk -F '[yY]' '{print $1}' ) 
    7783                NbDaysYear=$( IGCM_date_DaysInYear ${year} ) 
    78                 sechiba1_enabled=.TRUE. 
    79                 sechiba1_freq=${NbYears}y ;; 
     84                file_enabled=.TRUE. 
     85                file_freq=${NbYears}y ;; 
    8086            *M|*m) 
    8187                NbMonths=$( echo ${frequency} | awk -F '[mM]' '{print $1}' ) 
    82                 sechiba1_enabled=.TRUE. 
    83                 sechiba1_freq=${NbMonths}mo ;; 
     88                file_enabled=.TRUE. 
     89                file_freq=${NbMonths}mo ;; 
    8490            *D|*d) 
    8591                NbDays=$( echo ${frequency} | awk -F '[dD]' '{print $1}' ) 
    86                 sechiba1_enabled=.TRUE. 
    87                 sechiba1_freq=${NbDays}d ;; 
     92                file_enabled=.TRUE. 
     93                file_freq=${NbDays}d ;; 
    8894            *s) 
    8995                WriteInSeconds=$( echo ${frequency} | awk -F '[s]' '{print $1}' ) 
    90                 sechiba1_enabled=.TRUE. 
    91                 sechiba1_freq=${WriteInSeconds}s ;; 
     96                file_enabled=.TRUE. 
     97                file_freq=${WriteInSeconds}s ;; 
    9298            HF|hf)  
    93                 sechiba2_enabled=.TRUE. ;; 
     99                file_enabled=.TRUE.  
     100                file_freq=10800s ;; 
    94101            *)  
    95                 IGCM_debug_Exit "SRF WriteFrequency=${frequency} is invalid. Choose between xY, xM, xD, xs and HF for Sechiba." ;; 
     102                IGCM_debug_Exit "SRF_Update " ${frequency} " invalid WriteFrequency : choose in xY, xM, xD, xs and HF"  
     103                IGCM_debug_Verif_Exit ;; 
     104        esac 
     105 
     106        (( ifreq = ifreq + 1 )) 
     107        case ${ifreq} in 
     108            1) 
     109                sechiba1_enabled=${file_enabled} 
     110                sechiba1_freq=${file_freq} ;; 
     111            2) 
     112                sechiba2_enabled=${file_enabled} 
     113                sechiba2_freq=${file_freq} ;; 
     114        *) 
     115                IGCM_debug_Exit "SRF_Update: It is not possible to set more than 2 output files for sechiba from config.card" 
     116                IGCM_debug_Exit "You must correct WriteFrequancy in SRF secion in config.card." 
     117                IGCM_debug_Exit "Adapt file_def_orchidee.xml directly if you want more output files" 
     118                IGCM_debug_Verif_Exit ;; 
    96119        esac 
    97120    done 
    98121 
    99     # Do the modifications in file_def_orchidee.xml 
     122 
     123    # Modify file_def_orchidee.xml file 
    100124    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled ${sechiba1_enabled} 
    101125    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq ${sechiba1_freq} 
    102126    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled ${sechiba2_enabled} 
     127    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq ${sechiba2_freq} 
     128     
    103129 
    104130    # Add include of orchidee context in iodef.xml 
     
    110136    rm iodef.xml.tmp add.tmp 
    111137 
    112     #Long Name as global attribute (if LongName is not empty) 
    113         if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then 
    114             listfile=$(ls file_def*orchidee.xml) 
    115             echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp 
    116             for file in ${listfile} 
    117             do 
    118                 cp ${file} ${file}.tmp 
    119                 sed -e "/<file id/r add.tmp" \ 
    120                     ${file}.tmp > ${file} 
    121                 rm ${file}.tmp  
    122             done  
    123             rm add.tmp 
    124         fi 
     138    # Add LongName as global attribute in XIOS output files (if LongName is not empty) 
     139    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then 
     140        listfile=$(ls file_def*orchidee.xml) 
     141        echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp 
     142        for file in ${listfile} 
     143        do 
     144            cp ${file} ${file}.tmp 
     145            sed -e "/<file id/r add.tmp" \ 
     146                ${file}.tmp > ${file} 
     147            rm ${file}.tmp  
     148        done  
     149        rm add.tmp 
     150    fi 
     151 
    125152 
    126153    IGCM_debug_PopStack "SRF_Update" 
  • CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/orchidee.driver

    r2907 r3047  
    11#!/bin/ksh 
    2 #D- Driver du script pour ORCHIDEE 
     2## Driver for the component SRF corresponding to the sechiba part of ORCHIDEE 
    33#----------------------------------------------------------------- 
    44function SRF_Initialize 
     
    6363    ## 2. Mangement of output and modifications of related xml files 
    6464 
    65     # Set default values for sechiba1_enabled, sechiba1_freq and sechiba2_enabled. 
     65    # Set default values for sechiba1_enabled and sechiba1_freq. 
     66    # These variables are used only to modify file_def_orchidee.xml 
    6667    sechiba1_enabled=.FALSE. 
    6768    sechiba2_enabled=.FALSE. 
    6869    sechiba1_freq=0s 
     70    sechiba2_freq=0s 
    6971 
    70     # Get WriteFrenquecies from config.card for SECHIBA 
    71     # Note that it is only possible to have one HF and one other option.  
    72     # If more options are set in config.card only the latest will be used. 
     72 
     73    # Get WriteFrenquecy for SRF (SECHIBA) from config.card 
     74    # 1 or 2 frequencies can be set in WriteFrenquecy for SRF 
     75    # The first frequency will always be used for the sechiba_history file and the  
     76    # second frequency will be used for the sechiba_out_2.nc file.  
     77    # The files are activated only if its corresponding frequency is set in WriteFrequency 
     78    ifreq=0 
    7379    for frequency in ${config_SRF_WriteFrequency} ; do 
    7480        case ${frequency} in 
     
    7682                NbYears=$( echo ${frequency} | awk -F '[yY]' '{print $1}' ) 
    7783                NbDaysYear=$( IGCM_date_DaysInYear ${year} ) 
    78                 sechiba1_enabled=.TRUE. 
    79                 sechiba1_freq=${NbYears}y ;; 
     84                file_enabled=.TRUE. 
     85                file_freq=${NbYears}y ;; 
    8086            *M|*m) 
    8187                NbMonths=$( echo ${frequency} | awk -F '[mM]' '{print $1}' ) 
    82                 sechiba1_enabled=.TRUE. 
    83                 sechiba1_freq=${NbMonths}mo ;; 
     88                file_enabled=.TRUE. 
     89                file_freq=${NbMonths}mo ;; 
    8490            *D|*d) 
    8591                NbDays=$( echo ${frequency} | awk -F '[dD]' '{print $1}' ) 
    86                 sechiba1_enabled=.TRUE. 
    87                 sechiba1_freq=${NbDays}d ;; 
     92                file_enabled=.TRUE. 
     93                file_freq=${NbDays}d ;; 
    8894            *s) 
    8995                WriteInSeconds=$( echo ${frequency} | awk -F '[s]' '{print $1}' ) 
    90                 sechiba1_enabled=.TRUE. 
    91                 sechiba1_freq=${WriteInSeconds}s ;; 
     96                file_enabled=.TRUE. 
     97                file_freq=${WriteInSeconds}s ;; 
    9298            HF|hf)  
    93                 sechiba2_enabled=.TRUE. ;; 
     99                file_enabled=.TRUE.  
     100                file_freq=10800s ;; 
    94101            *)  
    95                 IGCM_debug_Exit "SRF WriteFrequency=${frequency} is invalid. Choose between xY, xM, xD, xs and HF for Sechiba." ;; 
     102                IGCM_debug_Exit "SRF_Update " ${frequency} " invalid WriteFrequency : choose in xY, xM, xD, xs and HF"  
     103                IGCM_debug_Verif_Exit ;; 
     104        esac 
     105 
     106        (( ifreq = ifreq + 1 )) 
     107        case ${ifreq} in 
     108            1) 
     109                sechiba1_enabled=${file_enabled} 
     110                sechiba1_freq=${file_freq} ;; 
     111            2) 
     112                sechiba2_enabled=${file_enabled} 
     113                sechiba2_freq=${file_freq} ;; 
     114        *) 
     115                IGCM_debug_Exit "SRF_Update: It is not possible to set more than 2 output files for sechiba from config.card" 
     116                IGCM_debug_Exit "You must correct WriteFrequancy in SRF secion in config.card." 
     117                IGCM_debug_Exit "Adapt file_def_orchidee.xml directly if you want more output files" 
     118                IGCM_debug_Verif_Exit ;; 
    96119        esac 
    97120    done 
    98121 
    99     # Do the modifications in file_def_orchidee.xml 
     122 
     123    # Modify file_def_orchidee.xml file 
    100124    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled ${sechiba1_enabled} 
    101125    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq ${sechiba1_freq} 
    102126    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled ${sechiba2_enabled} 
     127    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq ${sechiba2_freq} 
     128     
    103129 
    104130    # Add include of orchidee context in iodef.xml 
     
    110136    rm iodef.xml.tmp add.tmp 
    111137 
    112     #Long Name as global attribute (if LongName is not empty) 
    113         if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then 
    114             listfile=$(ls file_def*orchidee.xml) 
    115             echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp 
    116             for file in ${listfile} 
    117             do 
    118                 cp ${file} ${file}.tmp 
    119                 sed -e "/<file id/r add.tmp" \ 
    120                     ${file}.tmp > ${file} 
    121                 rm ${file}.tmp  
    122             done  
    123             rm add.tmp 
    124         fi 
     138    # Add LongName as global attribute in XIOS output files (if LongName is not empty) 
     139    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then 
     140        listfile=$(ls file_def*orchidee.xml) 
     141        echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp 
     142        for file in ${listfile} 
     143        do 
     144            cp ${file} ${file}.tmp 
     145            sed -e "/<file id/r add.tmp" \ 
     146                ${file}.tmp > ${file} 
     147            rm ${file}.tmp  
     148        done  
     149        rm add.tmp 
     150    fi 
     151 
    125152 
    126153    IGCM_debug_PopStack "SRF_Update" 
Note: See TracChangeset for help on using the changeset viewer.