;+ ; NAME: ; THM_ASI_CREATE_MOSAIC ; ; PURPOSE: ; create mosaic with all THEMIS ASI ; ; CATEGORY: ; None ; ; CALLING SEQUENCE: ; THM_ASI_CREATE_MOSAIC,time ; ; INPUTS: ; Time like '2006-01-01/05:00:00' ; ; OPTIONAL INPUTS: ; None ; ; KEYWORD PARAMETERS: ; cal_files calibration files if they do not need to be read ; gif_out create a gif-file ; verbose print some diagnostics ; pgm_file do not read CDF, but pgm-files ; zbuffer do in z-buffer, not on the screen ; ; OUTPUTS: ; None ; ; OPTIONAL OUTPUTS: ; None ; ; COMMON BLOCKS: ; None ; ; SIDE EFFECTS: ; None ; ; RESTRICTIONS: ; None ; ; EXAMPLE: ; THM_ASI_CREATE_MOSAIC,'2006-01-01/05:00:00' ; ; ; MODIFICATION HISTORY: ; Written by: Harald Frey, 02/06/2007 ; based on example from Donovan/Jackel ; ; NOTES: ; ; VERSION: ; $LastChangedBy$ ; $LastChangedDate$ ; $LastChangedRevision$ ; $URL$ ; ;- PRO THM_ASI_CREATE_MOSAIC,time,cal_files=cal_files,gif_out=gif_out,$ verbose=verbose,pgm_file=pgm_file,zbuffer=zbuffer ; input check if keyword_set(verbose) then verbose=systime(1) if (strlen(time) ne 19) then begin print,'Wrong time input' print,'Correct value like 2006-01-01/05:00:00' return endif ; strip time year=strmid(time,0,4) month=strmid(time,5,2) day=strmid(time,8,2) hour=strmid(time,11,2) minute=strmid(time,14,2) second=strmid(time,17,2) ; setup thm_init timespan,year+'-'+month+'-'+day+'/'+hour,1,/hour thm_asi_stations,site,location ; characters if keyword_set(zbuffer) then chars=1.15 else chars=1.5 ; some setup minimum_elevation_to_plot=8. ;degrees n1=256l*256l if keyword_set(zbuffer) then $ thm_map_set,central_lon=255.,central_lat=63.,xsize=700,ysize=410,scale=2.6e7,zbuffer=zbuffer else $ thm_map_set,central_lon=255.,central_lat=63.,xsize=700,ysize=410,scale=4.e7 ;loadct,0 ;tvlct,r,g,b,/get ;g[255]=0 & b[255]=0 ;tvlct,r,g,b ; read available data thm_mosaic_array,year,month,day,hour,minute,second,strlowcase(site),$ image,corners,elevation,pixel_illuminated,n_sites,verbose=verbose,$ cal_files=cal_files,pgm_file=pgm_file if keyword_set(verbose) then print,'After read: ',systime(1)-verbose,$ ' Seconds' ; fill variables bytval=fltarr(20) for i=0,n_sites-1 do bytval[i]=(median(image[*,i]) > 1) ; prevent divide by zero ; no images found if (max(bytval) eq 1.) then begin print,'No images for ',time return endif for i=0,n_sites-1 do image[*,i]=((image[*,i]/bytval[i])*64.) < 254 for pixel=0l,n1-1l do begin for i_site=0,n_sites-1 do begin if ((pixel_illuminated[pixel,i_site] eq 1) and $ (elevation[pixel,i_site] gt minimum_elevation_to_plot)) then $ polyfill,corners[pixel,[0,1,2,3,0],0,i_site],$ corners[pixel,[0,1,2,3,0],1,i_site],color=image[pixel,i_site] endfor endfor thm_map_add,invariant_lats=[60,65,70,75],invariant_color=210,$ invariant_linestyle=1 xyouts,0.005,0.018,time,color=0,/normal,charsize=chars xyouts,0.005,0.060,'THEMIS-GBO ASI',color=0,/normal,charsize=chars if keyword_set(verbose) then print,'After map: ',systime(1)-verbose,$ ' Seconds' ; search for midnight file f=file_search('midnight.sav',count=count) if (count eq 1) then begin midlons=fltarr(50)+!values.f_nan ut_hour=float(hour)+float(minute)/60.+float(second)/3600. restore,f for i=0,49 do begin lon=interpol(findgen(141)+start_longitude,reform(midnight[i,*]),ut_hour) midlons[i]=lon[0] endfor bad=where(midlons gt 360.,count) if (count gt 0) then midlons[bad]=!values.f_nan plots,smooth(midlons-360.,5),findgen(50)+40.,color=255,/data endif ; gif output if keyword_set(gif_out) then begin tvlct,r,g,b,/get img=tvrd() out_name='MOSA.'+year+'.'+month+'.'+day+'.'+hour+'.'+minute+'.'+second+'.gif' write_gif,out_name,img,r,g,b print,'Output in ',out_name endif if keyword_set(zbuffer) then begin device,/close set_plot,'x' endif if keyword_set(verbose) then print,'Calculation took ',systime(1)-verbose,$ ' Seconds' ;stop end