Changeset 574


Ignore:
Timestamp:
06/04/12 23:00:37 (12 years ago)
Author:
lelod
Message:

correction bug sur dates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cresamsu.pro

    r572 r574  
    355355nbfile = 0L 
    356356; lecture des fichiers 
    357 ddmb=ddb 
    358 ddme=dde 
    359 mmyb=mmb 
    360 mmye=mme 
    361 for yyyy=yyyyb,yyyye do begin 
    362    if (yyyye ne yyyyb) then begin 
    363       mmyb=1 
    364       mmye=12 
    365       if yyyy eq yyyyb then mmyb=mmb 
    366       if yyyy eq yyyye then mmye=mme 
     357;ddmb=ddb 
     358;ddme=dde 
     359;mmyb=mmb 
     360;mmye=mme 
     361;for yyyy=yyyyb,yyyye do begin 
     362;   if (yyyye ne yyyyb) then begin 
     363;      mmyb=1 
     364;      mmye=12 
     365;      if yyyy eq yyyyb then mmyb=mmb 
     366;      if yyyy eq yyyye then mmye=mme 
     367;   endif 
     368;   print,"traitement annee ",yyyy,'mois ',mmyb,'a ',mmye 
     369;   for mm=mmyb,mmye do begin 
     370;      if (mme ne mmb) then begin 
     371;         ddmb=1 
     372;         ddme=31 
     373;         if mm eq mmb then ddmb=ddb 
     374;         if mm eq mme then ddme=dde 
     375;     endif 
     376;      print,"mois ",mm,"jours ",ddmb,"a ",ddme 
     377;      for dd=ddmb,ddme do begin 
     378dated=julday(mmb,ddb,yyyyb) 
     379datee=julday(mme,dde,yyyye) 
     380print,'dates debut et fin en jours juliens',dateb,datee 
     381for jd=dateb,datee do begin 
     382   caldat,jd, mm,dd,yyyy 
     383   print, 'iii : traitement du jour ',yyyy,mm,dd 
     384         ; lecture du fichier journalier 
     385   result=file_amsu_t2_to_mem( yyyy, mm, dd, numch $ 
     386                               , lonmin, lonmax, latmin, latmax $ 
     387                               , testfilename) 
     388   if (size(result,/TYPE) EQ 3) THEN BEGIN 
     389      goto, nofile 
     390   ENDIF 
     391   desc=result.data.desc 
     392   hour=result.data.hour 
     393   fov=result.data.fov 
     394   lon=result.data.lon 
     395   lat=result.data.lat 
     396   mask=result.data.landseamask 
     397   tbinit=result.data.tb 
     398                                ; decodage du nb de points (nn) 
     399   nn=n_elements(tbinit) 
     400; egalement aussi des bornes en lon / lat (a retirer des parametres d'entree)++ 
     401 
     402; boucle sur les points du fichier 
     403   tb1=tbinit 
     404   if correcbis eq "oui" then begin 
     405      print,"ATTENTION: correction supplementaire activee" 
     406; application de la correction bis 
     407      tb1=fltarr(nn) 
     408      print,'fauchee',min(fov),max(fov) 
     409      for ifov=min(fov)+1,fovmax-1 do begin 
     410         ind=where(fov eq ifov and mask eq 1,nbfov) 
     411         if nbfov ne 0 then begin 
     412            tb1[ind]=tbinit[ind] -correction_t[ifov] 
     413         endif 
     414      endfor 
     415      ind=where(fov eq 1,smallfov) 
     416      if smallfov ne 0 then begin 
     417         tb1[ind]=tbinit[ind] -correction_t[0] 
     418      endif 
     419      ind=where(fov ge fovmax,bigfov) 
     420      if bigfov ne 0 then begin 
     421         tb1[ind]=tbinit[ind] -correction_t[fovmax-1] 
     422      endif 
     423      for ifov=min(fov)+1,fovmax-1 do begin 
     424         ind=where(fov eq ifov and mask eq 0,nbfov) 
     425         if nbfov ne 0 then begin 
     426            tb1[ind]=tbinit[ind]-correction_m[ifov] 
     427         endif 
     428      endfor 
     429      ind=where(fov eq 1,smallfov) 
     430      if smallfov ne 0 then begin 
     431         tb1[ind]=tbinit[ind] -correction_m[0] 
     432      endif 
     433      ind=where(fov ge fovmax,bigfov) 
     434      if bigfov ne 0 then begin 
     435         tb1[ind]=tbinit[ind] -correction_m[fovmax-1] 
     436      endif 
    367437   endif 
    368    print,"traitement annee ",yyyy,'mois ',mmyb,'a ',mmye 
    369    for mm=mmyb,mmye do begin 
    370       if (mme ne mmb) then begin 
    371          ddmb=1 
    372          ddme=31 
    373          if mm eq mmb then ddmb=ddb 
    374          if mm eq mme then ddme=dde 
    375      endif 
    376       print,"mois ",mm,"jours ",ddmb,"a ",ddme 
    377       for dd=ddmb,ddme do begin 
    378          print, 'iii : traitement du jour ',yyyy,mm,dd 
    379          ; lecture du fichier journalier 
    380          result=file_amsu_t2_to_mem( yyyy, mm, dd, numch $ 
    381                                      , lonmin, lonmax, latmin, latmax $ 
    382                                      , testfilename) 
    383          if (size(result,/TYPE) EQ 3) THEN BEGIN 
    384             goto, nofile 
    385          ENDIF 
    386          desc=result.data.desc 
    387          hour=result.data.hour 
    388          fov=result.data.fov 
    389          lon=result.data.lon 
    390          lat=result.data.lat 
    391          mask=result.data.landseamask 
    392          tbinit=result.data.tb 
    393             ; decodage du nb de points (nn) 
    394          nn=n_elements(tbinit) 
    395 ; egalement aussi des bornes en lon / lat (a retirer des parametres d'entree)++ 
    396  
    397 ; boucle sur les points du fichier 
    398          tb1=tbinit 
    399          if correcbis eq "oui" then begin 
    400              print,"ATTENTION: correction supplementaire activee" 
    401 ; application de la correction bis 
    402              tb1=fltarr(nn) 
    403              print,'fauchee',min(fov),max(fov) 
    404              for ifov=min(fov)+1,fovmax-1 do begin 
    405                  ind=where(fov eq ifov and mask eq 1,nbfov) 
    406                  if nbfov ne 0 then begin 
    407                      tb1[ind]=tbinit[ind] -correction_t[ifov] 
    408                  endif 
    409              endfor 
    410              ind=where(fov eq 1,smallfov) 
    411              if smallfov ne 0 then begin 
    412                  tb1[ind]=tbinit[ind] -correction_t[0] 
    413              endif 
    414              ind=where(fov ge fovmax,bigfov) 
    415              if bigfov ne 0 then begin 
    416                  tb1[ind]=tbinit[ind] -correction_t[fovmax-1] 
    417              endif 
    418              for ifov=min(fov)+1,fovmax-1 do begin 
    419                  ind=where(fov eq ifov and mask eq 0,nbfov) 
    420                  if nbfov ne 0 then begin 
    421                      tb1[ind]=tbinit[ind]-correction_m[ifov] 
    422                  endif 
    423              endfor 
    424              ind=where(fov eq 1,smallfov) 
    425              if smallfov ne 0 then begin 
    426                  tb1[ind]=tbinit[ind] -correction_m[0] 
    427              endif 
    428              ind=where(fov ge fovmax,bigfov) 
    429              if bigfov ne 0 then begin 
    430                  tb1[ind]=tbinit[ind] -correction_m[fovmax-1] 
    431              endif 
    432          endif 
    433  
    434          for i=0,nn-1 do begin 
     438    
     439   for i=0,nn-1 do begin 
    435440; recup de tb1,hour,lon,lat 
    436             if (tb1[i] ge tbmin and tb1[i] le tbmax) then begin 
     441      if (tb1[i] ge tbmin and tb1[i] le tbmax) then begin 
    437442;if  ((tb1 lt tbmin) or (tb1 gt tbmax)) then goto,suite0 ;; on ne s interesse pas aux donnees aberrantes 
    438443; a remplacer par if tb1 ne Nan then begin 
    439444;if (cont lt 10) then print,lon,lat,fov,tb1,hour 
    440445; test sur le debut et la fin des donnes utiles tenant compte du rayon temporel 
    441                jour=julday(mm,dd,yyyy,0)*24.+hour[i] ; en heures decimales 
     446         jour=julday(mm,dd,yyyy,0)*24.+hour[i] ; en heures decimales 
    442447                                ;if (cont lt 10) then print,mm,dd,yyyy,'jour julien lu (en heure)',jour 
    443                if ((jour ge hrdeb-rtemphor) and (jour le hrfin+rtemphor) and (hour[i] le hfin) and (hour[i] ge hdeb) ) then begin 
     448         if ((jour ge hrdeb-rtemphor) and (jour le hrfin+rtemphor) and (hour[i] le hfin) and (hour[i] ge hdeb) ) then begin 
    444449                                ; print,'on cherche les donnees dans la fenetre temporelle' 
    445450                                ; utilisation seulement des orbites du matin - projet heat low 
    446451                                ; grilles temporelle et spatiale utile 
    447                   jdp=fix((jour-hrdeb-rtemphor)/pasthor)>0 
    448                   jfn=fix((jour-hrdeb+rtemphor)/pasthor)+1<jmax 
     452            jdp=fix((jour-hrdeb-rtemphor)/pasthor)>0 
     453            jfn=fix((jour-hrdeb+rtemphor)/pasthor)+1<jmax 
    449454                                ;print,'grille utile temporelle',jdp,jfn 
    450                   kdp=fix((lon[i]-lo1-rhdeg)/pash)>0 
    451                   kfn=fix((lon[i]-lo1+rhdeg)/pash)+1<kmax 
    452                   ldp=fix((lat[i]-la1-rhdeg)/pash)>0 
    453                   lfn=fix((lat[i]-la1+rhdeg)/pash)+1<lmax 
     455            kdp=fix((lon[i]-lo1-rhdeg)/pash)>0 
     456            kfn=fix((lon[i]-lo1+rhdeg)/pash)+1<kmax 
     457            ldp=fix((lat[i]-la1-rhdeg)/pash)>0 
     458            lfn=fix((lat[i]-la1+rhdeg)/pash)+1<lmax 
    454459                                ;print,'grille spatiale utile', kdp,kfn,ldp,lfn 
    455460                                ; calcul de la fonction de Cressman 
    456                   yy=lat[i]*coef 
    457                   xx=lon[i]*coef 
    458                   coyy=cos(yy) 
    459                   coxx=cos(xx) 
    460                   sixx=sin(xx) 
    461                   siyy=sin(yy) 
     461            yy=lat[i]*coef 
     462            xx=lon[i]*coef 
     463            coyy=cos(yy) 
     464            coxx=cos(xx) 
     465            sixx=sin(xx) 
     466            siyy=sin(yy) 
    462467                                ; boucle pour le calcul des contributions aux points de la grille 
    463468                                ; (los, las, t) 
    464                   for nj=jdp,jfn do begin 
    465                      dij=(jour-t[nj])/rtemphor ; normalisee par le rayon de Cressmann 
    466                      disj=dij*dij 
    467                      for l=ldp,lfn do begin 
    468                         coco=coyy*cos(las[l]) 
    469                         sisi=siyy*sin(las[l]) 
    470                         for k=kdp,kfn do begin 
    471                            xxs=los[k] 
    472                            ang=coco*(coxx*cos(xxs)+sixx*sin(xxs))+sisi 
    473                            vv=ang 
    474                            ac=acos(vv) 
    475                            dist=rterre*rterre*ac*ac/r2 
    476                            if (dist lt 1. and disj lt 1.) then begin 
    477                               rnorm=2. 
    478                               poids=(rnorm-dist-disj)/(rnorm+dist+disj) 
    479                               stb1[k,l,nj]=stb1[k,l,nj]+tb1[i]*poids 
    480                               z1[k,l,nj]=z1[k,l,nj]+poids 
    481                               kont1[k,l,nj]=kont1[k,l,nj]+1 
     469            for nj=jdp,jfn do begin 
     470               dij=(jour-t[nj])/rtemphor ; normalisee par le rayon de Cressmann 
     471               disj=dij*dij 
     472               for l=ldp,lfn do begin 
     473                  coco=coyy*cos(las[l]) 
     474                  sisi=siyy*sin(las[l]) 
     475                  for k=kdp,kfn do begin 
     476                     xxs=los[k] 
     477                     ang=coco*(coxx*cos(xxs)+sixx*sin(xxs))+sisi 
     478                     vv=ang 
     479                     ac=acos(vv) 
     480                     dist=rterre*rterre*ac*ac/r2 
     481                     if (dist lt 1. and disj lt 1.) then begin 
     482                        rnorm=2. 
     483                        poids=(rnorm-dist-disj)/(rnorm+dist+disj) 
     484                        stb1[k,l,nj]=stb1[k,l,nj]+tb1[i]*poids 
     485                        z1[k,l,nj]=z1[k,l,nj]+poids 
     486                        kont1[k,l,nj]=kont1[k,l,nj]+1 
    482487                                ; print,kont1[k,l,nj] 
    483                            endif 
    484                         endfor 
    485                      endfor 
     488                     endif 
    486489                  endfor 
    487                endif 
    488             endif 
     490               endfor 
     491            endfor 
     492         endif 
     493      endif 
    489494            ; fin test sur donnees valides (inutile normalement) 
    490          endfor 
     495   endfor 
    491496         ; fin lecture donnees fichier journalier 
    492          nbfile = nbfile + 1L 
    493          goto, nextday 
     497   nbfile = nbfile + 1L 
     498   goto, nextday 
    494499nofile: 
    495     print, 'www : no data to read for this day' 
    496     goto, nextday 
     500   print, 'www : no data to read for this day' 
     501   goto, nextday 
    497502 
    498503nextday: 
    499        IF key_performance EQ 1 THEN BEGIN 
    500           msg = report(['ppp : ' + routine + ' : durée intermediaire au passage au fichier suivant' $ 
    501                    + string(SYSTIME(1)-time1,format='(F12.6)')]) 
    502  
    503        ENDIF 
    504       endfor 
    505    endfor 
     504   IF key_performance EQ 1 THEN BEGIN 
     505      msg = report(['ppp : ' + routine + ' : durée intermediaire au passage au fichier suivant' $ 
     506                    + string(SYSTIME(1)-time1,format='(F12.6)')]) 
     507 
     508   ENDIF 
     509endfor 
     510 
    506511; fin boucle sur le temps 
    507 endfor 
     512 
    508513 
    509514if nbfile GT 0 THEN BEGIN 
Note: See TracChangeset for help on using the changeset viewer.