- Timestamp:
- 01/20/12 18:50:41 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/extract_amsua.pro
r483 r486 246 246 tbmin=100 247 247 tbmax=350 248 248 PRINT, 'debut programme',SYSTIME() 249 249 ; lecture fichier land - sea (S. Masson) 250 250 file=project_id_env+'/MASK/ETOPO1_Ice_g_gmt4.nc' 251 domdef,lon_min , lon_max, lat_min, lat_max251 domdef,lon_min-15, lon_max+15, lat_min-15, lat_max+15 252 252 bate = ncdf_lec(file, var = 'z') GT 0 253 253 xxe = float(ncdf_lec(file, var = 'lon')) … … 255 255 jpie = n_elements(xxe) 256 256 jpje = n_elements(yye) 257 257 PRINT, 'lecture bathy terminee',SYSTIME() 258 258 ; appel au ssprgm qui interpole les fonctions de correction (inutile 259 259 ; de l'appeler a chaque fichier....) … … 266 266 267 267 ; lecture de la liste des fichiers AMSU-A 268 list_file a= project_id_env+'list_file'268 list_file = project_id_env+'list_file' 269 269 ;list_filea='list_file' 270 270 ;index_filea= 0 271 nb_file a = file_lines(list_filea)272 a = STRARR(nb_file a)271 nb_file = file_lines(list_file) 272 a = STRARR(nb_file) 273 273 ; filea = STRARR(nb_filea) 274 print, 'ouverture pour lecture de ', list_file a275 openr, lun_a, list_file a, /get_lun274 print, 'ouverture pour lecture de ', list_file 275 openr, lun_a, list_file, /get_lun 276 276 filea='' 277 277 nlist=0 278 278 ilist=0 279 ;loadct,39 280 ;tek_color 281 numwindow=2 282 ;window,numwindow 283 ;plot,indgen(30)+1,cor_l+200,psym=2,color=0,yrange=[150,250] 284 ;oplot,indgen(30)+1,cor_s+200,psym=2,color=100 285 286 ;while ilist le nlist do begin 279 PRINT,'demarrage boucle sur lichiers', SYSTIME() 287 280 while (not eof(lun_a)) do begin 288 281 ilist=ilist+1 … … 297 290 COMMON amsua_header,ama_head 298 291 COMMON amsua_data ,ama_scan 299 print, 'ouverture et lecture du fichier ', filea 292 print, 'ouverture et lecture du fichier ', filea, SYSTIME() 300 293 openr,lu1,filea,Error=erra,/get_lun 301 294 read_amsua1c,filea, flag1 295 close,lu1 296 free_lun,lu1 302 297 if (flag1 eq 0) then goto, labfile 303 298 na=SIZE(reform(ama_scan.btemps[0,*,*])) … … 322 317 ; latitude, et les Tbs des differents canaux (15 pour AMSUA) 323 318 324 ; extraction du canal traite 325 326 amch=REFORM(ama_scan.btemps[nocanal,*,*]/100.) 327 amzen=REFORM(ama_scan.angles[0,*,*]/100.) 328 amalat=REFORM(ama_scan.latlon[0,*,*]/1.E4) 329 amalon=REFORM(ama_scan.latlon[1,*,*]/1.E4) 330 tt=REFORM(ama_scan.scnlintime/3600000.) 331 amaday=REFORM(ama_scan.scnlindy) 332 amafov= fovy_1 333 jour_ama=amaday[0] ; jour du passage 319 ; extraction du canal traite dans un domaine enveloppant la zone choisie 320 midpix=fix(nbpix/2) 321 amalong=REFORM(ama_scan.latlon[1,*,*]/1.E4) 322 amalati=REFORM(ama_scan.latlon[0,*,*]/1.E4) 323 amcha=REFORM(ama_scan.btemps[nocanal,*,*]/100.) 324 amzeni=REFORM(ama_scan.angles[0,*,*]/100.) 325 ttt=REFORM(ama_scan.scnlintime/3600000.) 326 327 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) 328 if nzon ne 0 then begin 329 amalat=amalati[*,jnd] 330 amalon=amalong[*,jnd] 331 amch=amcha[*,jnd] 332 amzen=amzeni[*,jnd] 333 tt=ttt[jnd] 334 dims = SIZE(amalon, /DIMENSIONS) 335 print,'dimension tableaux extraits',dims 336 n_scan=dims[1] 337 PRINT,'il y a des donnees dans la region ', SYSTIME() 338 amaday=REFORM(ama_scan.scnlindy) 339 amafov= fovy_1 340 jour_ama=amaday[0] ; jour du passage 334 341 ; recherche du sens de l'orbite : descendante (1) ou montante (0) 335 lat0=amalat[*,0]336 lat1=amalat[*,1]337 if (mean(lat1-lat0) lt 0) then begin338 desc=1339 endif else begin340 desc=0341 endelse342 342 lat0=amalat[*,0] 343 lat1=amalat[*,1] 344 if (mean(lat1-lat0) lt 0) then begin 345 desc=1 346 endif else begin 347 desc=0 348 endelse 349 343 350 ; correction nadir des donnees 344 ch_nadir=fltarr(nbpix,n_scan) 345 landseamask=intarr(nbpix,n_scan) 346 for isc=0L,n_scan-1L do begin 347 for ifo=0,nbpix-1 do begin 351 ch_nadir=fltarr(nbpix,n_scan) 352 ; ch_nadir=amch[ifo,isc] 353 landseamask=intarr(nbpix,n_scan)+2 ; valeur hors zone selectionnee 354 PRINT,'boucle sur les points du fichier, correction nadir', SYSTIME() 355 356 for isc=0L,n_scan-1L do begin 357 ;recherche de la zone xxe,yye englobant la fauchee 358 for ifo=0,nbpix-1 do begin 348 359 ; approximation: 1km= 1deg/100, et on considere le quart en lon et lat 349 360 ; de la surface du pixel pour optimiser la localisation du centre du 350 361 ; pixel attention approximation brutale des distances en fractions dedegre 351 362 ; recherche de la cote par rapport a la resolution AMSUA 352 xind=where (xxe ge amalon[ifo,isc]-swath[ifo]/400. and xxe le amalon[ifo,isc]+swath[ifo]/400.,nxlandsea)353 yind=where (yye ge amalat[ifo,isc]-track[ifo]/400. and yye le amalat[ifo,isc]+track[ifo]/400.,nylandsea)354 if(nxlandsea ne 0 and nylandsea ne 0) then begin355 bate1=bate[xind,*]356 bate2=bate1[*,yind]357 if (mean(bate2) le 0.5) then begin358 ch_nadir[ifo,isc]=amch[ifo,isc]-cor_s[ifo]359 landseamask[ifo,isc]=0 ; mer360 endif else begin361 ch_nadir[ifo,isc]=amch[ifo,isc]-cor_l[ifo]362 landseamask[ifo,isc]=1 ; terre363 endelse364 endif365 endfor366 endfor367 368 moych=fltarr(nbpix)369 370 for ifo=0,nbpix-1 do begin371 jnd=where(ch_nadir[ifo,*] gt tbmin and ch_nadir[ifo,*] lt tbmax and amalon[ifo,*] ge lon_min and amalon[ifo,*] le lon_max $372 and amalat[ifo,*] ge lat_min and amalat[ifo,*] le lat_max,npts)373 if npts ne 0 then begin374 moych[ifo]= mean(ch_nadir[ifo,jnd])375 endif376 endfor363 xind=where (xxe ge amalon[ifo,isc]-swath[ifo]/400. and xxe le amalon[ifo,isc]+swath[ifo]/400.,nxlandsea) 364 yind=where (yye ge amalat[ifo,isc]-track[ifo]/400. and yye le amalat[ifo,isc]+track[ifo]/400.,nylandsea) 365 if(nxlandsea ne 0 and nylandsea ne 0) then begin 366 bate1=bate[xind,*] 367 bate2=bate1[*,yind] 368 if (mean(bate2) le 0.5) then begin 369 ch_nadir[ifo,isc]=amch[ifo,isc]-cor_s[ifo] 370 landseamask[ifo,isc]=0 ; mer 371 endif else begin 372 ch_nadir[ifo,isc]=amch[ifo,isc]-cor_l[ifo] 373 landseamask[ifo,isc]=1 ; terre 374 endelse 375 endif 376 endfor 377 endfor 378 PRINT, 'fin boucle',SYSTIME() 379 moych=fltarr(nbpix) 380 381 ;for ifo=0,nbpix-1 do begin 382 ; jnd=where(ch_nadir[ifo,*] gt tbmin and ch_nadir[ifo,*] lt tbmax and amalon[ifo,*] ge lon_min and amalon[ifo,*] le lon_max $ 383 ; and amalat[ifo,*] ge lat_min and amalat[ifo,*] le lat_max,npts) 384 ; if npts ne 0 then begin 385 ; moych[ifo]= mean(ch_nadir[ifo,jnd]) 386 ; endif 387 ;endfor 377 388 ;print,'correction',moych 378 389 ;print,'cor_s',cor_s … … 381 392 ;print,'ecarts max a la valeur moyenne au nadir',min(moych)-mean(moych[12:17]),max(moych)-mean(moych[12:17]) 382 393 383 384 numwindow=numwindow+1385 394 386 395 ; appel a interpolswath pour ajuster les pixels amsua sur une grille … … 390 399 ; pbs avec les fauchees qui traversent le meridien 180deg!!!! 391 400 ; l'interpolation ajoute des points parasites dans la zone... 392 nbgrid=0 393 cont=0L 394 for i=0L,n_scan-1L do begin 395 tb=ch_nadir[*,i] 396 lon=amalon[*,i] 397 lat=amalat[*,i] 398 mask=landseamask[*,i] 399 ind=where(tb gt tbmin and lon gt lon_min-15 and lon lt lon_max+15,nbon) 401 nbgrid=0 402 cont=0L 403 chint=fltarr(1) 404 for i=0L,n_scan-1L do begin 405 tb=ch_nadir[*,i] 406 lon=amalon[*,i] 407 lat=amalat[*,i] 408 mask=landseamask[*,i] 409 ind=where(tb gt tbmin,nbon) 400 410 ; test pour eviter pb d'interpolation de longitude (meridien 180) 401 if nbon eq nbpix then begin402 cont=cont+1L403 nbgrid1=nbgrid404 interpolswath,tb,lat,lon,mask,resol,nbgrid,tbgrid,latgrid,longrid,maskgrid405 if cont eq 1L then begin406 fovgrid=indgen(nbgrid)+1407 endif411 if nbon eq nbpix then begin 412 cont=cont+1L 413 nbgrid1=nbgrid 414 interpolswath,tb,lat,lon,mask,resol,nbgrid,tbgrid,latgrid,longrid,maskgrid 415 if cont eq 1L then begin 416 fovgrid=indgen(nbgrid)+1 417 endif 408 418 ;longit=longrid 409 419 ;latit=latgrid … … 411 421 412 422 ; selection des taches au sol situees dans la zone d'interet 413 zone=where((longrid ge lon_min) and (longrid le lon_max) $414 and (latgrid ge lat_min) and (latgrid le lat_max) and (tbgrid gt tbmin) and (tbgrid lt tbmax), npt)415 if npt ne 0 then begin416 if (n_elements(chint) EQ 0) then begin417 timeint=replicate(tt[i],npt)418 chint=tbgrid[zone]419 latint=latgrid[zone]420 lonint=longrid[zone]421 fovint=fovgrid[zone]422 maskint=maskgrid[zone]423 endif else begin424 chint=[chint,tbgrid[zone]]425 latint=[latint,latgrid[zone]]426 lonint=[lonint,longrid[zone]]427 fovint=[fovint,fovgrid[zone]]428 maskint=[maskint,maskgrid[zone]]429 timeint=[timeint,replicate(tt[i],npt)]430 endelse431 endif else begin423 zone=where((longrid ge lon_min) and (longrid le lon_max) $ 424 and (latgrid ge lat_min) and (latgrid le lat_max) and (tbgrid gt tbmin) and (tbgrid lt tbmax), npt) 425 if npt ne 0 then begin 426 if (n_elements(chint) EQ 1) then begin 427 timeint=replicate(tt[i],npt) 428 chint=tbgrid[zone] 429 latint=latgrid[zone] 430 lonint=longrid[zone] 431 fovint=fovgrid[zone] 432 maskint=maskgrid[zone] 433 endif else begin 434 chint=[chint,tbgrid[zone]] 435 latint=[latint,latgrid[zone]] 436 lonint=[lonint,longrid[zone]] 437 fovint=[fovint,fovgrid[zone]] 438 maskint=[maskint,maskgrid[zone]] 439 timeint=[timeint,replicate(tt[i],npt)] 440 endelse 441 endif else begin 432 442 ;print, 'www : aucun point dans la zone' 433 endelse 434 endif 435 436 endfor 437 438 439 nn=n_elements(chint) 440 441 print,'nb points dans la zone',nn 442 443 for i=0L, nn-1L do begin 444 if (n_elements(data) EQ 0) then begin 445 data = { desc : desc $ 443 endelse 444 endif 445 endfor 446 ; PRINT,'fin interpolation et selection des points de la zone', SYSTIME() 447 448 nn=n_elements(chint) 449 450 print,'nb points dans la zone',nn 451 452 for i=0L, nn-1L do begin 453 if (n_elements(data) EQ 0) then begin 454 data = { desc : desc $ 446 455 , hour : timeint[i] $ 447 456 , fov : fovint[i] $ … … 451 460 , tb : chint[i] $ 452 461 } 453 endif else begin454 data = [data , { desc : desc $462 endif else begin 463 data = [data , { desc : desc $ 455 464 , hour : timeint[i] $ 456 465 , fov : fovint[i] $ … … 460 469 , tb : chint[i] $ 461 470 }] 462 endelse 463 endfor 471 endelse 472 endfor 473 464 474 ; fin boucle sur les fichiers lus 475 endif 476 ; PRINT,'passage au fichier suivant', SYSTIME() 465 477 endwhile 466 478 labfile: … … 488 500 ; print, 'www : no data to write' 489 501 endelse 490 ; loadct,39491 502 ; window,0 492 ; plot,lonint,latint,xrange=[lon_min,lon_max],yrange=[lat_min,lat_max],xstyle=1,ystyle=1,/nodata 503 loadct,39 504 plot,lonint,latint,xrange=[lon_min,lon_max],yrange=[lat_min,lat_max],xstyle=1,ystyle=1,/nodata 493 505 ; ind=where(maskint eq 1) 494 506 ; ;oplot,lonint[ind],latint[ind],psym=1 495 ; 507 ;jnd=where(chint gt tbmin and chint lt tbmax) 496 508 ; tb=chint[jnd] 497 509 ; lolo=lonint[jnd] 498 510 ; lala=latint[jnd] 499 511 ; colscale=intarr(n_elements(tb)) 500 ; for j=0,n_elements(tb)-1 do begin 501 ; colscale[j]=(tb[j]-min(tb))*255/(max(tb)-min(tb)) 502 ; endfor 512 ; for j=0,n_elements(tb)-1 do colscale[j]=(tb[j]-min(tb))*255/(max(tb)-min(tb)) 513 ;endfor 503 514 ; print,min(colscale),max(colscale) 504 515 ; plots,lolo,lala,psym=5,symsize=1,color=colscale 516 tb=chint 517 lolo=lonint 518 lala=latint 519 colscale=intarr(n_elements(tb)) 520 for j=0,n_elements(tb)-1 do colscale[j]=(tb[j]-min(tb))*255/(max(tb)-min(tb)) 521 plots,lolo,lala,psym=5,symsize=1,color=colscale,/noerase 522 505 523 end
Note: See TracChangeset
for help on using the changeset viewer.