Changeset 541


Ignore:
Timestamp:
04/25/12 17:50:48 (12 years ago)
Author:
lelod
Message:

evolution ponctuelle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/extract_amsu.pro

    r538 r541  
    342342      COMMON amsub_header,amb_head 
    343343      COMMON amsub_data  ,amb_scan 
    344       print, 'ouverture et lecture du fichier ', filea, SYSTIME() 
    345       openr,lu1,filea,Error=erra,/get_lun 
     344      print, 'ouverture et lecture du fichier ', fileb, SYSTIME() 
     345      openr,lu1,fileb,Error=errb,/get_lun 
    346346      read_amsub1c,fileb, flag2 
    347347      close,lu1 
     
    350350      nb=SIZE(reform(amb_scan.btemps[0,*,*])) 
    351351      nb_scan=nb[2]             ; nb lignes (ou fauchees) 
    352      n_scan=na_scan 
     352      n_scan=nb_scan 
    353353      nb_fov=nb[1]              ; nb pixels dans la fauchee 
    354354      nbpix = nb_fov          ; nb pixels dans la fauchee AMSUB 
    355355      nosat=amb_head.h_satid  ; on le lit dans le fichier, donc pas besoin de l'info dans la liste 
    356  
    357356      amalong=REFORM(amb_scan.latlon[1,*,*]/1.E4) 
    358357      amalati=REFORM(amb_scan.latlon[0,*,*]/1.E4) 
     
    361360      ttt=REFORM(amb_scan.scnlintime/3600000.) 
    362361      amaday=REFORM(amb_scan.scnlindy) 
    363   
    364  
    365  
    366              
    367       fov=indgen(nbpix) ; nb pixels dans la fauchee AMSU 
    368       ntime_1=fltarr(nbpix,n_scan) 
    369       fovy_1=fltarr(nbpix,n_scan) 
    370       for j=0L, nbpix-1L do begin 
    371          fovy_1[j,*]=j+1        ; on remplit un tableau de nscan lignes avec les valeurs de no de pixel 
    372       endfor 
    373   midpix=fix(nbpix/2) 
     362   endif 
     363 
     364   fov=indgen(nbpix)            ; nb pixels dans la fauchee AMSU 
     365   ntime_1=fltarr(nbpix,n_scan) 
     366   fovy_1=fltarr(nbpix,n_scan) 
     367   for j=0L, nbpix-1L do begin 
     368      fovy_1[j,*]=j+1           ; on remplit un tableau de nscan lignes avec les valeurs de no de pixel 
     369   endfor 
     370   midpix=fix(nbpix/2) 
    374371   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) 
    375372   print,"iii : nb de points du fichier dans le domaine geographique +15deg ",nzon, SYSTIME() 
     
    389386; 
    390387; correction nadir des donnees 
    391          ch_nadir=fltarr(nbpix,nzon) 
    392          landseamask=intarr(nbpix,nzon)+2 ; valeur hors zone selectionnee 
    393         ; PRINT,'boucle sur les points du fichier, correction nadir', SYSTIME() 
    394  
    395          for isc=0L,nzon-1L do begin 
     388      ch_nadir=fltarr(nbpix,nzon) 
     389      landseamask=intarr(nbpix,nzon)+2 ; valeur hors zone selectionnee 
     390; PRINT,'boucle sur les points du fichier, correction nadir', SYSTIME() 
     391      for isc=0L,nzon-1L do begin 
    396392;recherche de la zone xxe,yye englobant la fauchee 
    397             utilex=where(xxe ge amalon[midpix,isc]-15 and xxe le amalon[midpix,isc]+15,nxu) 
    398             if nxu ne 0 then begin 
    399                xxutile=xxe[utilex] 
    400                batutilx=bate[utilex,*] 
    401                utiley=where(yye ge amalat[midpix,isc]-8 and yye le amalat[midpix,isc]+8,nyu) 
    402                if nyu ne 0 then begin 
    403                   yyutile=yye[utiley] 
    404                   batutil=batutilx[*,utiley] 
    405  
    406                   for ifo=0,nbpix-1 do begin 
     393         utilex=where(xxe ge amalon[midpix,isc]-15 and xxe le amalon[midpix,isc]+15,nxu) 
     394         if nxu ne 0 then begin 
     395            xxutile=xxe[utilex] 
     396            batutilx=bate[utilex,*] 
     397            utiley=where(yye ge amalat[midpix,isc]-8 and yye le amalat[midpix,isc]+8,nyu) 
     398            if nyu ne 0 then begin 
     399               yyutile=yye[utiley] 
     400               batutil=batutilx[*,utiley] 
     401 
     402               for ifo=0,nbpix-1 do begin 
    407403; approximation: 1km= 1deg/100, et on considere le quart en lon et lat 
    408404; de la surface du pixel pour optimiser la localisation du centre du 
    409405; pixel attention approximation brutale des distances en fractions dedegre 
    410406; recherche de la cote par rapport a la resolution AMSUA 
    411                      xind=where (xxutile ge amalon[ifo,isc]-swath[ifo]/400. and xxutile le amalon[ifo,isc]+swath[ifo]/400.,nxlandsea) 
    412                      yind=where (yyutile ge amalat[ifo,isc]-track[ifo]/400. and yyutile le amalat[ifo,isc]+track[ifo]/400.,nylandsea) 
    413                      if(nxlandsea ne 0 and nylandsea ne 0) then begin 
    414                         bate1=batutil[xind,*] 
    415                         bate2=bate1[*,yind] 
    416                         if (mean(bate2) le 0.5) then begin 
    417                            ch_nadir[ifo,isc]=amch[ifo,isc]-cor_s[ifo] 
    418                            landseamask[ifo,isc]=0 ; mer 
    419                         endif else begin 
    420                            ch_nadir[ifo,isc]=amch[ifo,isc]-cor_l[ifo] 
    421                            landseamask[ifo,isc]=1 ; terre 
    422                         endelse 
    423                      endif 
    424                   endfor 
    425                endif 
     407                  xind=where (xxutile ge amalon[ifo,isc]-swath[ifo]/400. and xxutile le amalon[ifo,isc]+swath[ifo]/400.,nxlandsea) 
     408                  yind=where (yyutile ge amalat[ifo,isc]-track[ifo]/400. and yyutile le amalat[ifo,isc]+track[ifo]/400.,nylandsea) 
     409                  if(nxlandsea ne 0 and nylandsea ne 0) then begin 
     410                     bate1=batutil[xind,*] 
     411                     bate2=bate1[*,yind] 
     412                     if (mean(bate2) le 0.5) then begin 
     413                        ch_nadir[ifo,isc]=amch[ifo,isc]-cor_s[ifo] 
     414                        landseamask[ifo,isc]=0 ; mer 
     415                     endif else begin 
     416                        ch_nadir[ifo,isc]=amch[ifo,isc]-cor_l[ifo] 
     417                        landseamask[ifo,isc]=1 ; terre 
     418                     endelse 
     419                  endif 
     420               endfor 
    426421            endif 
    427  
    428          endfor 
     422         endif 
     423 
     424      endfor 
    429425        ; PRINT, 'fin boucle ',SYSTIME() 
    430          moych=fltarr(nbpix) 
     426      moych=fltarr(nbpix) 
    431427 
    432428; appel a interpolswath pour ajuster les pixels amsua sur une grille 
     
    436432; pbs avec les fauchees qui traversent le meridien 180deg!!!! 
    437433; l'interpolation ajoute des points parasites dans la zone... 
    438          nbgrid=0 
    439          cont=0L 
    440          chint=fltarr(1) 
    441          for i=0L,nzon-1L do begin 
    442             tb=ch_nadir[*,i] 
    443             lon=amalon[*,i] 
    444             lat=amalat[*,i] 
    445             mask=landseamask[*,i] 
    446             ind=where(tb gt tbmin,nbon) 
     434      nbgrid=0 
     435      cont=0L 
     436      chint=fltarr(1) 
     437      for i=0L,nzon-1L do begin 
     438         tb=ch_nadir[*,i] 
     439         lon=amalon[*,i] 
     440         lat=amalat[*,i] 
     441         mask=landseamask[*,i] 
     442         ind=where(tb gt tbmin,nbon) 
    447443; test pour eviter pb d'interpolation de longitude (meridien 180) 
    448             if nbon eq nbpix then begin 
    449                cont=cont+1L 
    450                nbgrid1=nbgrid 
    451                interpolswath,tb,lat,lon,mask,resol,nbgrid,tbgrid,latgrid,longrid,maskgrid                   
    452                fovgrid=indgen(n_elements(tbgrid))+1 
     444         if nbon eq nbpix then begin 
     445            cont=cont+1L 
     446            nbgrid1=nbgrid 
     447            interpolswath,tb,lat,lon,mask,resol,nbgrid,tbgrid,latgrid,longrid,maskgrid                   
     448            fovgrid=indgen(n_elements(tbgrid))+1 
    453449;print,'wwwtest: nb points fov interpole ',n_elements(tbgrid) 
    454450; selection des taches au sol situees dans la zone d'interet 
    455                zone=where((longrid ge lon_min) and (longrid le lon_max) $ 
     451            zone=where((longrid ge lon_min) and (longrid le lon_max) $ 
    456452                          and (latgrid ge lat_min) and (latgrid le lat_max) and (tbgrid gt tbmin) and (tbgrid lt tbmax), npt) 
    457453;print,'wwwtest: nb points zone d interet ',npt 
    458                if npt ne 0 then begin 
    459                   if (n_elements(chint) LE 1) then begin 
    460                      timeint=replicate(tt[i],npt) 
    461                      chint=tbgrid[zone] 
    462                      latint=latgrid[zone] 
    463                      lonint=longrid[zone] 
    464                      fovint=fovgrid[zone] 
    465                      maskint=maskgrid[zone] 
    466                   endif else begin 
    467                      chint=[chint,tbgrid[zone]] 
    468                      latint=[latint,latgrid[zone]] 
    469                      lonint=[lonint,longrid[zone]] 
    470                      fovint=[fovint,fovgrid[zone]] 
    471                      maskint=[maskint,maskgrid[zone]] 
    472                      timeint=[timeint,replicate(tt[i],npt)] 
    473                   endelse 
     454            if npt ne 0 then begin 
     455               if (n_elements(chint) LE 1) then begin 
     456                  timeint=replicate(tt[i],npt) 
     457                  chint=tbgrid[zone] 
     458                  latint=latgrid[zone] 
     459                  lonint=longrid[zone] 
     460                  fovint=fovgrid[zone] 
     461                  maskint=maskgrid[zone] 
    474462               endif else begin 
    475             ;print, 'www : aucun point dans la zone' 
     463                  chint=[chint,tbgrid[zone]] 
     464                  latint=[latint,latgrid[zone]] 
     465                  lonint=[lonint,longrid[zone]] 
     466                  fovint=[fovint,fovgrid[zone]] 
     467                  maskint=[maskint,maskgrid[zone]] 
     468                  timeint=[timeint,replicate(tt[i],npt)] 
    476469               endelse 
    477             endif 
     470            endif else begin 
     471                                ;print, 'www : aucun point dans la zone' 
     472            endelse 
     473         endif 
     474      endfor 
     475 ; PRINT,'fin interpolation et selection des points de la zone ', SYSTIME() 
     476 
     477      nn=n_elements(chint) 
     478 
     479      print,'www : nb points dans la zone en fin de traitement de l''orbite ',nn 
     480      if nn gt 1 then begin 
     481         for i=0L, nn-1L do begin 
     482            if (n_elements(data) EQ 0) then begin 
     483               data = { desc : desc $ 
     484                        , hour : timeint[i] $ 
     485                        , fov : fovint[i] $ 
     486                        , lon : lonint[i] $ 
     487                        , lat: latint[i] $ 
     488                        , landseamask: maskint[i] $ 
     489                        , tb : chint[i] $ 
     490                      } 
     491            endif else begin 
     492               data = [data , { desc : desc $ 
     493                                , hour : timeint[i] $ 
     494                                , fov : fovint[i] $ 
     495                                , lon : lonint[i] $ 
     496                                , lat: latint[i] $ 
     497                                , landseamask:  maskint[i] $ 
     498                                , tb : chint[i] $ 
     499                              }] 
     500            endelse 
    478501         endfor 
    479      ; PRINT,'fin interpolation et selection des points de la zone ', SYSTIME() 
    480  
    481          nn=n_elements(chint) 
    482  
    483          print,'www : nb points dans la zone en fin de traitement de l''orbite ',nn 
    484          if nn gt 1 then begin 
    485             for i=0L, nn-1L do begin 
    486                if (n_elements(data) EQ 0) then begin 
    487                   data = { desc : desc $ 
    488                            , hour : timeint[i] $ 
    489                            , fov : fovint[i] $ 
    490                            , lon : lonint[i] $ 
    491                            , lat: latint[i] $ 
    492                            , landseamask: maskint[i] $ 
    493                            , tb : chint[i] $ 
    494                          } 
    495                endif else begin 
    496                   data = [data , { desc : desc $ 
    497                                    , hour : timeint[i] $ 
    498                                    , fov : fovint[i] $ 
    499                                    , lon : lonint[i] $ 
    500                                    , lat: latint[i] $ 
    501                                    , landseamask:  maskint[i] $ 
    502                                    , tb : chint[i] $ 
    503                                  }] 
    504                endelse 
    505             endfor 
    506             desc=desc+1; incrementation du numero de l'orbite 
    507          endif 
     502         desc=desc+1            ; incrementation du numero de l'orbite 
     503      endif 
    508504; 
    509505; fin boucle sur les fichiers lus 
Note: See TracChangeset for help on using the changeset viewer.