Changeset 247 for trunk/libIGCM/libIGCM_comp
- Timestamp:
- 03/17/10 11:51:40 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
r239 r247 143 143 IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars 144 144 IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches 145 if [ "$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" ="Option not found ${flag_post}" ] ; then145 if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not found ${flag_post}" ] ; then 146 146 # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob. 147 147 ListDimension[0]=2D … … 285 285 fi 286 286 IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles" 287 } 288 289 #======================================================================= 290 # Definition of Smooth modulo function 291 # usage : 292 # IGCM_SmoothModulo StringModulo value 293 # 294 # StringModulo : A string of min max and modulo like definition of Scilab vectors. 295 # [min]:[modulo:][max] 296 # where : 297 # [] value are optionnals; 298 # empty min equal 1 299 # empty max equal infinity 300 # modulo not given or empty equal 1 301 # empty string or just ':' equal always. 302 # 303 # value : the value to test with the definition 304 # 305 # return : true(1)/false(0) 306 function IGCM_SmoothModulo 307 { 308 IGCM_debug_PushStack "IGCM_SmoothModulo" 309 typeset defVector ModValue 310 311 eval set +A defVector -- $( echo "${1}" | \ 312 gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' ) 313 314 # Test limits : 315 # ${defVector[0]} <= ${2} <= ${defVector[2]} 316 # or ${defVector[2]} == -1 317 if ( [ ${2} -ge ${defVector[0]} ] && \ 318 ( [ ${2} -le ${defVector[2]} ] || \ 319 [ ${defVector[2]} -lt 0 ] ) ) ; then 320 321 # Test modulo 322 ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} ) 323 if [ ${ModValue} -eq 0 ] ; then 324 echo true 325 IGCM_debug_PopStack "IGCM_SmoothModulo" 326 return 1 327 else 328 echo false 329 IGCM_debug_PopStack "IGCM_SmoothModulo" 330 return 0 331 fi 332 else 333 echo false 334 IGCM_debug_PopStack "IGCM_SmoothModulo" 335 return 0 336 fi 337 } 338 339 #======================================================================= 340 function IGCM_comp_GetInputSmoothFiles 341 { 342 IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles" 343 344 # Debug Print : 345 echo 346 IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles :" 347 echo 348 349 typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ i__ 350 typeset file_in_ file_in file_out_ file_out ret SmoothDef 351 352 for comp in ${config_ListOfComponents[*]} ; do 353 354 echo "-----" 355 # Define component 356 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 357 eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1 358 359 # Debug Print : 360 IGCM_debug_Print 3 "Smooth files ${compname}" 361 362 card=${SUBMIT_DIR}/COMP/${compname}.card 363 364 IGCM_card_DefineArrayFromOption ${card} SmoothFiles List 365 ListFilesName=${compname}_SmoothFiles_List 366 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 367 368 if [ X${FileName0} != X${NULL_STR} ] ; then 369 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 370 371 (( i=0 )) 372 until [ $i -ge $NbFiles ]; do 373 374 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 375 eval file_in=${file_in_} 376 (( i_ = i+1 )) 377 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 378 eval file_out=${file_out_} 379 380 # define CumulPeriod definition for this file 381 (( i__ = i+2 )) 382 eval SmoothDef=\${${ListFilesName}[$i__]} 383 IGCM_debug_Print 3 " ${file_in} ${SmoothDef}" 384 eval ret=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} ) 385 if [ X${ret} = Xtrue ] ; then 386 IGCM_sys_Get ${file_in} ${file_out} 387 388 IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out} 389 fi 390 (( i=i+3 )) 391 done 392 fi 393 done 394 395 IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles" 287 396 } 288 397
Note: See TracChangeset
for help on using the changeset viewer.