Ignore:
Timestamp:
07/18/12 17:58:53 (12 years ago)
Author:
sdipsl
Message:
  • Add IGCM_sys_rebuild_station to all machines. Function dedicated to rebuild CFMIP file station. Regular rebuild can't do it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh

    r669 r697  
    13031303 
    13041304  IGCM_debug_PopStack "IGCM_sys_rebuild" 
     1305} 
     1306 
     1307function IGCM_sys_rebuild_station { 
     1308  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     1309  typeset i list_opt file_in file_out prefix_invert list_invert 
     1310  if ( $DEBUG_sys ) ; then 
     1311    echo "IGCM_sys_rebuild_station :" $@ 
     1312  fi 
     1313  list_opt=$@ 
     1314 
     1315  # Invert Axis : t,x -> x,t  
     1316  #               t,pres,x -> x,t,pres 
     1317  # So that we can concatenate along x 
     1318  i=0 
     1319  for file_in in ${list_opt} ; do 
     1320    (( i = i + 1)) 
     1321    [ ${i} = 1 ] && file_out=${file_in} && continue 
     1322    prefix_invert=$( basename ${file_in} .nc ) 
     1323    IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc 
     1324    list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc 
     1325  done 
     1326 
     1327  # Concatenate 
     1328  IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc 
     1329 
     1330  # Re-ivert file 
     1331  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} 
     1332 
     1333  # Station re-ordering is too expansive to be run within libICGM 
     1334  # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. 
     1335  # This re-ordering must be done "in memory" by the cmorization process 
     1336  # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) 
     1337  # BEGIN reordering 
     1338 
     1339  # Only LMDZ text output contains the exact ordering of the station. 
     1340  # We isolate this in the code below: 
     1341  #  0  38  -157.5000000000000  70.98591549295774 
     1342  #  0  54  27.49999999999999   67.18309859154928 
     1343  #  0  56  -62.50000000000001  82.39436619718309 
     1344  #  0  79  12.49999999999999   78.59154929577466 
     1345  #  0  116 -165.0000000000000  76.05633802816901 
     1346  #  0  117 130.0000000000000   70.98591549295774 
     1347  #  0  118 110.0000000000000   87.46478873239437 
     1348  #  1  40  4.999999999999995   51.97183098591550 
     1349#  typeset iStation iProc list_opt file_in file_out prefix_invert 
     1350#  typeset -Z4 j4 
     1351#  typeset -Z3 j3 
     1352 
     1353#  unset list_opt 
     1354#  set +A list_opt $@ 
     1355 
     1356  # Filename after rebuild 
     1357#  file_out=${list_opt[0]} 
     1358  # Prefix of output files 
     1359#  prefix_invert=$( basename ${file_out} .nc ) 
     1360  # Number of procs 
     1361#  num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) 
     1362 
     1363#  iProc=0 
     1364#  while [ ${iProc} -lt ${num_proc} ] ; do 
     1365    # Array containing Station as a number 
     1366#    unset proc_stn 
     1367#    set +A proc_stn $( grep "iophy_mpi rank ip lon lat  $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | awk ' {print $2}' ) 
     1368    # Number of stations produced by processor proc 
     1369#    stationLast=${#proc_stn[*]} 
     1370    # Proc number on 4 digits 
     1371#    j4=${iProc} 
     1372    # Init 
     1373#    iStation=0 
     1374#    while [ ${iStation} -lt ${stationLast} ] ; do 
     1375      # Station number on 3 digits 
     1376#      j3=${proc_stn[${iStation}]} 
     1377      # Extract station 
     1378      # Invert Axis : t,x -> x,t  
     1379      #               t,pres,x -> x,t,pres 
     1380      # So that we can concatenate along x 
     1381#      IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc 
     1382#      (( iStation = iStation + 1 )) 
     1383#    done 
     1384#    (( iProc = iProc + 1 )) 
     1385#  done 
     1386 
     1387  # Concatenate all station along x 
     1388#  IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc 
     1389 
     1390  # Re-invert file 
     1391#  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} 
     1392 
     1393  # END reordering 
     1394 
     1395  IGCM_debug_PopStack "IGCM_sys_rebuild_station" 
    13051396} 
    13061397 
Note: See TracChangeset for help on using the changeset viewer.