Changeset 521


Ignore:
Timestamp:
04/16/12 18:02:17 (12 years ago)
Author:
pinsard
Message:

isolate bathy reading

Location:
trunk/src
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/cm_project.pro

    r337 r521  
    2424; $URL$ 
    2525; 
     26; - fplod 20120416 
     27; 
     28;   * add arrays for bathy 
     29; 
    2630; - fplod 20110422T132320Z aedon.locean-ipsl.upmc.fr (Darwin) 
    2731; 
     
    3034;- 
    3135COMMON project, project_env, project_id_env, project_od_env 
     36COMMON bathy, bate, xxe, yye 
  • trunk/src/extract_amsua.pro

    r513 r521  
    1616; decode les noms des fichiers donnés en argument dans **files_list** 
    1717; dans la date choisie, puis appelle le prgm de lecture 
     18; 
     19; utilise les tableaux bate, xxe, yye définis dans le common :file:`cm_project.pro` remplis par :func:`file_bathy_to_mem`  
    1820; 
    1921; appelle :ref:`interpol_correc.pro`, qui fournit les fonctions de correction au 
     
    109111; called by :ref:`traite_amsuab.sh` 
    110112; 
    111 ; previous step : :func:`search_amsufiles` 
     113; previous step : :func:`search_amsufiles`,  :func:`file_bathy_to_mem` 
    112114; 
    113115; use :ref:`read_amsua1c.pro`, :ref:`read_amsub1c.pro`, 
     
    126128; interpolswath ne gere pas cette situation 
    127129; 
    128 ; comprendre les points bizarres autour de -40,30 visibles avec l'exemple 
    129 ; de 20060801 
    130 ; 
    131130; lever le doute sur le contenu du fichier écrit par le printf (je (fplod) 
    132131; crains des zeros louches!!).louche 
     
    158157; 
    159158; $URL$ 
     159; 
     160; - fplod 20120416 
     161; 
     162;   * remove reading of bathy (see :func:`file_bathy_to_mem`) 
    160163; 
    161164; - fplod 20120323 
     
    299302tbmax=350 
    300303PRINT, 'www : debut programme extract_amsu',SYSTIME() 
    301 ; lecture fichier land - sea (S. Masson) 
    302 file=project_id_env+'/MASK/ETOPO1_Ice_g_gmt4.nc' 
    303 ;attention: zone prise en compte limitee par le choix des nos en x et 
    304 ;y dans initncdf. La region traitee ne doit pas exceder lon_min=-25 & 
    305 ;lon_max=40 & lat_min=-5 & lat_max=40 
    306  
    307 initncdf,file, zaxisname='toto',xaxisname='lon',yaxisname='lat',XMINMESH=8000,XMAXMESH=15000, YMINMESH=4500,YMAXMESH=8500 
    308 domdef,lon_min-15, lon_max+15, lat_min-15, lat_max+15 
    309 bathy=read_ncdf('z',file=file) 
    310 bate=bathy.arr gt 0 
    311 xxe1=reform(glamt[*,0]) 
    312 zonx=where(xxe1 ge lon_min-15 and xxe1 le lon_max+15) 
    313 xxe=xxe1[zonx] 
    314 yye1=reform(gphit[0,*]) 
    315 zony=where(yye1 ge lat_min-15 and yye1 le lat_max+15) 
    316 yye=yye1[zony] 
    317304jpie = n_elements(xxe) 
    318305jpje = n_elements(yye) 
    319306;print,jpie,jpje,size(bate) 
    320 ;PRINT, 'lecture bathy terminee',SYSTIME() 
     307; 
    321308; appel au ssprgm qui interpole les fonctions de correction (inutile 
    322309; de l'appeler a chaque fichier....) 
  • trunk/src/file_bathy_to_mem.pro

    r520 r521  
    22;+ 
    33; 
    4 ; .. _extract_amsua.pro: 
     4;  .. function:: file_bathy_to_mem(lon_min, lon_max, lat_min, lat_max) 
    55; 
    6 ; ================= 
    7 ; extract_amsua.pro 
    8 ; ================= 
     6; .. _file_bathy_to_mem.pro: 
     7; 
     8; ===================== 
     9; file_bathy_to_mem.pro 
     10; ===================== 
    911; 
    1012; DESCRIPTION 
    1113; =========== 
    1214; 
    13 ; prgm de lecture des fichiers AMSU (A seulement, a valider avant de 
    14 ; generaliser pour amsub aussi) 
     15; lit la carte de bathymetrie de S. Masson et remplit les tableaux du common ++ 
    1516; 
    16 ; decode les noms des fichiers donnés en argument dans **files_list** 
    17 ; dans la date choisie, puis appelle le prgm de lecture 
    18 ; 
    19 ; appelle :ref:`interpol_correc.pro`, qui fournit les fonctions de correction au 
    20 ; nadir et les applique, en fonction du masque terre-mer issu de la 
    21 ; carte de bathymetrie de S. Masson 
    22 ; 
    23 ; applique une interpolation tenant compte de la dimension de la tache 
    24 ; au sol selon la position dans la fauchee 
    25 ; 
    26 ; ecrit les donnees pour la zone (lat/long) choisie 
    27 ; 
    28 ; ++ le fichier de sortie contient dans l'ordre mm, jj (jour de 
    29 ; l'annee), le temps (identique pour les points d'une meme fauchee), le 
    30 ; no satellite, le no de fov (1 a 40 ou 1 a 90), long, lat, tb 
    31 ; 
    32 ; Les valeurs manquantes sont codées par NaN. 
    33 ; 
    34 ; .. only:: man 
     17; .. only:: man or text 
    3518; 
    3619;    Figure is visible on PDF and HTML documents only. 
     
    4023;     .. graphviz:: 
    4124; 
    42 ;        digraph extract_amsu { 
     25;        digraph file_bathy_to_mem { 
    4326; 
    44 ;           amsu_t1 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/AMSU/AMSU*/L1C/yyyy/yyyy_mm_dd/*.L1C"]; 
    45 ;           amsu_t2 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/yyyy/mm/numch_yyyymmdd_geomin_geomax.dat"]; 
     27;           bathy [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/etopo++"]; 
     28;           common++ [shape=ellipse,fontname=Courier,label="tableaux"]; 
    4629; 
    47 ;           extract_amsua [shape=box, 
     30;           file_bathy_to_mem [shape=box, 
    4831;           fontname=Courier, 
    4932;           color=blue, 
    50 ;           URL="http://forge.ipsl.jussieu.fr/varamma/browser/trunk/src/extract_amsua.pro", 
    51 ;           label="${PROJECT}/src/extract_amsua.pro"]; 
     33;           URL="http://forge.ipsl.jussieu.fr/varamma/browser/trunk/src/file_bathy_to_mem.pro", 
     34;           label="${PROJECT}/src/file_bathy_to_mem.pro"]; 
    5235; 
    53 ;           {amsu_t1} -> {extract_amsua} -> {amsu_t2}; 
     36;           {bathy} -> {file_bathy_to_mem} -> {common++}; 
    5437;       } 
    5538; 
    56 ; :param numch: 
    57 ; :param files_list: 
    58 ; :param yyyy: 
    59 ; :param mm: 
    60 ; :param resol: 
    6139; :param lon_min: 
    6240; :param lon_max: 
     
    6745; ======== 
    6846; 
    69 ; Creating an articial list of AMSU-A files:: 
     47; ++:: 
    7048; 
    71 ;   files_list = strarr(2) 
    72 ;   files_list[0] = project_id_env + '/AMSU/AMSUAN15/L1C/2006/2006_08_01/NSS.AMAX.NK.D06213.S0110.E0255.B4271112.GC.L1C' 
    73 ;   files_list[1] = project_id_env + 'AMSU/AMSUAN15/L1C/2006/2006_08_01/NSS.AMAX.NK.D06213.S0250.E0437.B4271213.GC.L1C' 
    74 ; 
    75 ; This above tip can replace the call to :func:`search_amsufiles`. 
    76 ; 
    77 ; Pour ne garder que le dernier fichier:: 
    78 ; 
    79 ;   files_list = search_amsufiles(numch, yyyy, mm, dd) 
    80 ;   help, files_list 
    81 ;   files_list_last_array = strarr(1) 
    82 ;   files_list_last_array[0] = files_list[N_ELEMENTS(files_list) - 1] 
    83 ;   help, files_list_last_array 
    84 ;   files_list = files_list_last_array 
    85 ;   help, files_list 
    86 ; 
    87 ; Using AMSU-A channel 5:: 
    88 ; 
    89 ;   numch = 'a5' 
    90 ;   yyyy=2006L 
    91 ;   mm=8 
    92 ;   dd=13 
    93 ;   resol=1 
    9449;   lon_min=-25. 
    9550;   lon_max=25. 
    9651;   lat_min=-5. 
    9752;   lat_max=20. 
    98 ;   files_list = search_amsufiles(numch, yyyy, mm, dd) 
    99 ;   extract_amsua, numch, files_list, yyyy, mm, dd, resol, lon_min, lon_max, lat_min, lat_max 
    100 ; 
    101 ; :file:`${PROJECT_ID}/AMSU/2006/08/a5_20060813_025w05s_025e20n.dat` 
    102 ; must have been created. 
     53;   result = file_bathy_to_mem(lon_min, lon_max, lat_min, lat_max) 
    10354; 
    10455; SEE ALSO 
    10556; ======== 
    10657; 
    107 ; :ref:`data_amsu` 
     58; :ref:`data_bathy` 
    10859; 
    10960; called by :ref:`traite_amsuab.sh` 
    11061; 
    111 ; previous step : :func:`search_amsufiles` 
    112 ; 
    113 ; use :ref:`read_amsua1c.pro`, :ref:`read_amsub1c.pro`, 
    114 ; :func:`geolocation_to_string_idl`, :func:`mem_to_file_amsu_t2` 
     62; use ++ 
    11563; 
    11664; next step :  ++ 
     
    11967; ==== 
    12068; 
    121 ; track why end with:: 
    122 ; 
    123 ;  % Program caused arithmetic error: Floating illegal operand 
    124 ; 
    125 ; traiter les longitudes autour de 180 degres (passage de 180 a -180) 
    126 ; interpolswath ne gere pas cette situation 
    127 ; 
    128 ; comprendre les points bizarres autour de -40,30 visibles avec l'exemple 
    129 ; de 20060801 
    130 ; 
    131 ; lever le doute sur le contenu du fichier écrit par le printf (je (fplod) 
    132 ; crains des zeros louches!!).louche 
    133 ; 
    134 ; vérifier que pas NaN dans les lignes écrites 
    135 ; 
    136 ; faire un test avec un zone géographique dans le pacifique pour voir comment 
    137 ; le système réagi (devrait dire : rien à faire !) 
    138 ; 
    139 ; ajouter MHS 
    140 ; 
    141 ; eviter la creation d'un fichier vide (si pas de points dans la zone) 
    142 ; 
    143 ; tester la cohérence entre les fichiers présents dans files_list 
    144 ; en terme de date avec yyyy, mm et dd donnés en paramètre 
     69; make it work : % Program caused arithmetic error: Floating illegal operand dans le read_netcf à la main 
    14570; 
    14671; improve log 
    14772; 
    148 ; get rid of uppercase 
    149 ; 
    15073; check args 
    15174; 
    152 ; decrire la limitation avec les seuils 
     75; get rid of hard coded values -15, +15 
     76; 
     77; get rid of hard coded values XMINMESH=8000,XMAXMESH=15000, YMINMESH=4500,YMAXMESH=8500 
     78; thoses ones oare valid  for West Africa ONLY 
    15379; 
    15480; EVOLUTIONS 
     
    15985; $URL$ 
    16086; 
    161 ; - fplod 20120323 
     87; - fplod 20120416 
    16288; 
    163 ;   * homogenize examples to traite_amsuab.sh 
    164 ;   * fix output name in example 
    165 ;   * add a paramater files_list to remplace usage of :file:`list_file` 
    166 ;   * replace usage of :file:`list_file` by the usage of the string array 
    167 ;     files_list 
    168 ;   * add a test if files_list no empty (see nofile label) 
    169 ;   * reorder SEE ALSO and TODO 
    170 ; 
    171 ; - lelod 20120223 
    172 ; 
    173 ;   * modif lecture du fichier bathy (ETOPO) pour limiter le temps 
    174 ;     necessaire. Introduction de coordonnees limite dans initncdf, puis 
    175 ;     domdef 
    176 ; 
    177 ;     Attention, si on change la zone, il faut changer les coordonnees!!! 
    178 ; 
    179 ; - lelod 20111215 
    180 ; 
    181 ;   * tests de fonctionnement effectues: la correction nadir est 
    182 ;     correctement implementee 
    183 ; 
    184 ;     l'interpolation de la fauchee fonctionne 
    185 ;     mais attention test sur la longitude code en dur: 
    186 ;     pbs avec les fauchees qui traversent le meridien 180deg!!!! 
    187 ;     l'interpolation ajoute des points parasites dans la zone... 
    188 ; 
    189 ; 
    190 ; - fplod 20111214T082300Z aedon.locean-ipsl.upmc.fr (Darwin) 
    191 ; 
    192 ;   * remove old style writing output file 
    193 ;   * forget idldoc 
    194 ; 
    195 ; - fplod 20111213T092550Z aedon.locean-ipsl.upmc.fr (Darwin) 
    196 ; 
    197 ;   * fix syntax error : rewrite labfile label 
    198 ;   * fix nocanal string to integer type 
    199 ;   * fix example (missing resol in call) 
    200 ; 
    201 ; - lelod 20111211 
    202 ; 
    203 ;   * reintegre les modules de correct_nadir_amsu dans extract 
    204 ;     prevu decodage de numch pour connaitre le nom instrument et le 
    205 ;     numero du canal (pas fini, au debut) --> a faire aussi dans les 
    206 ;     ssprgm appeles (interpol_correc) 
    207 ;     espere que c'est le dernier avatar de cette !!!!?XX^! de 
    208 ;     chaine de traitement AMSU 
    209 ; 
    210 ; - fplod 20111209T125312Z aedon.locean-ipsl.upmc.fr (Darwin) 
    211 ; 
    212 ;   * chgt de terminologie 
    213 ;   * ajout parametre numch 
    214 ;   * transition pour utilisation de :ref:`mem_to_file_amsu_t2` 
    215 ; 
    216 ; - lelod 20111121 
    217 ; 
    218 ;   * introduction du parametre "descending" (orbite descendante 1, 
    219 ;     montante 0) dans le fichier de sortie : a tester! 
    220 ; 
    221 ; - fplod 20110818T160435Z aedon.locean-ipsl.upmc.fr (Darwin) 
    222 ; 
    223 ;   * no more /bdd in examples 
    224 ;   * need to check if missing exist before NaN affection on idl7 cratos 
    225 ; 
    226 ; - pinsard 2011-08-18T10:34:53Z loholt1.ipsl.polytechnique.fr (Linux) 
    227 ; 
    228 ;   * correction of examples 
    229 ;   * examples with 2 files in list_filea and list_fileb 
    230 ;   * match technique from 
    231 ;     http://cerebus.as.arizona.edu/~ioannis/teaching/idl/tutorial_strings.html 
    232 ;   * revision du cas use_amsua=1 : la liste de fichiers amsu-a n'est ouverte 
    233 ;     qu'une seule fois 
    234 ; 
    235 ; - pinsard 2011-08-18T09:10:08Z loholt1.ipsl.polytechnique.fr (Linux) 
    236 ; 
    237 ;   * move bad values from -9999.99 to NaN 
    238 ; 
    239 ; - pinsard 2011-08-17T14:58:13Z loholt1.ipsl.polytechnique.fr (Linux) 
    240 ; 
    241 ;   * use geolocation_to_string_idl 
    242 ; 
    243 ; - pinsard 2011-08-10T10:46:37Z loholt1.ipsl.polytechnique.fr (Linux) 
    244 ; 
    245 ;   * remove blank in output filename 
    246 ;   * revision of articifial example with use_amsua=0 
    247 ;   * add articifial example with use_amsua=1 and try (but fail) to 
    248 ;     make it work on loholt1 
    249 ;   * remove length path dependencies using IDL function file_basename 
    250 ;   * use same date and box of examples in correct_nadir_amsu.pro 
    251 ; 
    252 ; - fplod 20110810T085644Z aedon.locean-ipsl.upmc.fr (Darwin) 
    253 ; 
    254 ;   * revision of header 
    255 ; 
    256 ; - pinsard 2011-05-26T08:44:38Z loholt1.ipsl.polytechnique.fr (Linux) 
    257 ; 
    258 ;   * strmid(fich,51) is not anymore pertinent to isolate the correct information 
    259 ; 
    260 ;     It was ok when path as /bdd/AMSU-1C/AMSUAN15/L1C/2006/2006_07_28/:: 
    261 ; 
    262 ;      c='/bdd/AMSU-1C/AMSUAN15/L1C/2006/2006_07_28/NSS.AMAX.NK.D06209.S1323.E1455.B4266162.GC.L1C' 
    263 ;      b=strmid(c,51) 
    264 ;      print, b 
    265 ;      NK.D06209.S1323.E1455.B4266162.GC.L1C 
    266 ; 
    267 ;     but now path can be anything (PROJECT_ID environment variable) 
    268 ;     so the correct way is to catch the last 36 characters 
    269 ; 
    270 ;     test sur skylla: fonctionne au moins pour un fichier! 
     89;   * creation from extract_amsua.pro 
    27190; 
    27291;- 
    273 PRO extract_amsua, numch, files_list, yyyy, mm, dd, resol $ 
     92function file_bathy_to_mem $ 
    27493                 , lon_min, lon_max, lat_min, lat_max 
    27594; 
     
    27998@common 
    28099 
    281 ; test if some files to read 
    282 CASE size(files_list,/DIMENSION) OF 
    283    0L : BEGIN 
    284      print, 'pas de fichiers' 
    285      goto, nofile 
    286         END 
    287    ELSE: BEGIN 
    288        print, 'nb de fichers', size(files_list,/DIMENSION) 
    289         END 
    290 ENDCASE 
    291 nb_file_array = size(files_list,/DIMENSION) 
    292 nb_file = (nb_file_array)[0] 
     100; Return to caller if errors 
     101ON_ERROR, 2 
    293102; 
    294 nomcanal=strmid(numch,0,1) 
    295 nocanal=0 
    296 reads, strmid(numch,1,1),nocanal,format='(i1.1)' 
     103result = -1 
    297104 
    298 tbmin=100 
    299 tbmax=350 
    300 PRINT, 'www : debut programme extract_amsu',SYSTIME() 
     105PRINT, 'www : debut programme file_bathy_to_mem',SYSTIME() 
    301106; lecture fichier land - sea (S. Masson) 
    302107file=project_id_env+'/MASK/ETOPO1_Ice_g_gmt4.nc' 
     
    306111 
    307112initncdf,file, zaxisname='toto',xaxisname='lon',yaxisname='lat',XMINMESH=8000,XMAXMESH=15000, YMINMESH=4500,YMAXMESH=8500 
    308 domdef,lon_min-15, lon_max+15, lat_min-15, lat_max+15 
     113domdef,lon_min-15., lon_max+15., lat_min-15., lat_max+15. 
    309114bathy=read_ncdf('z',file=file) 
    310115bate=bathy.arr gt 0 
    311116xxe1=reform(glamt[*,0]) 
    312 zonx=where(xxe1 ge lon_min-15 and xxe1 le lon_max+15) 
     117zonx=where(xxe1 ge lon_min-15. and xxe1 le lon_max+15.) 
    313118xxe=xxe1[zonx] 
    314119yye1=reform(gphit[0,*]) 
    315 zony=where(yye1 ge lat_min-15 and yye1 le lat_max+15) 
     120zony=where(yye1 ge lat_min-15. and yye1 le lat_max+15.) 
    316121yye=yye1[zony] 
    317 jpie = n_elements(xxe) 
    318 jpje = n_elements(yye) 
    319 ;print,jpie,jpje,size(bate) 
    320 ;PRINT, 'lecture bathy terminee',SYSTIME() 
    321 ; appel au ssprgm qui interpole les fonctions de correction (inutile 
    322 ; de l'appeler a chaque fichier....) 
    323 interpol_correc,numch,nbpixel,cor_l,cor_s,swath,track 
    324 ; ouverture des fichiers liste (annee, mois, jour, tous satellites) pour 
    325 ; chaque instrument 
    326 ; boucle sur les elements de la liste 
    327122 
    328 print, 'iii : traitement du jour ',yyyy,mm,dd 
    329 a = STRARR(nb_file) 
    330 ;PRINT,'demarrage boucle sur lichiers', SYSTIME() 
    331 FOR ifile = 0, nb_file - 1 do begin 
    332    filea = files_list[ifile] 
    333  
    334    COMMON amsua_header,ama_head 
    335    COMMON amsua_data  ,ama_scan 
    336    print, 'ouverture et lecture du fichier ', filea, SYSTIME() 
    337    openr,lu1,filea,Error=erra,/get_lun 
    338    read_amsua1c,filea, flag1 
    339    close,lu1 
    340    free_lun,lu1 
    341    if (flag1 eq 0) then goto, labfile 
    342    na=SIZE(reform(ama_scan.btemps[0,*,*])) 
    343    na_scan=na[2]                ; nb lignes (fauchees) dans l'orbite 
    344    na_fov=na[1]                 ; nb points dans la fauchee 
    345    nbpix= na_fov 
    346    nosat=ama_head.h_satid 
    347                                 ; nb pixels dans la fauchee AMSUA 
    348    fov=indgen(nbpix) 
    349    n=na 
    350    n_scan=na_scan 
    351    n_fov=na_fov 
    352  
    353    ntime_1=fltarr(nbpix,n_scan) 
    354    fovy_1=fltarr(nbpix,n_scan) 
    355  
    356    for j=0L, nbpix-1L do begin 
    357       fovy_1[j,*]=j+1           ; on remplit un tableau de nscan lignes avec les valeurs de no de pixel 
    358    endfor 
    359 ; 
    360 ; on lit la structure et on extrait les infos: temps, longitude, 
    361 ; latitude, et les Tbs des differents canaux (15 pour AMSUA) 
    362  
    363 ; extraction du canal traite dans un domaine enveloppant la zone choisie 
    364    midpix=fix(nbpix/2) 
    365    amalong=REFORM(ama_scan.latlon[1,*,*]/1.E4) 
    366    amalati=REFORM(ama_scan.latlon[0,*,*]/1.E4) 
    367    amcha=REFORM(ama_scan.btemps[nocanal,*,*]/100.) 
    368    amzeni=REFORM(ama_scan.angles[0,*,*]/100.) 
    369    ttt=REFORM(ama_scan.scnlintime/3600000.) 
    370    jnd=where(amalong[midpix,*] gt lon_min-15 and amalong[midpix,*] lt lon_max+15 and amalati[midpix,*] gt lat_min-15 and amalati[midpix,*] lt lat_max+15 ,nzon) 
    371    print,"iii : nb de points du fichier dans le domaine geographique +15deg ",nzon, SYSTIME() 
    372    if nzon gt 1 then begin 
    373       amalat=amalati[*,jnd] 
    374       amalon=amalong[*,jnd] 
    375       amch=amcha[*,jnd] 
    376       amzen=amzeni[*,jnd] 
    377       tt=ttt[jnd] 
    378       dims = SIZE(amalon, /DIMENSIONS) 
    379       print,'dimension tableaux extraits',dims 
    380       n_scan=dims[1] 
    381       PRINT,'il y a des donnees dans la region ' 
    382       amaday=REFORM(ama_scan.scnlindy) 
    383       amafov= fovy_1 
    384       jour_ama=amaday[0]        ; jour du passage 
    385 ; recherche du sens de l'orbite : descendante (1) ou montante (0) 
    386       lat0=amalat[*,0] 
    387       lat1=amalat[*,1] 
    388       if (mean(lat1-lat0) lt 0) then begin 
    389          desc=1 
    390       endif else begin 
    391          desc=0 
    392       endelse 
    393 ; 
    394 ; correction nadir des donnees 
    395          ch_nadir=fltarr(nbpix,nzon) 
    396          landseamask=intarr(nbpix,nzon)+2 ; valeur hors zone selectionnee 
    397         ; PRINT,'boucle sur les points du fichier, correction nadir', SYSTIME() 
    398  
    399          for isc=0L,nzon-1L do begin 
    400 ;recherche de la zone xxe,yye englobant la fauchee 
    401             utilex=where(xxe ge amalon[midpix,isc]-15 and xxe le amalon[midpix,isc]+15,nxu) 
    402             if nxu ne 0 then begin 
    403                xxutile=xxe[utilex] 
    404                batutilx=bate[utilex,*] 
    405                utiley=where(yye ge amalat[midpix,isc]-8 and yye le amalat[midpix,isc]+8,nyu) 
    406                if nyu ne 0 then begin 
    407                   yyutile=yye[utiley] 
    408                   batutil=batutilx[*,utiley] 
    409  
    410                   for ifo=0,nbpix-1 do begin 
    411 ; approximation: 1km= 1deg/100, et on considere le quart en lon et lat 
    412 ; de la surface du pixel pour optimiser la localisation du centre du 
    413 ; pixel attention approximation brutale des distances en fractions dedegre 
    414 ; recherche de la cote par rapport a la resolution AMSUA 
    415                      xind=where (xxutile ge amalon[ifo,isc]-swath[ifo]/400. and xxutile le amalon[ifo,isc]+swath[ifo]/400.,nxlandsea) 
    416                      yind=where (yyutile ge amalat[ifo,isc]-track[ifo]/400. and yyutile le amalat[ifo,isc]+track[ifo]/400.,nylandsea) 
    417                      if(nxlandsea ne 0 and nylandsea ne 0) then begin 
    418                         bate1=batutil[xind,*] 
    419                         bate2=bate1[*,yind] 
    420                         if (mean(bate2) le 0.5) then begin 
    421                            ch_nadir[ifo,isc]=amch[ifo,isc]-cor_s[ifo] 
    422                            landseamask[ifo,isc]=0 ; mer 
    423                         endif else begin 
    424                            ch_nadir[ifo,isc]=amch[ifo,isc]-cor_l[ifo] 
    425                            landseamask[ifo,isc]=1 ; terre 
    426                         endelse 
    427                      endif 
    428                   endfor 
    429                endif 
    430             endif 
    431  
    432          endfor 
    433         ; PRINT, 'fin boucle ',SYSTIME() 
    434          moych=fltarr(nbpix) 
    435  
    436 ; appel a interpolswath pour ajuster les pixels amsua sur une grille 
    437 ; reguliere dans la fauchee 
    438 ; et selection de la zone conservee 
    439 ; attention test sur la longitude code en dur: 
    440 ; pbs avec les fauchees qui traversent le meridien 180deg!!!! 
    441 ; l'interpolation ajoute des points parasites dans la zone... 
    442          nbgrid=0 
    443          cont=0L 
    444          chint=fltarr(1) 
    445          for i=0L,nzon-1L do begin 
    446             tb=ch_nadir[*,i] 
    447             lon=amalon[*,i] 
    448             lat=amalat[*,i] 
    449             mask=landseamask[*,i] 
    450             ind=where(tb gt tbmin,nbon) 
    451 ; test pour eviter pb d'interpolation de longitude (meridien 180) 
    452             if nbon eq nbpix then begin 
    453                cont=cont+1L 
    454                nbgrid1=nbgrid 
    455                interpolswath,tb,lat,lon,mask,resol,nbgrid,tbgrid,latgrid,longrid,maskgrid                   
    456                fovgrid=indgen(n_elements(tbgrid))+1 
    457 ;print,'wwwtest: nb points fov interpole ',n_elements(tbgrid) 
    458 ; selection des taches au sol situees dans la zone d'interet 
    459                zone=where((longrid ge lon_min) and (longrid le lon_max) $ 
    460                           and (latgrid ge lat_min) and (latgrid le lat_max) and (tbgrid gt tbmin) and (tbgrid lt tbmax), npt) 
    461 ;print,'wwwtest: nb points zone d interet ',npt 
    462                if npt ne 0 then begin 
    463                   if (n_elements(chint) LE 1) then begin 
    464                      timeint=replicate(tt[i],npt) 
    465                      chint=tbgrid[zone] 
    466                      latint=latgrid[zone] 
    467                      lonint=longrid[zone] 
    468                      fovint=fovgrid[zone] 
    469                      maskint=maskgrid[zone] 
    470                   endif else begin 
    471                      chint=[chint,tbgrid[zone]] 
    472                      latint=[latint,latgrid[zone]] 
    473                      lonint=[lonint,longrid[zone]] 
    474                      fovint=[fovint,fovgrid[zone]] 
    475                      maskint=[maskint,maskgrid[zone]] 
    476                      timeint=[timeint,replicate(tt[i],npt)] 
    477                   endelse 
    478                endif else begin 
    479             ;print, 'www : aucun point dans la zone' 
    480                endelse 
    481             endif 
    482          endfor 
    483      ; PRINT,'fin interpolation et selection des points de la zone ', SYSTIME() 
    484  
    485          nn=n_elements(chint) 
    486  
    487          print,'www : nb points dans la zone en fin de traitement de l''orbite ',nn 
    488          if nn gt 1 then begin 
    489             for i=0L, nn-1L do begin 
    490                if (n_elements(data) EQ 0) then begin 
    491                   data = { desc : desc $ 
    492                            , hour : timeint[i] $ 
    493                            , fov : fovint[i] $ 
    494                            , lon : lonint[i] $ 
    495                            , lat: latint[i] $ 
    496                            , landseamask: maskint[i] $ 
    497                            , tb : chint[i] $ 
    498                          } 
    499                endif else begin 
    500                   data = [data , { desc : desc $ 
    501                                    , hour : timeint[i] $ 
    502                                    , fov : fovint[i] $ 
    503                                    , lon : lonint[i] $ 
    504                                    , lat: latint[i] $ 
    505                                    , landseamask:  maskint[i] $ 
    506                                    , tb : chint[i] $ 
    507                                  }] 
    508                endelse 
    509             endfor 
    510          endif 
    511 ; 
    512 ; fin boucle sur les fichiers lus 
    513    endif 
    514    PRINT,'www : passage au fichier suivant ', SYSTIME() 
    515 endfor 
    516 labfile: 
    517 if (n_elements(data) NE 0) then begin 
    518     ; write outputfile 
    519     header1 = { yyyy : yyyy $ 
    520              ,  mm : mm $ 
    521              ,  dd : dd $ 
    522              ,  numch : numch $ 
    523              ,  nbpix : nbgrid $ 
    524              ,  resol : resol $ 
    525              } 
    526 header2= { lon_min: lon_min $ 
    527                       , lon_max: lon_max $ 
    528                       , lat_min: lat_min $ 
    529                       , lat_max: lat_max $ 
    530                      } 
    531  
    532     amsu_t2={header1: header1, header2: header2, data: data} 
    533     help, amsu_t2,/structure 
    534     testfilename='' 
    535     fileout = mem_to_file_amsu_t2(amsu_t2, testfilename) 
    536  
    537 endif else begin 
    538     print, 'www : no data to write' 
    539     goto, realend 
    540 endelse 
    541  
    542 nofile: 
    543     print, 'www : no data to read' 
    544     goto, realend 
    545  
    546 realend: 
    547     PRINT, 'www : fin programme extract_amsua ',SYSTIME() 
     123result = 0 
     124return, result 
    548125end 
  • trunk/src/traite_amsuab.sh

    r513 r521  
    141141# 
    142142# $URL$ 
     143# 
     144# - pinsard 20120416 
     145# 
     146#   * update min max yyyymmdd 
    143147# 
    144148# - pinsard 20120323 
     
    265269hostname=$(hostname) 
    266270# 
    267 yyyymmddb_min=20060420 
    268 yyyymmdde_max=20061103 
     271yyyymmddb_min=20000101 
     272yyyymmdde_max=20121231 
    269273# 
    270274# default 
     
    476480; 
    477481files_list = search_amsufiles('${numch}', ${yyyy},${mm}, ${dd}) 
     482; ++ test si files_list non vide 
     483; 
     484result = file_bathy_to_mem(${lonmin}, ${lonmax}, ${latmin}, ${latmax}) 
     485; ++ test result ok 
    478486; 
    479487; uncomment the following lines to test with the last file of the list 
Note: See TracChangeset for help on using the changeset viewer.