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_obelix.ksh

    r669 r697  
    13241324 
    13251325  IGCM_debug_PopStack "IGCM_sys_rebuild" 
     1326} 
     1327 
     1328function IGCM_sys_rebuild_station { 
     1329  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     1330  typeset i list_opt file_in file_out prefix_invert list_invert 
     1331  if ( $DEBUG_sys ) ; then 
     1332    echo "IGCM_sys_rebuild_station :" $@ 
     1333  fi 
     1334  list_opt=$@ 
     1335 
     1336  # Invert Axis : t,x -> x,t  
     1337  #               t,pres,x -> x,t,pres 
     1338  # So that we can concatenate along x 
     1339  i=0 
     1340  for file_in in ${list_opt} ; do 
     1341    (( i = i + 1)) 
     1342    [ ${i} = 1 ] && file_out=${file_in} && continue 
     1343    prefix_invert=$( basename ${file_in} .nc ) 
     1344    IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc 
     1345    list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc 
     1346  done 
     1347 
     1348  # Concatenate 
     1349  IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc 
     1350 
     1351  # Re-ivert file 
     1352  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} 
     1353 
     1354  # Station re-ordering is too expansive to be run within libICGM 
     1355  # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. 
     1356  # This re-ordering must be done "in memory" by the cmorization process 
     1357  # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) 
     1358  # BEGIN reordering 
     1359 
     1360  # Only LMDZ text output contains the exact ordering of the station. 
     1361  # We isolate this in the code below: 
     1362  #  0  38  -157.5000000000000  70.98591549295774 
     1363  #  0  54  27.49999999999999   67.18309859154928 
     1364  #  0  56  -62.50000000000001  82.39436619718309 
     1365  #  0  79  12.49999999999999   78.59154929577466 
     1366  #  0  116 -165.0000000000000  76.05633802816901 
     1367  #  0  117 130.0000000000000   70.98591549295774 
     1368  #  0  118 110.0000000000000   87.46478873239437 
     1369  #  1  40  4.999999999999995   51.97183098591550 
     1370#  typeset iStation iProc list_opt file_in file_out prefix_invert 
     1371#  typeset -Z4 j4 
     1372#  typeset -Z3 j3 
     1373 
     1374#  unset list_opt 
     1375#  set +A list_opt $@ 
     1376 
     1377  # Filename after rebuild 
     1378#  file_out=${list_opt[0]} 
     1379  # Prefix of output files 
     1380#  prefix_invert=$( basename ${file_out} .nc ) 
     1381  # Number of procs 
     1382#  num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) 
     1383 
     1384#  iProc=0 
     1385#  while [ ${iProc} -lt ${num_proc} ] ; do 
     1386    # Array containing Station as a number 
     1387#    unset proc_stn 
     1388#    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}' ) 
     1389    # Number of stations produced by processor proc 
     1390#    stationLast=${#proc_stn[*]} 
     1391    # Proc number on 4 digits 
     1392#    j4=${iProc} 
     1393    # Init 
     1394#    iStation=0 
     1395#    while [ ${iStation} -lt ${stationLast} ] ; do 
     1396      # Station number on 3 digits 
     1397#      j3=${proc_stn[${iStation}]} 
     1398      # Extract station 
     1399      # Invert Axis : t,x -> x,t  
     1400      #               t,pres,x -> x,t,pres 
     1401      # So that we can concatenate along x 
     1402#      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 
     1403#      (( iStation = iStation + 1 )) 
     1404#    done 
     1405#    (( iProc = iProc + 1 )) 
     1406#  done 
     1407 
     1408  # Concatenate all station along x 
     1409#  IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc 
     1410 
     1411  # Re-invert file 
     1412#  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} 
     1413 
     1414  # END reordering 
     1415 
     1416  IGCM_debug_PopStack "IGCM_sys_rebuild_station" 
    13261417} 
    13271418 
Note: See TracChangeset for help on using the changeset viewer.