Changeset 543 for trunk


Ignore:
Timestamp:
04/30/12 13:06:37 (12 years ago)
Author:
pinsard
Message:

add shell tools around cresamsu.pro

Location:
trunk/src
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/cresamsu.pro

    r539 r543  
    1717; 
    1818; but: faire des fichiers "grilles" pour analyse statistique avec 
     19; 
    1920; interpolation spatiale et temporelle 
     21; 
     22; 
     23; .. only:: man 
     24; 
     25;    Figure is visible on PDF and HTML documents only. 
     26; 
     27; .. only:: html or latex 
     28; 
     29;     .. graphviz:: 
     30; 
     31;        digraph cresamsu { 
     32;           amsu_t2 [shape=ellipse, 
     33;               fontname=Courier, 
     34;               label="${PROJECT_ID}/yyyy/mm/numch_yyyymmdd_geomin_geomax.dat"]; 
     35;           amsu_t5 [shape=ellipse, 
     36;               fontname=Courier, 
     37;               label="${PROJECT_OD}/AMSU/numch_temprtrtemprhrhdeg_yyyymmdd_yyyymmdd_geomin_geomax.nc"]; 
     38;           cresamsu [shape=box, 
     39;           fontname=Courier, 
     40;           color=blue, 
     41;           URL="http://forge.ipsl.jussieu.fr/varamma/browser/trunk/src/cresamsu.pro", 
     42;           label="${PROJECT}/src/cresamsua.pro"]; 
     43; 
     44;           {amsu_t2} -> {cresamsua} -> {amsu_t5}; 
     45;       } 
    2046; 
    2147; EXAMPLES 
     
    2450; :: 
    2551; 
    26 ;    numch='a5' 
    27 ;    yyyyb=2006L 
    28 ;    yyyye=2006L 
    29 ;    mmb=8 
    30 ;    mme=8 
    31 ;    ddb=1 
    32 ;    dde=3 
    33 ;    lonmin=-25. 
    34 ;    lonmax=25. 
    35 ;    latmin=-5. 
    36 ;    latmax=20. 
    37 ;    temp='m' 
    38 ;    rtemp=0.5 
    39 ;    rhdeg=1. 
     52;    numch = 'a5' 
     53;    yyyyb = 2006L 
     54;    yyyye = 2006L 
     55;    mmb = 8 
     56;    mme = 8 
     57;    ddb = 1 
     58;    dde = 3 
     59;    lonmin = -25. 
     60;    lonmax = 25. 
     61;    latmin = -5. 
     62;    latmax = 20. 
     63;    temp = 'm' 
     64;    rtemp = 0.5 
     65;    rhdeg = 1. 
    4066;    cresamsu, numch, yyyyb, mmb, ddb $ 
    41 ;                        , yyyye, mme, dde $ 
    42 ;                        , lonmin, lonmax, latmin, latmax,temp,rtemp,rhdeg 
     67;            , yyyye, mme, dde $ 
     68;            , lonmin, lonmax, latmin, latmax $ 
     69;            , temp, rtemp, rhdeg 
    4370; 
    4471; SEE ALSO 
    4572; ======== 
    4673; 
    47 ; :ref:`traite_amsuab.sh` 
    48 ; 
    49 ; :func:`file_amsu_t2_to_mem` 
     74; Previous step :ref:`extract_amsu.pro` (:ref:`traite_amsuab.sh`) 
     75; 
     76; :ref:`cresamsu.sh` 
     77; 
     78; Use :func:`file_amsu_t2_to_mem` 
     79; :func:`idl_amsu_netcdf` 
    5080; 
    5181; TODO 
    5282; ==== 
    53 ; 
    54 ; add temp,rtemp,rhdeg in example 
    5583; 
    5684; fix pb with fov_int2 and fov_int3 
     
    83111;  $URL$ 
    84112; 
     113; - fplod 20120430 
     114; 
     115;   * add digraph 
     116; 
    85117; - lelod 20120410 
    86118; 
     
    133165;- 
    134166 
    135 pro cresamsu, numch, yyyyb, mmb, ddb, yyyye,mme,dde,lonmin,lonmax,latmin,latmax,temp,rtemp,rhdeg 
    136  
    137 ; les parametres de l'interpolation 
     167pro cresamsu $ 
     168    , numch $ 
     169    , yyyyb $ 
     170    , mmb $ 
     171    , ddb $ 
     172    , yyyye $ 
     173    , mme $ 
     174    , dde $ 
     175    , lonmin $ 
     176    , lonmax $ 
     177    , latmin $ 
     178    , latmax $ 
     179    , temp $  
     180    , rtemp $ 
     181    , rhdeg 
    138182 
    139183; grille de sortie en long / lat 
    140184; recoit en entree les jours de l'annee jdeb et jfin correspondant au debut et la fin du mois 
    141 ;============================================================================================= 
    142185 
    143186compile_opt idl2, strictarrsubs 
     
    391434ENDIF  ELSE BEGIN 
    392435    print, 'www : no files at all' 
     436    goto, realend 
    393437ENDELSE 
    394438 
    395 IF key_performance EQ 1 THEN BEGIN 
    396      PRINT, 'ppp : durée totale cresamsu', SYSTIME(1)-time1, format='(a, 1x, F12.6)' 
    397 ENDIF 
    398  
    399 print,'fin cresamsu' 
     439realend: 
     440    IF key_performance EQ 1 THEN BEGIN 
     441         PRINT, 'ppp : durée totale cresamsu', SYSTIME(1)-time1, format='(a, 1x, F12.6)' 
     442    ENDIF 
     443 
     444    print,'fin cresamsu' 
    400445 
    401446end 
  • trunk/src/cresamsu.sh

    r541 r543  
    22#+ 
    33# 
    4 # .. program:: traite_amsuab.sh 
    5 # 
    6 # .. _traite_amsuab.sh: 
    7 # 
    8 # ================ 
    9 # traite_amsuab.sh 
    10 # ================ 
     4# .. program:: cresamsu.sh 
     5# 
     6# .. _cresamsu.sh: 
     7# 
     8# =========== 
     9# cresamsu.sh 
     10# =========== 
    1111# 
    1212# SYNOPSIS 
     
    1515# :: 
    1616# 
    17 #  $ traite_amsuab.sh -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch 
     17#  $ cresamsu.sh -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch -temp temp -rtemp rtemp -rhdeg rhdeg 
    1818# 
    1919# DESCRIPTION 
     
    2929# .. option:: -latmax <latmax> 
    3030# .. option:: -numch <channel> 
    31 # 
    32 # ``traite_amsuab.sh`` read :file:`${PROJECT_ID}/AMSU/AMSU*/*/*.L1C`` 
    33 # and :file:`${PROJECT}/SRC/dataref_amsu/COR*.dat` 
    34 # 
    35 # Some IDL programs are launched here using ${IDL_CMD} command 
     31# .. option:: -temp <temp> 
     32# .. option:: -rtemp <rtemp> 
     33# .. option:: -rhdeg <rhdeg> 
     34# 
     35# ``cresamsu.sh`` read  
     36# :file:`${PROJECT_ID}/AMSU/{yyyy}/{mm}/{numch}_{yyyymmdd}_{geomin}_{geomax}_nadir.dat` 
     37# for each yyyymmdd between datemin and datemax (:option:`-b` and :option:`-e`). 
     38# 
     39# ``cresamsu.sh`` write 
     40# :file:`${PROJECT_ID}/AMSU/{numch}{temp}rt{rtemp}rh{rhdeg}_{yyyymmdd}_{yyyymmdd}_{geomin}_{geomax}_03150e4150n.nc` 
     41# 
     42# :ref:`cresamsu` is launched here using ${IDL_CMD} command 
    3643# (see :ref:`varamma_profile.sh` to know how to set this environnement variable). 
    3744# 
     
    3946# 
    4047# Log file is written on 
    41 # :file:`${PROJECT_LOG}/traite_amsuab.log.{YYYYMMDDTHHMMSSZ}` 
     48# :file:`${PROJECT_LOG}/cresamsu.log.{YYYYMMDDTHHMMSSZ}` 
    4249# 
    4350# .. only:: man 
     
    4956#     .. graphviz:: 
    5057# 
    51 #        digraph traite_amsuab { 
    52 # 
    53 #           amsu_t1 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/AMSU/AMSU*/L1C/yyyy/yyyy_mm_dd/*.L1C"]; 
    54 #           amsu_a_cor_land [shape=diamond,fontname=Courier,label="${PROJECT}/src/dataref_amsu/CORR_LAND_AMSUA5_DataFromJune2010_40deg.DAT"]; 
    55 #           amsu_a_cor_sea [shape=diamond,fontname=Courier,label="${PROJECT}/src/dataref_amsu/CORR_SEA_AMSUA5_DataFromJune2010_40deg.DA"]; 
     58#        digraph cresamsu { 
     59# 
    5660#           amsu_t2 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/yyyy/mm/amsua_amsub_yyyymmdd_geomin_geomax.dat"]; 
    5761#           amsu_t3 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/yyyy/mm/amsua_amsub_yyyymmdd_geomin_geomax_nadir.dat"]; 
    58 #           amsu_t4 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/yyyy/mm/amsua_amsub_yyyymmdd_geomin_geomax_nadir.nc"]; 
    59 #           mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/MASK/ETOPO1_Ice_g_gmt4.nc"]; 
    60 # 
    61 #           log [shape=ellipse,fontname=Courier,label="${PROJECT_LOG}/traite_amsuab.log{YYYYMMDDTHHMMSSZ}"]; 
    62 # 
    63 #           traite_amsuab [shape=box, 
     62# 
     63#           log [shape=ellipse,fontname=Courier,label="${PROJECT_LOG}/cresamsu.log{YYYYMMDDTHHMMSSZ}"]; 
     64# 
     65#           cresamsu [shape=box, 
    6466#           fontname=Courier, 
    6567#           color=blue, 
    66 #           URL="http://forge.ipsl.jussieu.fr/varamma/browser/trunk/src/traite_amsuab.sh", 
    67 #           label="${PROJECT}/src/traite_amsuab.sh"]; 
    68 # 
    69 #           {amsu_t1 amsu_a_cor_land amsu_a_cor_sea mask} -> {traite_amsuab} -> {log amsu_t2 amsu_t3 amsu_t4} 
     68#           URL="http://forge.ipsl.jussieu.fr/varamma/browser/trunk/src/cresamsu.sh", 
     69#           label="${PROJECT}/src/cresamsu.sh"]; 
     70# 
     71#           {amsu_t2} -> {cresamsu} -> {log amsu_t5} 
    7072# 
    7173#         } 
     
    7476# ======== 
    7577# 
    76 # You already used :ref:`get_amsu.sh` to get AMSU data including channel a5 
    77 # during [20060801, 20060802[ and you want to produce NetCDF files:: 
    78 # 
    79 #   traite_amsuab.sh -b 20060801 -e 20060802 -lonmin -25 -lonmax 25 -latmin -5 -latmax 20 -numch a5 
     78# You already used :ref:`traite_amsuab.sh` to process AMSU channel a5 data 
     79# during [20060801, 20060802[ and you want to run cressman filter and produce  
     80# NetCDF files:: 
     81# 
     82#   cresamsu.sh -b 20060801 -e 20060802 -lonmin -25 -lonmax 25 -latmin -5 -latmax 20 -numch a5 -temp 'm' -rtemp 1. -rhdeg .5 
    8083# 
    8184# And look at log file with :: 
    8285# 
    83 #   tlogd.sh traite_amsuab 
    84 # 
    85 # A more realistic example: 
    86 # 
    87 #   traite_amsuab.sh -b 20060101 -e 20060630 -lonmin -32 -lonmax 32 -latmin -2 -latmax 42 
     86#   tlogd.sh cresamsu 
     87# 
     88# A more realistic example:: 
     89# 
     90#   cresamsu.sh -b 20060101 -e 20060630 -lonmin -32 -lonmax 32 -latmin -2 -latmax 42 -temp 'm' -rtemp 1. -rhdeg .5 
    8891# 
    8992# and of course on files in ${PROJECT_ID}. 
    90 # 
    91 # If you want to work on channel b5 of AMSU:: 
    92 # 
    93 #   traite_amsuab.sh -b 20060813 -e 20060814 -lonmin -25 -lonmax 25 -latmin -5 -latmax 20 -numch b5 
    9493# 
    9594# SEE ALSO 
    9695# ======== 
    9796# 
    98 # IDL_ 
    99 # 
    100 # .. _IDL: http://www.ittvis.com/ProductServices/IDL.aspx 
    101 # 
    10297# :ref:`varamma_profile.sh` 
    10398# :ref:`project_init.pro` 
    10499# 
    105 # :ref:`run_traite_amsuab.sh` to submit job 
    106 # 
    107 # Previous step : :ref:`get_amsu.sh` 
     100# :ref:`run_cresamsu.sh` to submit job 
     101# 
     102# Previous step : :ref:`traite_amsuab.sh` 
    108103# 
    109104# Use : 
    110 # :ref:`extract_amsua.pro` 
    111 # :ref:`amsu2ncdf.pro` 
    112 # :func:`search_amsufiles` 
    113 # 
     105# :ref:`cresamsu.pro` 
    114106# :ref:`geolocation_to_string_sh.sh` 
    115107# 
     
    119111# ==== 
    120112# 
    121 # usage of profile on parameter true only 
    122 # 
    123 # get all procedure in profiler report (pb of sequence between  
    124 # compile statements and call to profiler ?) 
    125 # 
    126 # se bloque sur 
    127 # /homedata/pinsard/varamma_d/AMSU/AMSUBN17/L1C/2006/2006_08_01/NSS.AMBX.NM.D06213.S1029.E1224.B2132223.WI.L1C 
    128 # avec use_amsua 0 
    129 # 
    130 # why need .compile ?! 
     113# get rid of "Program caused arithmetic error: Floating illegal operand" 
    131114# 
    132115# build/complete catalog 
     
    139122# 
    140123# test if demo mode idl (or force cancel if demo) 
    141 # 
    142 # what about 
    143 # lire_amsuab_new.pro:if (ambfile eq '/bdd/AMSU-1C/AMSUBN15/L1C/2006/2006_03_14/NSS.AMBX.NK.D06073.S1701.E1846.B4072728.GC.L1C') then goto,labett ;exception fichier erronne 
    144 # lire_amsuab_new.pro:if (ambfile eq '/bdd/AMSU-1C/AMSUBN15/L1C/2004/2004_06_25/NSS.AMBX.NK.D04177.S1824.E1950.B3180102.WI.L1C') then goto,labett ;exception fichier erronne 
    145124# 
    146125# EVOLUTIONS 
     
    151130# $URL$ 
    152131# 
    153 # - fplod 20120420 
     132# - fplod 20120430 
    154133#  
    155 #   * add some compile to complete profiler report 
    156 #   * add a realistic example from laurence 
    157 # 
    158 # - fplod 20120419 
    159 # 
    160 #   * add test on files_list 
    161 #   * new technique to validate yyyymmdd 
    162 #     because :: 
    163 #        yyyymmddb=200601010 
    164 #        ${date_cmd} -d "${yyyymmddb}" 
    165 #        Sun Oct 10 00:00:00 CET 20060 
    166 # 
    167 #     alors qu'on avait pu supposer que cela renvoie "date invalid" (année sur 5 digits !) 
    168 # 
    169 # - fplod 20120417 
    170 # 
    171 #   * add some Profiler usage thanks to 
    172 #     http://www.idlcoyote.com/code_tips/whyslow.html 
    173 # 
    174 # - pinsard 20120416 
    175 # 
    176 #   * update min max yyyymmdd 
    177 # 
    178 # - pinsard 20120323 
    179 # 
    180 #   * replace creation of :file:`${PROJECT_ID}/list_file` by a call to 
    181 #     :func:`search_amsufiles` 
    182 #   * transform the IDL snippet to a function to be abble to use ``CASE`` 
    183 # 
    184 # - pinsard 20120106 
    185 # 
    186 #   * update header (no more use_amsu, correction files under src/dataref_amsu) 
    187 #   * remplace VARAMMA by PROJECT 
    188 #   * test if at least one file to be read 
    189 #   * ajout pour connaitre la durée du traitement de chaque jour 
    190 #   * add ref to :ref:`run_traite_amsuab.sh` 
    191 # 
    192 # - pinsard 2011-08-22T14:32:21Z loholt1.ipsl.polytechnique.fr (Linux) 
    193 # 
    194 #   * usage of ${IDL_CMD} instead of idl to allow run on idl 6.4 (/opt/idl-6.4/idl/bin/idl on climserv) 
    195 # 
    196 # - fplod 20110818T154338Z cratos (Linux) 
    197 # 
    198 #   * test on cratos after copying files from climserv 
    199 # 
    200 #     as get_amsu.sh do not yet work on cratos copies have been done using 
    201 #     this kind of sequence 
    202 #     :: 
    203 # 
    204 #      cratos$ mkdir -p ${PROJECT_ID}/AMSU/AMSUBN17/L1C/2006/ 
    205 #      loholt1$ scp -r /bdd/AMSU-1C/AMSUBN17/L1C/2006/2006_08_01 fplod@cerbere.locean-ipsl.upmc.fr:/usr/work/incas/fplod/varamma_d/AMSU/AMSUBN17/L1C/2006/ 
    206 # 
    207 # - pinsard 2011-08-18T10:23:42Z loholt1.ipsl.polytechnique.fr (Linux) 
    208 # 
    209 #   * reach end with amsu-b only on loholt1 
    210 # 
    211 # - pinsard 2011-08-18T07:37:43Z loholt1.ipsl.polytechnique.fr (Linux) 
    212 # 
    213 #   * use geolocation_to_string_sh to build geobox 
    214 # 
    215 # - pinsard 2011-08-10T15:36:50Z loholt1.ipsl.polytechnique.fr (Linux) 
    216 # 
    217 #   * update amsu2ncdf call 
    218 # 
    219 # - fplod 20110810T081339Z aedon.locean-ipsl.upmc.fr (Darwin) 
    220 # 
    221 #   * correct_nadir_LE06 has been replaced by correct_nadir_amsu. 
    222 #   * correction of graph 
    223 # 
    224 # - lelod/fplod 20110809 
    225 # 
    226 #   * new idl tools : need a list of file and new parameters 
    227 # 
    228 # - fplod 20110531T085708Z cratos.locean-ipsl.upmc.fr (Linux) 
    229 # 
    230 #   * remove "_" in parameter variables 
    231 # 
    232 # - pinsard 2011-05-30T14:32:02Z loholt1.ipsl.polytechnique.fr (Linux) 
    233 # 
    234 #   * produce daily files 
    235 #   * complete graphic 
    236 # 
    237 # - pinsard 2011-05-26T10:57:48Z loholt1.ipsl.polytechnique.fr 
    238 # 
    239 #   * add lonmin,lonmax,latmin,latmax parameters 
    240 #   * create a temporary file for idl command 
    241 #   * amsu2ncdf should work now on one day 
    242 # 
    243 # - pinsard 2011-05-26T10:37:42Z loholt1.ipsl.polytechnique.fr 
    244 # 
    245 #   * correct_nadir_LE06 work now on one day 
    246 #   * add mask in doc 
    247 # 
    248 # - pinsard 2011-05-25T13:16:37Z loholt1.ipsl.polytechnique.fr (Linux) 
    249 # 
    250 #   * get rid of yr and jm 
    251 # 
    252 # - fplod 20110511T102251Z cratos.locean-ipsl.upmc.fr (Linux) 
    253 # 
    254 #   * add -a parameter to handle use_amsua and use_amsub parameters of IDL 
    255 #     program 
    256 # 
    257 # - pinsard 2011-05-05T07:11:18Z loholt1.ipsl.polytechnique.fr (Linux) 
    258 # 
    259 #   * consolidation 
    260 #     nb : tricky string to integer pb. see http://www.mail-archive.com/bug-bash@gnu.org/msg06358.html 
    261 # 
    262 # - fplod 20110426T090939Z aedon.locean-ipsl.upmc.fr (Darwin) 
    263 # 
    264 #   * usage of PROJECT* 
    265 # 
    266 # - fplod 20100608T143812Z aedon.locean-ipsl.upmc.fr (Darwin) 
    267 # 
    268 #   * minimal header 
     134#   * creation 
     135# 
    269136#- 
    270137system=$(uname) 
     
    294161command=$(basename ${0}) 
    295162log_date=$(date -u +"%Y%m%dT%H%M%SZ") 
    296 # 
    297 usage=" Usage : ${command} [-f] -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch" 
     163# get current time at the beginning of the process 
     164timebd="$(date +%s)" 
     165# 
     166usage=" Usage : ${command} [-f] -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch -temp temp -rtemp rtemp -rhdeg rhdeg" 
    298167# 
    299168hostname=$(hostname) 
     
    307176yyyymmddb=20060420 
    308177yyyymmdde=20060420 
    309 numch='a5' 
    310 jdeb=1 
    311 jfin=10 
    312 netcdf_build=0 
    313 # 
    314 minargcount=4 
     178# 
     179minargcount=18 
    315180if [ ${#} -lt ${minargcount} ] 
    316181then 
    317    echo "${command} : eee : not enought arguments" 
     182   echo "${command} : eee : not enought arguments (${#} vs ${minargcount})" 
    318183   echo "${usage}" 
    319184   exit 1 
     
    354219        shift 
    355220     ;; 
     221     -temp) 
     222        temp=${2} 
     223        shift 
     224     ;; 
     225     -rtemp) 
     226        rtemp=${2} 
     227        shift 
     228     ;; 
     229     -rhdeg) 
     230        rhdeg=${2} 
     231        shift 
     232     ;; 
    356233     -f) 
    357234        force=1 
     
    390267    exit 1 
    391268fi 
     269unset d 
    392270# 
    393271d=$((${yyyymmddb} - ${yyyymmdde_max})) 
     
    397275    exit 1 
    398276fi 
     277unset d 
    399278# 
    400279${date_cmd} -d "${yyyymmdde}" > /dev/null 
     
    413292    exit 1 
    414293fi 
     294unset d 
    415295# 
    416296if [[ "${yyyymmdde}" < "${yyyymmddb}" ]] 
     
    433313   echo "${command} : eee : tool ${IDL_CMD} not found" 
    434314   echo "${command} : eee : check varamma_profile.sh sequence" 
    435    exit 1 
    436 fi 
    437 unset status 
    438 unset tool 
    439 # 
    440 # 
    441 tool=ncrcat 
    442 type ${tool} 1> /dev/null 2>&1 
    443 status=${?} 
    444 if [ ${status} -ne 0 ] 
    445 then 
    446    echo "${command} : eee : tool ${tool} not found" 
    447315   exit 1 
    448316fi 
     
    474342echo "latmax=${latmax}" 1>> ${log} 
    475343echo "numch=${numch}"  1>> ${log} 
     344echo "temp=${temp}"  1>> ${log} 
     345echo "rtemp=${rtemp}"  1>> ${log} 
     346echo "rhdeg=${rhdeg}"  1>> ${log} 
    476347echo "" 1>> ${log} 
    477348# 
    478 # build geomax from parameters 
    479 geomin=$(geolocation_to_string_sh.sh -lon ${lonmin} -lat ${latmin}) 
    480 status=${?} 
    481 if [ ${status} -ne 0 ] 
    482 then 
    483    echo "${command} : eee : pb geomin with geolocation_to_string_sh.sh" 1>> ${log} 
    484    exit 1 
    485 fi 
    486 geomax=$(geolocation_to_string_sh.sh -lon ${lonmax} -lat ${latmax}) 
    487 status=${?} 
    488 if [ ${status} -ne 0 ] 
    489 then 
    490    echo "${command} : eee : pb geomax with geolocation_to_string_sh.sh" 1>> ${log} 
    491    exit 1 
    492 fi 
    493 # 
    494 # loop over all dates 
    495 # set current and end date 
    496 current=$(${date_cmd} -u -d "${yyyymmddb}" +%s | awk '{printf "%10.10d",$1}') 
    497 end=$(${date_cmd} -u -d "${yyyymmdde}" +%s | awk '{printf "%10.10d",$1}') 
    498 delta=86400 
    499 while [[ "${current}" < "${end}" ]] 
    500 do 
    501     # get current time at the beginning of the process for one day 
    502     timebd="$(date +%s)" 
    503     echo "${command} : iii : looking for files of $(${date_cmd} -u -d "1970-01-01 ${current} sec" +%Y%m%dT%H%M)" 1>> ${log} 
    504     yyyymmdd=$(${date_cmd} -u -d "1970-01-01 ${current} sec" +%Y%m%d) 
    505     yyyy=$(${date_cmd} -u -d "1970-01-01 ${current} sec" +%Y) 
    506     mm=$(${date_cmd} -u -d "1970-01-01 ${current} sec" +%m) 
    507     dd=$(${date_cmd} -u -d "1970-01-01 ${current} sec" +%d) 
    508     hh=$(${date_cmd} -u -d "1970-01-01 ${current} sec" +%H) 
    509     mn=$(${date_cmd} -u -d "1970-01-01 ${current} sec" +%M) 
    510     # 
    511     prefix=$(printf  "%1c" ${numch} | tr [:lower:] [:upper:]) 
    512  
    513     cat >> ${PROJECT}/src/traite_amsu_${$}.pro << EOF 
    514 function traite_amsu_${$} 
     349datesec=$(${date_cmd} -u -d "${yyyymmddb}" +%s | awk '{printf "%10.10d",$1}') 
     350yyyyb=$(${date_cmd} -u -d "1970-01-01 ${datesec} sec" +%Y) 
     351mmb=$(${date_cmd} -u -d "1970-01-01 ${datesec} sec" +%m) 
     352ddb=$(${date_cmd} -u -d "1970-01-01 ${datesec} sec" +%d) 
     353unset datesec 
     354unset yyyymmddb 
     355# 
     356datesec=$(${date_cmd} -u -d "${yyyymmdde}" +%s | awk '{printf "%10.10d",$1}') 
     357yyyye=$(${date_cmd} -u -d "1970-01-01 ${datesec} sec" +%Y) 
     358mme=$(${date_cmd} -u -d "1970-01-01 ${datesec} sec" +%m) 
     359dde=$(${date_cmd} -u -d "1970-01-01 ${datesec} sec" +%d) 
     360unset datesec 
     361unset yyyymmdde 
     362# 
     363cat >> ${PROJECT}/src/cresamsu_${$}.pro << EOF 
     364function cresamsu_${$} 
    515365; 
    516366compile_opt idl2, strictarrsubs 
     
    521371result = -1 
    522372; 
    523 result = search_amsufiles('${numch}', ${yyyy},${mm}, ${dd}) 
    524 result_type=size(result,/type) 
    525 IF (result_type EQ 3) THEN BEGIN 
    526    IF (result EQ -1) THEN BEGIN 
    527        print, 'eee : pb search_amsufiles' 
    528        return, result 
    529    ENDIF 
    530 ENDIF ELSE BEGIN 
    531    files_list = result 
    532 ENDELSE 
     373cresamsu, '${numch}', ${yyyyb}, ${mmb}, ${ddb} $ 
     374        , ${yyyye}, ${mme}, ${dde} $ 
     375        , ${lonmin}, ${lonmax}, ${latmin}, ${latmax} $ 
     376        , '${temp}' , ${rtemp} , ${rhdeg} 
     377result = 0 
    533378; 
    534 result = file_bathy_to_mem(${lonmin}, ${lonmax}, ${latmin}, ${latmax}) 
    535 IF (result EQ -1) THEN BEGIN 
    536    print, 'eee : pb file_bathy_to_mem' 
    537    return, result 
    538 ENDIF 
    539 ; 
    540 ; uncomment the following lines to test with the last file of the list 
    541 ; files_list_new_array = strarr(1) 
    542 ; files_list_new_array[0] = files_list[N_ELEMENTS(files_list) - 1] 
    543 ; files_list = files_list_new_array 
    544 ; 
    545 ; uncomment the following lines to test with the two last files of the list 
    546 ; files_list_new_array = strarr(2) 
    547 ; files_list_new_array[0] = files_list[N_ELEMENTS(files_list) - 2] 
    548 ; files_list_new_array[1] = files_list[N_ELEMENTS(files_list) - 1] 
    549 ; files_list = files_list_new_array 
    550 ; 
    551 ; uncomment the following lines to test with the first file of the list 
    552 ; files_list_new_array = strarr(1) 
    553 ; files_list_new_array[0] = files_list[1] 
    554 ; files_list = files_list_new_array 
    555 ; 
    556 CASE size(files_list,/DIMENSION) OF 
    557    0L : BEGIN 
    558             print, 'www : no file found' 
    559         END 
    560    ELSE: BEGIN 
    561             print, 'iii : nb de fichiers', size(files_list,/DIMENSION) 
    562             resol=1 
    563             extract_amsua, '${numch}', files_list, ${yyyy}, ${mm}, ${dd}, resol, ${lonmin}, ${lonmax}, ${latmin}, ${latmax} 
    564         END 
    565 ENDCASE 
    566 EOF 
    567     if [ ${netcdf_build} -eq 1 ] 
    568     then 
    569         cat >> ${PROJECT}/src/traite_amsu_${$}.pro << EOF 
    570 amsu2ncdf, ${use_amsua}, ${yyyy},${mm},${dd}, ${lonmin}, ${lonmax}, ${latmin}, ${latmax} 
    571 EOF 
    572      fi 
    573      cat >> ${PROJECT}/src/traite_amsu_${$}.pro << EOF 
    574379return, result 
    575380end 
    576381EOF 
    577     ${IDL_CMD} << EOF >> ${log} 2>&1 
     382unset numch 
     383unset yyyyb 
     384unset mmb 
     385unset ddb 
     386unset yyyye 
     387unset mme 
     388unset dde 
     389unset lonmin  
     390unset lonmax  
     391unset latmin  
     392unset latmax 
     393unset temp 
     394unset rtemp 
     395unset rhdeg  
     396# 
     397${IDL_CMD} << EOF >> ${log} 2>&1 
    578398key_performance = 0 
    579399; totally shut down all profiling 
    580 profiler,/CLEAR,/SYSTEM & profiler,/CLEAR,/RESET 
     400profiler, /CLEAR, /SYSTEM & profiler, /CLEAR, /RESET 
    581401; add system procedure 
    582402Profiler, /SYSTEM 
    583403; compile users procedures to be scan by Profiler 
    584 .compile interpol_correc 
    585 .compile extract_amsua 
    586 .compile read_amsua1c 
    587 .compile define_amsua_header_struct 
    588 .compile define_amsua_struct 
    589 .compile pixelsize 
    590 .compile mem_to_file_amsu_t2 
     404.compile cresamsu 
     405.compile idl_amsu_netcdf  
    591406.compile geolocation_to_string_idl 
    592 .compile file_bathy_to_mem 
     407.compile file_amsu_t2_to_mem 
    593408; add users procedures 
    594409Profiler 
    595 result = traite_amsu_${$}() 
     410result = cresamsu_${$}() 
    596411print, 'ppp : profiler report begin' 
    597412Profiler, /REPORT 
    598413print, 'ppp : profiler report end' 
    599414EOF 
    600     status=${?} 
    601     if [ ${status} -ne 0 ] 
    602     then 
    603        echo "${command} : eee: ${IDL_CMD} failed : ${status}" >> ${log} 2>&1 
    604        cat ${PROJECT}/src/traite_amsu_${$}.pro >> ${log} 2>&1 
    605        exit 1 
    606     fi 
    607     rm ${PROJECT}/src/traite_amsu_${$}.pro 
    608     unset status 
    609     if [ ${netcdf_build} -eq 1 ] 
    610     then 
    611          # concatenate yyyymmdd-hhmnss NetCDF files 
    612          list=${PROJECT_ID}/AMSU/${yyyy}/${mm}/${prefix}${yyyy}${mm}${dd}_??????_${geomin}_${geomax}_nadir.nc 
    613          fileout=${PROJECT_ID}/AMSU/${yyyy}/${mm}/${prefix}${yyyy}${mm}${dd}_${geomin}_${geomax}_nadir.nc 
    614          ncrcat -O ${list} ${fileout} >> ${log} 2>&1 
    615          status=${?} 
    616          if [ ${status} -ne 0 ] 
    617          then 
    618              echo "${command} : eee : pb with ncrcat" 1>> ${log} 
    619              for file in ${list} 
    620              do 
    621                  ncdump -h ${file} >> ${log} 2>&1 
    622              done 
    623              exit 1 
    624           else 
    625              echo "${command} : iii : adding ${fileout}" >> ${log} 2>&1 
    626           fi 
    627     fi 
    628     unset dd 
    629     # get current time at the end of the process for one day 
    630     timeed="$(date +%s)" 
    631     elapsed_seconds="$(( ${timeed} - ${timebd} ))" 
    632     echo "${command} : iii : Elapsed time for this day (s) : ${elapsed_seconds}" >> ${log} 2>&1 
    633     unset timebd 
    634     unset timeed 
    635     # next time step 
    636     current=$((${current} + ${delta})) 
    637 done 
    638 # 
    639 unset yyyy 
    640 unset mm 
     415status=${?} 
     416if [ ${status} -ne 0 ] 
     417then 
     418   echo "${command} : eee: ${IDL_CMD} failed : ${status}" >> ${log} 2>&1 
     419   cat ${PROJECT}/src/cresamsu_${$}.pro >> ${log} 2>&1 
     420   exit 1 
     421fi 
     422rm ${PROJECT}/src/cresamsu_${$}.pro 
     423unset status 
     424# get current time at the end of the process 
     425timeed="$(date +%s)" 
     426elapsed_seconds="$(( ${timeed} - ${timebd} ))" 
     427echo "${command} : iii : Elapsed time (s) : ${elapsed_seconds}" >> ${log} 2>&1 
     428unset timebd 
     429unset timeed 
     430unset elapsed_seconds 
     431# 
     432unset yyyymmddb_min 
     433unset yyyymmdde_max 
     434unset force 
     435unset debug 
    641436# 
    642437unset command 
     
    648443# 
    649444# end 
    650 #++set 
     445set 
    651446exit 
  • trunk/src/run_cresamsu.sh

    r541 r543  
    22#+ 
    33# 
    4 # .. program:: run_traite_amsuab.sh 
    5 # 
    6 # .. _run_traite_amsuab.sh: 
    7 # 
    8 # ==================== 
    9 # run_traite_amsuab.sh 
    10 # ==================== 
     4# .. program:: run_cresamsu.sh 
     5# 
     6# .. _run_cresamsu.sh: 
     7# 
     8# =============== 
     9# run_cresamsu.sh 
     10# =============== 
    1111# 
    1212# SYNOPSIS 
     
    1515# :: 
    1616# 
    17 $ run_traite_amsuab.sh -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch 
     17run_cresamsu.sh -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch -temp temp -rtemp rtemp -rhdeg rhdeg 
    1818# 
    1919# DESCRIPTION 
     
    2727# .. option:: -latmax <latmax> 
    2828# .. option:: -numch <channel> 
    29 # 
    30 # lancement de :ref:`traite_amsuab.sh` en batch 
    31 # 
    32 # Job stderr is in the working directory :file:`run_traite_amsuab.e{xxxxx}`, stdout is in :file:`run_traite_amsuab.o{xxxxx}` 
    33 # 
    34 # Log file of :ref:`traite_amsuab.sh` is written on 
    35 # :file:`${PROJECT_LOG}/traite_amsuab.log.{YYYYMMDDTHHMMSSZ}` 
     29# .. option:: -temp <temp> 
     30# .. option:: -rtemp <rtemp> 
     31# .. option:: -rhdeg <rhdeg> 
     32# 
     33# lancement de :ref:`cresamsu.sh` en batch 
     34# 
     35# Job stderr is in the working directory :file:`run_cresamsu.e{xxxxx}`, stdout is in :file:`run_cresamsu.o{xxxxx}` 
     36# 
     37# Log file of :ref:`cresamsu.sh` is written on 
     38# :file:`${PROJECT_LOG}/cresamsu.log.{YYYYMMDDTHHMMSSZ}` 
    3639# 
    3740# SEE ALSO 
     
    3942# 
    4043# :ref:`varamma_profile.sh` 
    41 # :ref:`traite_amsuab.sh` 
     44# :ref:`cresamsu.sh` 
    4245# 
    4346# http://climserv.ipsl.polytechnique.fr/fr/utilisation-du-cluster-climserv/le-cluster-de-calcul-2.html 
     
    4851# To submit with qsub:: 
    4952#  
    50 #   run_traite_amsuab.sh -b 20060813 -e 20060814 -lonmin -25 -lonmax 25 -latmin -5 -latmax 20 -numch a5 
     53#   run_cresamsu.sh -b 20060813 -e 20060814 -lonmin -25 -lonmax 25 -latmin -5 -latmax 20 -numch a5 -temp 'm' -rtemp 1. -rhdeg .5 
    5154# 
    5255# The job id will be written on the screen. 
     
    5659#   qstat {jobid} 
    5760# 
    58 # When the job is done, look at log file of traite_amsuab.sh:: 
    59 # 
    60 #   tlogd.sh traite_amsuab 
     61# When the job is done, look at log file of cresamsu.sh:: 
     62# 
     63#   tlogd.sh cresamsu 
    6164# 
    6265# TODO 
    6366# ==== 
    6467# 
    65 # destruction de ${PROJECT_LOG}/job_run_traite_amsuab.sh  : quand ? pas ici car le job 
     68# destruction de ${PROJECT_LOG}/job_run_cresamsu.sh  : quand ? pas ici car le job 
    6669# en question n'est pas fini 
    6770# 
     
    6972# qu'un mechant 10:00:00 en dur 
    7073# 
    71 # check param or fusion with traite_amsuab.sh 
     74# check param or fusion with cresamsu.sh 
    7275# 
    7376# introduire methode comme dans run_modmarin pour batch cratos (pas de PBS !) 
     
    8083# $URL$ 
    8184# 
    82 # - fplod 20120420 
    83 # 
    84 #   * add logdate in job filename to avoid confusion between jobs 
    85 #   * add job content in log 
    86 # 
    87 # - fplod 20120416 
    88 # 
    89 #   * job...sh in ${PROJECT_LOG}/ instead of current directory 
    90 # 
    91 # - fplod 20120223 
    92 # 
    93 #   * add rest title ! 
    94 #   * lancement sur le cluster de climserv avec plus de temps que l'heure de  
    95 #     base en interacif sur loholt ou que les 6h de base (sans l'option  
    96 #     -l walltime) :: 
    97 # 
    98 #        qsub -l walltime=10:00:00 traite_amsu.sh 
    99 # 
    100 # - fplod 20120106 
    101 # 
    102 #   * creation car traite_amsuab.sh trop long en interactif sur climserv loholt1 
    103 # 
     85# - fplod 20120430 
     86# 
     87#   * creation 
    10488# 
    10589#- 
     
    132116log_date=$(date -u +"%Y%m%dT%H%M%SZ") 
    133117# 
    134 usage=" Usage : ${command} [-f] -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch" 
     118usage=" Usage : ${command} [-f] -b yyyymmdd -e yyyymmdd -lonmin lonmin -lonmax lonmax -latmin latmin -latmax latmax -numch numch -temp temp -rtemp rtemp -rhdeg rhdeg" 
    135119# 
    136120hostname=$(hostname) 
     
    167151     -numch) 
    168152        numch=${2} 
     153        shift 
     154     ;; 
     155     -temp) 
     156        temp=${2} 
     157        shift 
     158     ;; 
     159     -rtemp) 
     160        rtemp=${2} 
     161        shift 
     162     ;; 
     163     -rhdeg) 
     164        rhdeg=${2} 
    169165        shift 
    170166     ;; 
     
    205201echo "latmax=${latmax}" 1>> ${log} 
    206202echo "numch=${numch}"  1>> ${log} 
     203echo "temp=${temp}"  1>> ${log} 
     204echo "rtemp=${rtemp}"  1>> ${log} 
     205echo "rhdeg=${rhdeg}"  1>> ${log} 
    207206echo "" 1>> ${log} 
    208207 
     
    221220# 
    222221. ${PROJECT}/src/varamma_profile.sh -d ${PROJECT}/ -i ${PROJECT_ID} -o ${PROJECT_OD} -t ${PROJECT_LOG} -s ${SAXO_DIR} -idl_cmd ${IDL_CMD} 
    223 time traite_amsuab.sh -b ${yyyymmddb} -e ${yyyymmdde} -lonmin ${lonmin} -lonmax ${lonmax} -latmin ${latmin} -latmax ${latmax} -numch ${numch} 
     222time cresamsu.sh -b ${yyyymmddb} -e ${yyyymmdde} -lonmin ${lonmin} -lonmax ${lonmax} -latmin ${latmin} -latmax ${latmax} -numch ${numch} -temp ${temp} -rtemp ${rtemp} -rhdeg ${rhdeg} 
    224223EOF 
    225224# 
Note: See TracChangeset for help on using the changeset viewer.