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

    r676 r697  
    14881488} 
    14891489 
     1490function IGCM_sys_rebuild_station { 
     1491  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     1492  typeset i list_opt file_in file_out prefix_invert list_invert 
     1493  if ( $DEBUG_sys ) ; then 
     1494    echo "IGCM_sys_rebuild_station :" $@ 
     1495  fi 
     1496  list_opt=$@ 
     1497 
     1498  # Invert Axis : t,x -> x,t  
     1499  #               t,pres,x -> x,t,pres 
     1500  # So that we can concatenate along x 
     1501  i=0 
     1502  for file_in in ${list_opt} ; do 
     1503    (( i = i + 1)) 
     1504    [ ${i} = 1 ] && file_out=${file_in} && continue 
     1505    prefix_invert=$( basename ${file_in} .nc ) 
     1506    IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc 
     1507    list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc 
     1508  done 
     1509 
     1510  # Concatenate 
     1511  IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc 
     1512 
     1513  # Re-ivert file 
     1514  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} 
     1515 
     1516  # Station re-ordering is too expansive to be run within libICGM 
     1517  # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. 
     1518  # This re-ordering must be done "in memory" by the cmorization process 
     1519  # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) 
     1520  # BEGIN reordering 
     1521 
     1522  # Only LMDZ text output contains the exact ordering of the station. 
     1523  # We isolate this in the code below: 
     1524  #  0  38  -157.5000000000000  70.98591549295774 
     1525  #  0  54  27.49999999999999   67.18309859154928 
     1526  #  0  56  -62.50000000000001  82.39436619718309 
     1527  #  0  79  12.49999999999999   78.59154929577466 
     1528  #  0  116 -165.0000000000000  76.05633802816901 
     1529  #  0  117 130.0000000000000   70.98591549295774 
     1530  #  0  118 110.0000000000000   87.46478873239437 
     1531  #  1  40  4.999999999999995   51.97183098591550 
     1532#  typeset iStation iProc list_opt file_in file_out prefix_invert 
     1533#  typeset -Z4 j4 
     1534#  typeset -Z3 j3 
     1535 
     1536#  unset list_opt 
     1537#  set +A list_opt $@ 
     1538 
     1539  # Filename after rebuild 
     1540#  file_out=${list_opt[0]} 
     1541  # Prefix of output files 
     1542#  prefix_invert=$( basename ${file_out} .nc ) 
     1543  # Number of procs 
     1544#  num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) 
     1545 
     1546#  iProc=0 
     1547#  while [ ${iProc} -lt ${num_proc} ] ; do 
     1548    # Array containing Station as a number 
     1549#    unset proc_stn 
     1550#    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}' ) 
     1551    # Number of stations produced by processor proc 
     1552#    stationLast=${#proc_stn[*]} 
     1553    # Proc number on 4 digits 
     1554#    j4=${iProc} 
     1555    # Init 
     1556#    iStation=0 
     1557#    while [ ${iStation} -lt ${stationLast} ] ; do 
     1558      # Station number on 3 digits 
     1559#      j3=${proc_stn[${iStation}]} 
     1560      # Extract station 
     1561      # Invert Axis : t,x -> x,t  
     1562      #               t,pres,x -> x,t,pres 
     1563      # So that we can concatenate along x 
     1564#      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 
     1565#      (( iStation = iStation + 1 )) 
     1566#    done 
     1567#    (( iProc = iProc + 1 )) 
     1568#  done 
     1569 
     1570  # Concatenate all station along x 
     1571#  IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc 
     1572 
     1573  # Re-invert file 
     1574#  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} 
     1575 
     1576  # END reordering 
     1577 
     1578  IGCM_debug_PopStack "IGCM_sys_rebuild_station" 
     1579} 
    14901580 
    14911581############################################################ 
Note: See TracChangeset for help on using the changeset viewer.