pro draw_daisy,l3a,filename,_extra=extra,west_ct=west_ct,alt_ct=alt_ct,nan_blue=nan_blue,min_blue=min_blue,cam=cam, $ bottom=bottom,top=top,linecolor=linecolor,coastcolor=coastcolor,min_lat=min_lat, $ square=square,kmperpix=kmperpix, preliminary = preliminary, old_ct = old_ct, linterp_low=linterp_low, linterp_hi=linterp_hi, $ center_lons = center_longs, orbit_numbers = orbit_numbers ; Uncomment the following line to display the daisies to the screen instead of the Z buffer ; screen = 1 ; old_ct = 1 upper_threshold = top ; top gets redefined below ;Set up west coast color table if n_elements(min_blue) eq 0 then min_blue = 64 if n_elements(min_lat) eq 0 then min_lat = 50 if n_elements(linecolor) eq 0 then linecolor=253 if n_elements(coastcolor) eq 0 then coastcolor = 254 ;Load the map restore,!common_input_data+'/coast.sav' south=(l3a.hemisphere eq 'S') plot_project_lambert,lon=coast[0,*],lat=coast[1,*],x=x_coast,y=y_coast,south=south,kmperpix=kmperpix ;Get the square of data which circumscribes the 50deg circle plot_project_lambert,lat=90,lon=0,x=x_pole,y=y_pole,kmperpix=kmperpix plot_project_lambert,lat=min_lat,lon=0,x=x_50,y=y_50,kmperpix=kmperpix bbox_50=fix([y_50,y_50,2*y_pole-y_50,2*y_pole-y_50]) map_size=bbox_50[2]-bbox_50[0]+1 ;---------------------- Set up z buffer -------------------------- IF KEYWORD_SET( SCREEN ) THEN BEGIN SET_PLOT, 'X', /COPY !p.MULTI=[0,1,1] DEVICE, DECOMPOSED = 0, RETAIN = 2 WINDOW, 0, XSIZE = map_size, YSIZE = map_size ERASE ENDIF ELSE BEGIN old_plot=!d.name set_plot,'z' device,set_resolution=[map_size,map_size] ENDELSE cipsct,coastcolor=cocolor,grid=grid,white=white,red=red,green=green,blue=blue,black=black albedo_array = *l3a.albedo IF south EQ 1 THEN BEGIN albedo_array = ROTATE( albedo_array, 2 ) ; Rotate array by 180 degrees in the Southern hemisphere ENDIF copy_overlap, albedo_array, l3a.bbox, in50, bbox_50, /make_dest,initial_value=!VALUES.F_NAN tv, bbox_50 if not keyword_set(bottom) then bottom=0. ; top=max(image,/nan) if not keyword_set(top) then top=max(*l3a.albedo,/nan)*255./249.; *.5 ofs=0 ;------------------- draw the data ------------------------- maxdata=max(in50,/nan) ; Max value of valid data mindata=min(in50,/nan) ; Max value of valid data ; print,mindata, maxdata background_index = where( ~FINITE(in50) ) ; index of orbit pixels threshold_index = where( in50 LE bottom ) ; index of orbit pixels IF threshold_index[0] NE -1 THEN in50[threshold_index] = bottom IF ~KEYWORD_SET( linterp_low ) THEN linterp_low = 0d IF ~KEYWORD_SET( linterp_hi ) THEN linterp_hi = 250d ; original modified_in50 = linterp(double(bottom),0d,double(top+ofs),255d,in50>(bottom - 1)<(top+ofs + 1)) modified_in50 = linterp(double(bottom),linterp_low,double(top+ofs),linterp_hi,in50>(bottom - 1)<(top+ofs + 1)) IF background_index[0] NE -1 THEN modified_in50[ background_index ] = 0 IF threshold_index[0] NE -1 THEN modified_in50[ threshold_index ] = bottom + 1 threshold_index2 = where( modified_in50 GT 0 AND modified_in50 LE bottom AND FINITE(modified_in50) ) IF threshold_index2[0] NE -1 THEN modified_in50[ threshold_index2 ] = bottom + 1 ; On some orbits the max value of modified_in50 may exceed 249 so set these values to 249 threshold_index2 = where( modified_in50 GT 249 AND FINITE(modified_in50) ) IF threshold_index2[0] NE -1 THEN modified_in50[ threshold_index2 ] = 249 tv, modified_in50 if ~keyword_set(square) then begin s=size(in50,/dim) x=double(ramp(-s[0]/2,s[0]/2,s,0)) y=double(ramp(-s[1]/2,s[1]/2,s,1)) w=where(sqrt(x^2+y^2) gt s[0]/2,nw) if nw gt 0 then in50[w]=!values.f_nan w = where(~finite(in50),nw, COMPLEMENT=finite_pixels_index) ; Re-calculate index of bad pixels end ;draw the coastlines plots,/device,x_coast-bbox_50[0],y_coast-bbox_50[1],color=coastcolor ;Prepare the circle of latitude arrays q=findgen(629)/100.0; c=cos(q); s=sin(q); ;draw circles of latitude r=dblarr(91) for i=80,50,-10 do begin plot_project_lambert,lat=i,lon=0,x=x_lat,y=y_lat,kmperpix=kmperpix r[i]=y_pole-y_lat plots,/device,c*r[i]+x_pole-y_50,s*r[i]+y_pole-y_50,color=linecolor,linestyle=1 xyouts,charsize=2,/device,x_pole+r[i]-y_50,y_pole-y_50-20,string(i,format='(%"%02d")'),color=linecolor end ;Draw midnight sun line junk=sunvec(l3a.first_image_start,delta=delta) if south then mn_sun_lat=90d +delta else mn_sun_lat=90d -delta plot_project_lambert,lat=mn_sun_lat,lon=0,x=x_lat,y=y_lat,kmperpix=kmperpix r_mn_sun=y_pole-y_lat plots,/device,c*r_mn_sun+x_pole-y_50,s*r_mn_sun+y_pole-y_50,color=linecolor,linestyle=2 xyouts,/device,charsize=2,align=0,x_pole-y_50,y_pole-y_50-r_mn_sun,string(mn_sun_lat,format='(%"%4.1f")'),color=linecolor if mn_sun_lat gt 90 then label='polar night' else label='midnight sun' xyouts,/device, align=1,x_pole-y_50-2,y_pole-y_50-r_mn_sun,label,color=linecolor ;draw lines of longitude top=dblarr(361) top[*]=r[80]; top[[0,90,180,270]]=0; FOR i=0,360,15 DO BEGIN plots,/device,[x_pole-y_50+top[i]*cos(i*!const.dtor),x_pole-y_50+r[50]*cos(i*!const.dtor)],[y_pole-y_50+top[i]*sin(i*!const.dtor),y_pole-y_50+r[50]*sin(i*!const.dtor)],color=linecolor,linestyle=1 ENDFOR xyouts,/device,charsize=4,20,20,strmid(usec2vms(l3a.first_image_start),0,11), COLOR=255 xyouts,/device,align=1.0,charsize=2,map_size-24,45,'AIM PMC Presence', COLOR=255 xyouts,/device,align=1.0,charsize=2,map_size-24,20,'NASA/HU/VT/CU LASP', COLOR=255 IF preliminary THEN xyouts,/device,align=1.0,charsize=4,FIX( DOUBLE( map_size)/1.75),20,'PRELIMINARY' ; Add orbit number to end of each orbit IF KEYWORD_SET( orbit_numbers ) AND KEYWORD_SET( center_longs ) THEN BEGIN half_map_size = map_size / 2 FOR i = 0, N_ELEMENTS( orbit_numbers ) -1 DO BEGIN IF center_longs[i] LE -999.0 THEN CONTINUE IF south THEN BEGIN angle = center_longs[i] ; ORIENTATION = FIX( center_longs[i] - 90.0 ) ALIGNMENT = 0.5 xloc = half_map_size + ( COS(!const.dtor * angle ) * half_map_size * .99 ) yloc = half_map_size + ( SIN(!const.dtor * angle ) * half_map_size * .99 ) IF xloc lt 60.0 THEN xloc = 60.0 IF xloc gt map_size - 70.0 THEN BEGIN xloc = map_size - 70 yloc += 10 ENDIF IF yloc gt map_size - 25.0 THEN yloc = map_size - 25 print, xloc, yloc, orbit_numbers[i] ENDIF ELSE BEGIN angle = center_longs[i] - 90.0 ORIENTATION = FIX( center_longs[i] ) ALIGNMENT = 0.5 xloc = half_map_size + ( COS(!const.dtor * angle ) * half_map_size * .99 ) yloc = half_map_size + ( SIN(!const.dtor * angle ) * half_map_size * .99 ) IF xloc lt 60.0 THEN xloc = 60.0 IF xloc gt map_size - 70.0 THEN BEGIN xloc = map_size - 70 yloc += 10 ENDIF IF yloc gt map_size - 25.0 THEN yloc = map_size - 25 print, xloc, yloc, orbit_numbers[i], angle, center_longs[i] ENDELSE XYOUTS, xloc, yloc, STRCOMPRESS(STRING(orbit_numbers[i]), /REMOVE_ALL ), COLOR = 249, ORIENTATION = 0, $ CHARSIZE= 2, CHARTHICK = 2, /DEVICE, ALIGNMENT = ALIGNMENT ENDFOR ENDIF POSITION=[0.01, 0.96, 0.25, 0.98] IF upper_threshold LT 10 THEN num_divs = FIX( upper_threshold ) ELSE num_divs = 10 add_colorbar, Color=255, bottom=4, top=245, DIVISIONS=num_divs, MINRANGE=0, MAXRANGE=upper_threshold, $ POSITION=position, NCOLORS = 249, CTOP=249 print, "Saving daisy to: ", filename IF KEYWORD_SET( SCREEN ) THEN BEGIN daisy_image = TVRD(/TRUE) write_png, filename, daisy_image ENDIF ELSE BEGIN saveimage,/png,filename ENDELSE ; spawn,'convert '+filename+' -scale 515x515 '+strrep(filename,'png','',/r)+'web.png' ; spawn,'convert '+filename+' -scale 154x154 '+strrep(filename,'png','',/r)+'thumb.png' IF ~KEYWORD_SET( SCREEN ) THEN set_plot,old_plot end