Changeset 558
- Timestamp:
- 05/22/12 09:59:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/amsu2ncdf_bis.pro
r533 r558 12 12 ; +todo+ 13 13 ; 14 ; :param use_amsua: flag to tell if amsub only or amsub15 ; :type use_amsua: int 0 or 116 ; :raise use_amsua: required14 ; :param numch: number of the channel 15 ; :type numch: string 16 ; :raise numch: required 17 17 ; 18 18 ; :param yyyy: year … … 85 85 ; To produce AMSU netCDF file for 20060801:: 86 86 ; 87 ; use_amsua=187 ; numch='a5' 88 88 ; yyyy=2006L 89 89 ; mm=8 … … 97 97 ; or:: 98 98 ; 99 ; use_amsua=099 ; numch='a5' 100 100 ; yyyy=2006L 101 101 ; mm=8 … … 131 131 ; 132 132 ;- 133 PRO amsu2ncdf, use_amsua, yyyy, mm, dd, lon_min, lon_max, lat_min, lat_max,resol133 PRO amsu2ncdf, numch, yyyy, mm, dd, lon_min, lon_max, lat_min, lat_max, resol 134 134 ; 135 135 compile_opt idl2, strictarrsubs 136 136 ; 137 137 @cm_project 138 139 138 140 testfilename='' 139 prefix=numch140 141 look = 'filename' 141 142 142 143 geomin = geolocation_to_string_idl(lon_min, lat_min, look,1) 143 144 geomax = geolocation_to_string_idl(lon_max, lat_max, look,1) 145 146 testfilename='/homedata/eymard/varamma_d/AMSU/' $ 147 + string(yyyy,format='(I4.4)') + '/' $ 148 + string(mm,format='(I2.2)') + '/' $ 149 + numch + '_' + string(yyyy,format='(I4.4)') $ 150 + string(mm,format='(I2.2)') $ 151 + string(dd,format='(I2.2)') + '_' $ 152 + geomin + '_' + geomax + '.dat' 144 153 145 154 result=file_amsu_t2_to_mem( yyyy,mm,dd,numch,lon_min,lon_max,lat_min,lat_max,testfilename) … … 156 165 ; grille de sortie xaxis, yaxis : 157 166 ; -------------------------------- 158 ; lon : (indgen((maxlon-minlon)/resolt+1)+long(minlon/resolt))*resolt+resolt/2., $ 159 ; lat : (indgen((maxlat-minlat)/resolt+1)+long(minlat/resolt))*resolt+resolt/2. $ 160 xaxis=indgen((lmon_max-lon_min)/resol+1) 161 yaxis=indgen((lat_max-lat_min)/resol+1) 162 print,xaxis,yaxis 167 xaxis=indgen((lon_max-lon_min)/resol+1)*resol+lon_min 168 yaxis=indgen((lat_max-lat_min)/resol+1)*resol+lat_min 163 169 nlon=n_elements(xaxis) 164 170 nlat=n_elements(yaxis) 165 ;minlon=min(xaxis) 166 ;maxlon=max(xaxis) 167 ;minlat=min(yaxis) 168 ;maxlat=max(yaxis) 169 ;resolt=abs(yaxis[1]-yaxis[0]) 170 171 norbit=max(desc) 172 mask=fltarr(nlon,nlat) 173 tb=fltarr(nlon,nlat,nbo) 174 maskg[*]=!values.f_nan 175 tbg[*]=!values.f_nan 171 172 ; calcul seuil pour remplir la nouvelle grille 173 ; -------------------------------------------- 174 ; à adapter pour AMSU-B 175 ; pour AMU-A aussi car ne rempli pas tout les points de grille avec 176 ; ces seuils 177 if strmid(numch,0,1) eq 'a' then begin 178 ; AMSU-A 179 ind_fov19=WHERE(fov eq 19) 180 ind_fov20=WHERE(fov eq 20) 181 182 seuil_lon=ABS(lon[ind_fov19[1]]-lon[ind_fov20[1]])/2. 183 seuil_lat=ABS(lat[ind_fov19[1]]-lat[ind_fov19[2]])/2. 184 ; arrondi au 0.01 superieur pour lisser un peu mais pas trop 185 seuil_lon=CEIL(seuil_lon*100.)/100. 186 seuil_lat=CEIL(seuil_lat*100.)/100. 187 188 ;seuil_lon=.3 189 ;seuil_lat=.25 190 191 print, seuil_lon 192 print, seuil_lat 193 194 endif else begin 195 ; AMSU-B 196 197 endelse 198 199 ; numero d'orbite 200 norb=desc[UNIQ(desc)] 201 ; nombre d'orbites 202 nbo=n_elements(norb) 203 204 ; initialisation 205 maskg=fltarr(nlon,nlat) 206 tbg=fltarr(nlon,nlat,nbo) 207 temp=fltarr(nlon,nlat,nbo) 176 208 iheur=fltarr(nbo) 177 temp=fltarr(nlon,nlat) 178 179 norbit=0 180 for i=0,n_elements(tb1)-1 do begin 181 while desc[i] eq norbit do begin 182 ind=where(abs(lon[i]-xaxis) lt resol/2 and (abs(lat[i]-yaxis) lt resol/2,nbpt) 183 if nbpt ne 0 then begin 184 tbg[ind,norbit]=tb1[i] 185 maskg[ind]=mask[i] 186 temp[ind]=hour[i] 187 endif 188 endwhile 189 iheur[norbit]=mean(temp) 190 norbit=norbit+1 209 210 ; valeur erreur -999. 211 val_err=-999. 212 maskg[*]=val_err 213 tbg[*]=val_err 214 temp[*]=val_err 215 216 ;;; pour chaque orbite ;;; 217 for k=0,nbo-1 do begin 218 ; trouve tous les indices de l'orbite 219 ind_orb=WHERE(desc eq norb[k]) 220 ;;; pour chaque latitude ;;; 221 for j=0,nlat-1 do begin 222 ; trouve la latitude d'origine la plus proche de la nouvelle latitude 223 ; en fonction du seuil choisi 224 ind_lat=WHERE(ABS(yaxis[j]-lat[ind_orb]) lt seuil_lat) 225 ; teste si un unique indice est trouvé 226 if (n_elements(ind_lat) eq 1) then begin 227 ; teste si l'indice trouvé n'est pas vide 228 if (ind_lat ne -1) then begin 229 ;;; pour chaque longitude ;;; 230 for i=0,nlon-1 do begin 231 ind_lon=WHERE(ABS(xaxis[i]-lon[ind_orb[ind_lat]]) lt seuil_lon) 232 ; si plusieurs indices sont trouvés, calcule la moyenne 233 if (n_elements(ind_lon) gt 1) then begin 234 tbg[i,j,k]=MEAN(tb1[ind_orb[ind_lat[ind_lon]]]) 235 temp[i,j,k]=MEAN(hour[ind_orb[ind_lat[ind_lon]]]) 236 endif else begin 237 if (ind_lon ne -1) then begin 238 tbg[i,j,k]=tb1[ind_orb[ind_lat[ind_lon]]] 239 temp[i,j,k]=hour[ind_orb[ind_lat[ind_lon]]] 240 maskg[i,j]=mask[ind_orb[ind_lat[ind_lon]]] 241 endif 242 endelse 243 endfor 244 endif 245 endif else begin 246 ;;; pour chaque longitude ;;; 247 for i=0,nlon-1 do begin 248 ind_lon=WHERE(ABS(xaxis[i]-lon[ind_orb[ind_lat]]) lt seuil_lon) 249 if (n_elements(ind_lon) gt 1) then begin 250 tbg[i,j,k]=MEAN(tb1[ind_orb[ind_lat[ind_lon]]]) 251 temp[i,j,k]=MEAN(hour[ind_orb[ind_lat[ind_lon]]]) 252 endif else begin 253 if (ind_lon ne -1) then begin 254 tbg[i,j,k]=tb1[ind_orb[ind_lat[ind_lon]]] 255 temp[i,j,k]=hour[ind_orb[ind_lat[ind_lon]]] 256 maskg[i,j]=mask[ind_orb[ind_lat[ind_lon]]] 257 endif 258 endelse 259 endfor 260 endelse 261 endfor 262 tps=temp[*,*,k] 263 ind = WHERE(tps eq val_err) 264 tps[ind]=!VALUES.F_NAN 265 iheur[k]=MEAN(tps,/NaN) 191 266 endfor 267 268 ; decomposition de l'heure de l'orbite en heure, minute, seconde 269 h_orb=fix(iheur) 270 m_orb=fix((iheur-h_orb)*60) 271 s_orb=fix((iheur-h_orb-m_orb/60.)*3600) 192 272 193 273 ; 194 274 ; Creation du fichier NetCDF : 195 275 ; ---------------------------- 196 htime=fix(iheur) 197 mtime=fix((iheur-htime)*60) 198 stime=fix((iheur-htime-mtime/60.)*3600) 199 caldat, julday(1,1,yyyy)+iday-1,mttime,dtime,ytime 200 file_ncdf=project_id_env+ 'AMSU/' $ 201 + string(yyyy,format='(I4.4)') + '/' $ 202 + string(mm,format='(I2.2)') + '/' $ 203 + prefix+'ch5_' $ 204 + string(yyyy,format='(I4.4)') $ 205 + string(mm,format='(I2.2)') $ 206 + string(dd,format='(I2.2)') $ 207 +'_' $ 208 + string(htime,format='(I2.2)') $ 209 + string(mtime,format='(I2.2)') $ 210 + string(stime,format='(I2.2)') + '_' $ 211 + geomin + '_' $ 212 + geomax + '_' $ 213 + 'nadir.nc' 214 print, 'iii : avant ', 'create_amsu_netcdf pour ' + file_ncdf 215 create_amsu_netcdf, file_ncdf, ytime, mttime, dtime, htime, mtime, stime $ 216 ,xaxis,yaxis, tbg, maskg 276 277 file_ncdf=project_id_env+ 'AMSU/' $ 278 + string(yyyy,format='(I4.4)') + '/' $ 279 + string(mm,format='(I2.2)') + '/' $ 280 + numch + '_' $ 281 + string(yyyy,format='(I4.4)') $ 282 + string(mm,format='(I2.2)') $ 283 + string(dd,format='(I2.2)') + '_' $ 284 + geomin + '_' $ 285 + geomax + '_' $ 286 + 'nadir.nc' 287 288 create_amsu_netcdf, file_ncdf, yyyy, mm, dd, h_orb, m_orb, s_orb $ 289 ,xaxis,yaxis, tbg, maskg, val_err, numch 290 217 291 ; comment the next line to produce an image 218 goto, ret0292 ; goto, ret0 219 293 ; 220 294 ; Visualisation : 221 295 ; --------------- 222 window 296 minlon=min(xaxis) 297 maxlon=max(xaxis) 298 minlat=min(yaxis) 299 maxlat=max(yaxis) 300 window, 0 223 301 loadct, 39 224 302 map_set, limit=[minlat,minlon,maxlat,maxlon] 225 303 226 tabcolor = MAP_IMAGE( bch5,Startx,Starty, COMPRESS=1, $304 tabcolor = MAP_IMAGE(tbg[*,*,1],Startx,Starty, COMPRESS=1, $ 227 305 LATMIN=minlat, LONMIN=minlon, $ 228 306 LATMAX=maxlat, LONMAX=maxlon, $ 229 m in_value=0, missing=-999.)230 231 lewh=where(tabcolor ne -999., cnt, complement=lewhcmpl)307 max_value=280., min_value=241., missing=val_err) 308 309 lewh=where(tabcolor ne val_err, cnt, complement=lewhcmpl) 232 310 if (cnt ne n_elements(tabcolor)) then begin 233 311 tabcolor[lewhcmpl]=255 … … 246 324 MAP_CONTINENTS, /coasts, color=0 247 325 326 ;saveimage, '20060802_ficdat_orb2_sajust.png', PNG=PNG 327 328 window, 1 329 loadct, 39 330 map_set, limit=[minlat,minlon,maxlat,maxlon] 331 332 tabcolor = MAP_IMAGE(maskg,Startx,Starty, COMPRESS=1, $ 333 LATMIN=minlat, LONMIN=minlon, $ 334 LATMAX=maxlat, LONMAX=maxlon, $ 335 max_value=2., min_value=-1., missing=val_err) 336 337 lewh=where(tabcolor ne val_err, cnt, complement=lewhcmpl) 338 if (cnt ne n_elements(tabcolor)) then begin 339 tabcolor[lewhcmpl]=255 340 tabcolor[lewh]=bytscl(tabcolor[lewh], top=254) 341 endif else begin 342 tabcolor=bytscl(tabcolor, top=254) 343 endelse 344 345 ; ; Display the warped image on the map at the proper position: 346 TV, tabcolor, Startx, Starty 347 348 ; ; Draw gridlines over the map and image: 349 MAP_GRID, latdel=10, londel=10, /LABEL, /HORIZON , color=0 350 351 ; ; Draw continent outlines: 352 MAP_CONTINENTS, /coasts, color=0 353 354 ;saveimage, '20060802_mask_orb2_sajust.png', PNG=PNG 355 248 356 ret0: 249 endwhile250 if (debug eq 1) then begin251 print, 'fin grand while'252 endif253 254 close, lun255 free_lun, lun256 357 257 358 end 359
Note: See TracChangeset
for help on using the changeset viewer.