- Timestamp:
- 12/12/11 23:10:30 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/extract_amsua.pro
r456 r457 8 8 ; ================== 9 9 ; 10 ; prgm de lecture des fichiers AMSU (A seulement) 10 ; prgm de lecture des fichiers AMSU (A seulement, a valider avant de 11 ; generaliser pour amsub aussi) 11 12 ; 12 13 ; decode les noms des fichiers dans la date choisie, puis 13 14 ; appelle le prgm de lecture 15 ; 16 ; appelle interpol_correc, qui fournit les fonctions de correction au 17 ; nadir et les applique, en fonction du masque terre-mer issu de la 18 ; carte de bathymetrie de S. Masson 19 ; 20 ; applique une interpolation tenant compte de la dimension de la tache 21 ; au sol selon la position dans la fauchee 14 22 ; 15 23 ; ecrit les donnees pour la zone (lat/long) choisie … … 50 58 ; yyyy 51 59 ; mm 60 ; resol 52 61 ; lon_min 53 62 ; lon_max … … 69 78 ; IDL> mm=8 70 79 ; IDL> dd=1 80 ; IDL> resol=1 71 81 ; IDL> lon_min=-60. 72 82 ; IDL> lon_max=50. … … 79 89 ; TODO 80 90 ; 91 ; lelod 20111212 92 ; 93 ; 94 ; :History: 95 ; 96 ; $Id$ 97 ; 81 98 ; lelod 20111211 82 ; attention, il faut transformer les donnees 2D en 1D 83 ; reprendre methode "extract_amsuab", qui utilisait un "where"? 84 ; ou passer directement dans l'ecriture??? 85 ; 86 ; :History: 87 ; 88 ; $Id$ 89 ; 90 ; lelod 20111211 91 ; mis en commentaires la partie interpolation 99 ; reintegre les modules de correct_nadir_amsu dans extract 92 100 ; prevu decodage de numch pour connaitre le nom instrument et le 93 ;numero du canal (pas fini, au debut) 101 ; numero du canal (pas fini, au debut) --> a faire aussi dans les 102 ; ssprgm appeles (interpol_correc) 103 ; espere que c'est le dernier avatar de cette !!!!?XX^! de 104 ; chaine de traitement AMSU 105 ; 94 106 ; $URL: svn+ssh://lelod@forge.ipsl.jussieu.fr/ipsl/forge/projets/varamma/svn/trunk/src/extract_amsuab.pro $ 95 107 ; … … 188 200 ; 189 201 ;- 190 PRO extract_amsua, numch, yyyy, mm, dd, lon_min, lon_max, lat_min, lat_max202 PRO extract_amsua, numch, yyyy, mm, dd, resol, lon_min, lon_max, lat_min, lat_max 191 203 ; 192 204 compile_opt idl2, strictarrsubs … … 199 211 200 212 213 tbmin=100 214 tbmax=350 215 216 217 ; lecture fichier land - sea (S. Masson) 218 file=project_id_env+'/MASK/ETOPO1_Ice_g_gmt4.nc' 219 domdef,lon_min, lon_max, lat_min, lat_max 220 221 bate = ncdf_lec(file, var = 'z') GT 0 222 xxe = float(ncdf_lec(file, var = 'lon')) 223 yye = float(ncdf_lec(file, var = 'lat')) 224 jpie = n_elements(xxe) 225 jpje = n_elements(yye) 226 227 ; extraction zone donnees AMSU 228 domdef,lon_min,lon_max,lat_min,lat_max 229 bate = ncdf_lec(file, var = 'z') GT 0 230 xxe = float(ncdf_lec(file, var = 'lon')) 231 yye = float(ncdf_lec(file, var = 'lat')) 232 jpie = n_elements;module lecture fichier a introduire ici 233 234 ; inutile maintenant: ouverture du fichier de sortie 201 235 look = 'filename' 202 236 scale = 1. … … 213 247 + geomax $ 214 248 + '.dat' 215 216 249 print, 'ouverture pour ecriture de ', fileout 217 250 openw, lun_obs, fileout, /get_lun 251 252 253 ; appel au ssprgm qui interpole les fonctions de correction (inutile 254 ; de l'appeler a chaque fichier....) 255 if nomcanal eq 'a' then nbpixel=30 256 if nomcanal eq 'b' then nbpixel=90 257 interpol_correc,nomcanal,nbpixel,cor_l,cor_s,swath,track 258 218 259 219 260 ; ouverture des fichiers liste (annee, mois, jour, tous satellites) pour … … 223 264 ; lecture de la liste des fichiers AMSU-A 224 265 ;list_filea = project_id_env+'list_filea' 225 266 list_filea='list_filea' 226 267 ;index_filea= 0 227 228 268 nb_filea = file_lines(list_filea) 269 a = STRARR(nb_filea) 229 270 ; filea = STRARR(nb_filea) 230 231 232 233 234 271 print, 'ouverture pour lecture de ', list_filea 272 openr, lun_a, list_filea, /get_lun 273 filea='' 274 nlist=1 275 ilist=1 235 276 ; while (not eof(lun_a)) do begin 236 237 238 239 277 while ilist le nlist do begin 278 ilist=ilist+1 279 onefile = '' 280 readf, lun_a, filea 240 281 ; filea[index_filea] = onefile 241 282 ; isolate string independant from satellite … … 244 285 ;endwhile 245 286 246 247 248 249 250 251 252 253 na_scan=na[2]; nb lignes (fauchees) dans l'orbite254 na_fov=na[1]; nb points dans la fauchee255 256 257 ; nb pixels dans la fauchee AMSUA258 259 260 261 262 263 264 265 266 267 fovy_1[j,*]=j+1; on remplit un tableau de nscan lignes avec les valeurs de no de pixel268 287 COMMON amsua_header,ama_head 288 COMMON amsua_data ,ama_scan 289 print, 'ouverture et lecture du fichier ', filea 290 openr,lu1,filea,Error=erra,/get_lun 291 read_amsua1c,filea, flag1 292 if (flag1 eq 0) then goto, labfile 293 na=SIZE(reform(ama_scan.btemps[0,*,*])) 294 na_scan=na[2] ; nb lignes (fauchees) dans l'orbite 295 na_fov=na[1] ; nb points dans la fauchee 296 nbpix= na_fov 297 nosat=ama_head.h_satid 298 ; nb pixels dans la fauchee AMSUA 299 fov=indgen(nbpix) 300 n=na 301 n_scan=na_scan 302 n_fov=na_fov 303 304 ntime_1=fltarr(nbpix,n_scan) 305 fovy_1=fltarr(nbpix,n_scan) 306 307 for j=0L, nbpix-1L do begin 308 fovy_1[j,*]=j+1 ; on remplit un tableau de nscan lignes avec les valeurs de no de pixel 309 endfor 269 310 ; 270 311 ; on lit la structure et on extrait les infos: temps, longitude, … … 273 314 ; extraction du canal traite 274 315 275 276 277 278 279 280 281 282 jour_ama=amaday[0]; jour du passage316 amch=REFORM(ama_scan.btemps[nocanal,*,*]/100.) 317 amzen=REFORM(ama_scan.angles[0,*,*]/100.) 318 amalat=REFORM(ama_scan.latlon[0,*,*]/1.E4) 319 amalon=REFORM(ama_scan.latlon[1,*,*]/1.E4) 320 tt=REFORM(ama_scan.scnlintime/3600000.) 321 amaday=REFORM(ama_scan.scnlindy) 322 amafov= fovy_1 323 jour_ama=amaday[0] ; jour du passage 283 324 ; recherche du sens de l'orbite : descendante (1) ou montante (0) 284 lat0=amalat[*,0] 285 lat1=amalat[*,1] 286 if (mean(lat1-lat0) lt 0) then begin 287 desc=1 288 endif else begin 289 desc=0 290 endelse 291 ; attention tableaux a deux dimensions 292 293 294 295 ; appel a interpolswatw pour ajuster les pixels amsua sur une grille 325 lat0=amalat[*,0] 326 lat1=amalat[*,1] 327 if (mean(lat1-lat0) lt 0) then begin 328 desc=1 329 endif else begin 330 desc=0 331 endelse 332 333 ; correction nadir des donnees 334 ch_nadir=fltarr(nbpix,n_scan) 335 lanseamask=intarr(nbpix,n_scan) 336 for isc=0L,n_scan-1L do begin 337 for ifo=0,nbpix-1 do begin 338 ; approximation: 1km= 1deg/100, et on considere le quart en lon et lat 339 ; de la surface du pixel pour optimiser la localisation du centre du 340 ; pixel attention approximation brutale des distances en fractions dedegre 341 ; recherche de la cote par rapport a la resolution AMSUA 342 xind=where (xxe ge amalon[ifo,isc]-swath[ifo]/400. and xxe le amalon[ifo,isc]+swath[ifo]/400.,nxlandsea) 343 yind=where (yye ge amalat[ifo,isc]-track[ifo]/400. and yye le amalat[ifo,isc]+track[ifo]/400.,nylandsea) 344 if(nxlandsea ne 0 and nylandsea ne 0) then begin 345 bate1=bate[xind,*] 346 bate2=bate1[*,yind] 347 if (mean(bate2) le 0.5) then begin 348 ch_nadir[ifo,isc]=amch[ifo,isc]-cor_s[numcanal,ifo] 349 landseamask[ifo,isc]=0 ; mer 350 endif else begin 351 ch_nadir[ifo,isc]=amch[ifo,isc]-cor_l[numcanal,ifo] 352 landseamask[ifo,isc]=1 ; terre 353 endelse 354 endif 355 endfor 356 endfor 357 358 359 ; appel a interpolswath pour ajuster les pixels amsua sur une grille 296 360 ; reguliere dans la fauchee 297 361 ; et selection de la zone conservee 298 362 ;tek_color 299 363 ;resol=1 300 ;nbgrid=0 301 ;chint=fltarr(100) 302 ;latint=fltarr(100) 303 ;lonint=fltarr(100) 304 ;fovint=fltarr(100) 305 ;timeint=fltarr(100) 306 ;time=fltarr(100) 307 ;n_scan-1L 308 ;for i=0L,10L do begin 309 ; tb=amch[*,i] 310 ; lon=amalon[*,i] 311 ; lat=amalat[*,i] 312 ; nbgrid1=nbgrid 313 ; interpolswath,tb,lat,lon,resol,nbgrid,tbgrid,latgrid,longrid 314 ; if i eq 0L then begin 364 nbgrid=0 365 for i=0L,n_scan-1L do begin 366 tb=ch_nadir[*,i] 367 lon=amalon[*,i] 368 lat=amalat[*,i] 369 mask=landseamask[*,i] 370 nbgrid1=nbgrid 371 interpolswath,tb,lat,lon,mask,resol,nbgrid,tbgrid,latgrid,longrid,maskgrid 372 if i eq 0L then begin 315 373 ; plot,lon,tb,psym=1 316 374 ; oplot,longrid,tbgrid,psym=4; 317 ;fovgrid=indgen(nbgrid)+1318 ;endif375 fovgrid=indgen(nbgrid)+1 376 endif 319 377 ; if nbgrid ne nbgrid1 then begin 320 378 ; oplot,lon,tb,psym=1,color=3 321 379 ; oplot,longrid,tbgrid,psym=4,color=5 322 380 ; endif 323 ; zone=where((longrid ge lon_min) and (longrid le lon_max) $ 324 ; and (latgrid ge lat_min) and (latgrid le lat_max),npt) 381 ; selection des taches au sol situees dans la zone d'interet 382 zone=where((longrid ge lon_min) and (longrid le lon_max) $ 383 and (latgrid ge lat_min) and (latgrid le lat_max),npt) 325 384 ;print, 'npt', npt 326 ; if npt ne 0 then begin 327 ; time[zone]=tt[i] 328 ; chint=[chint,tbgrid[zone]] 329 ; latint=[latint,latgrid[zone]] 330 ; lonint=[lonint,longrid[zone]] 331 ; fovint=[fovint,fovgrid[zone]] 332 ; timeint=[timeint,time[zone]] 333 ; endif else begin 334 ; print, 'www : aucun point dans la zone' 335 ; endelse 336 337 ; endfor 338 339 340 341 ; replace missing values -9999.99 by NaN 342 index_missing = where(chint EQ -9999.99, nb_missing) 343 if (nb_missing NE 0) THEN BEGIN 344 tb[index_missing]=!values.f_nan 345 endif 346 ; param landseamask mis fictivement pour unification du format 347 landseamask=!values.f_nan 348 349 print,'nb points dans la zone',nn 350 351 for i=0L, nn-1L do begin 385 if npt ne 0 then begin 386 time[zone]=tt[i] 387 ; alerte: comment initialiser les tableaux qu'on concatene???? 388 if (n_elements(chint) EQ 0) then begin 389 chint=tbgrid[zone] 390 latint=latgrid[zone] 391 lonint=longrid[zone] 392 fovint=fovgrid[zone] 393 maskint=maskgrid[zone] 394 timeint= time[zone] 395 endif else begin 396 chint=[chint,tbgrid[zone]] 397 latint=[latint,latgrid[zone]] 398 lonint=[lonint,longrid[zone]] 399 fovint=[fovint,fovgrid[zone]] 400 maskint=[maskint,maskgrid[zone]] 401 timeint=[timeint,time[zone]] 402 endelse 403 endif else begin 404 print, 'www : aucun point dans la zone' 405 endelse 406 407 endfor 408 409 410 for i=0L, npt-1L do begin 411 if (( chint[i] lt tbmin) or (chint[i] gt tbmax) ) then begin 412 ch_adj[i]=!values.f_nan 413 endif 414 endfor 415 416 417 print,'nb points dans la zone',npt 418 419 for i=0L, npt-1L do begin 352 420 ;format: nosat,mois, day, lon, lat, zen,fov, time, ama_ch1:15,amb_ch1:5 353 421 ; print, 'mois::::', mm,'-----', nab-i 354 355 356 357 358 359 360 361 362 , landseamask: 9$363 364 365 366 422 printf,lun_obs, mm, jour_ama, desc, nosat, fovint[i], landseamask, lonint[i], latint[i], timeint[i],$ 423 chint[i],format='(6(i3,1x),4(f8.4,1x))' 424 if (n_elements(data) EQ 0) then begin 425 data = { desc : desc $ 426 , hour : timeint[i] $ 427 , fov : fovint[i] $ 428 , lon : lonint[i] $ 429 , lat: latint[i] $ 430 , landseamask: maskint[i] $ 431 , tb : chint[i] $ 432 } 433 endif else begin 434 data = [data , { desc : desc $ 367 435 , hour : timeint[i] $ 368 436 , fov : fovint[i] $ 369 437 , lon : lonint[i] $ 370 438 , lat: latint[i] $ 371 , landseamask: 9$439 , landseamask: maskint[i] $ 372 440 , tb : chint[i] $ 373 374 441 }] 442 endelse 443 endfor 375 444 ; fin boucle sur les fichiers lus 376 labfile:377 445 endwhile 378 446 print, 'fermeture de ', fileout … … 381 449 if (n_elements(data) NE 0) then begin 382 450 ; write outputfile 451 ; ajouter resol dans le header 383 452 header = { yyyy : yyyy $ 384 453 , mm : mm $ … … 396 465 print, 'www : no data to write' 397 466 endelse 398 ; 467 399 468 end -
trunk/src/interpol_correc.pro
r455 r457 107 107 ; 108 108 ;- 109 PRO interpol_correc,canal,nbpix,cor_l,cor_s 109 PRO interpol_correc,canal,nbpix,cor_l,cor_s,swath,track 110 110 ; 111 111 @cm_project … … 115 115 116 116 pixelsize,pixatot,pixbtot,alongatot,alongbtot 117 if nomcanal eq 'a' then begin 118 swath=pixatot 119 track=alongatot 120 endif else begin 121 swath=pixbtot 122 track=alongbtot 123 endelse 117 124 118 125 ; parametres AMSU et calcul de la fauchee -
trunk/src/interpolswath.pro
r449 r457 41 41 ; 42 42 ;- 43 pro interpolswath, tb, latlu, lonlu, resol, nbgrid, tbint, latgrid, longrid43 pro interpolswath, tb, latlu, lonlu, masklu, resol, nbgrid, tbint, latgrid, longrid, mask 44 44 45 45 pixelsize,pixatot,pixbtot,alongatot,alongbtot … … 92 92 ;print,tb 93 93 tbint=fltarr(nbgrid) 94 mask=intarr(nbgrid) 94 95 for i=0,na-1 do begin 95 96 ind=where(abs(grid-fova[i]) le pixatot[i]/2,nii) … … 97 98 if nii ne 0 then begin 98 99 tbint[ind]=tb[i] 100 mask[ind]=masklu[i] 99 101 endif 100 102 if nii eq 0 then begin
Note: See TracChangeset
for help on using the changeset viewer.