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

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