PRO newmodlat,image,h,sat,device=device,shrink=shrink ; ; This procedure takes the name of an image file, an assumed emission ; height (km), and a satellite name (strict SpaceTrack format), and ; plots the specified image in geographic coordinates, with the ; trajectory of the specified satellite overplotted on the projected ; image. The satellite name is optional. If keyword device is ; set, the plot goes to the specified device, otherwise the default ; device is 'X'. If keyword shrink is set, the image is shrunk by ; the factor shrink, otherwise the full 256x256 image is used. ; ; Note that variable names that correspond to large arrays having ; outlived their usefulness are reassigned to short strings to save ; memory. ; t0=SYSTIME(1) ; set 'decimation' factor to speed up processing IF KEYWORD_SET(shrink) THEN ff=FLOAT(shrink) ELSE ff=1.0 ; edge length of 'decimated' image l=LONG(292L/ff+0.5) ; read in image and subtract dark frame PRINT,'Read image and subtract dark frame...' rdkimg,image,hb,i head=gethd(hb) cam=head.misc.cam exp=head.misc.exp_scale*head.exp.exposure/1000. rdmeandk,cam,exp,dk1 i=(i-dk1)>0 ibord=INTARR(292,292) ibord(18:273,18:273)=i dk1='empty' ; 'decimate' the image IF ff EQ FIX(ff) THEN BEGIN bi=REBIN(ibord,l,l) ENDIF ELSE BEGIN bi=CONGRID(ibord,l,l,/INTERP,/MINUS_ONE) ENDELSE i='empty' ; identify useful min and max values for byte-scaling prad=150/ff dddd=SHIFT(dist(l),l/2,l/2) wprad=WHERE(dddd LE prad) base=WHERE(dddd GT prad) ih=HISTOGRAM(bi(wprad),MIN=0,BIN=1) ; histogram of exposed image cih=ih ; next line computes cumulative pixel value pdf FOR jj=1,N_ELEMENTS(cih)-1 DO cih(jj)=cih(jj)+cih(jj-1) cih=cih/FLOAT(MAX(cih)) ; normalize to unity lmaxi=MAX(WHERE(cih LE .999)) ; top 0.1% of pixels saturate ; if viewing sky image, take dark 'skirt' as min value bh=HISTOGRAM(bi(base),MIN=0,BIN=1) maxbh=MAX(bh,lmaxbh) ; bottom = most prob. skirt value bi=BYTSCL(bi,MIN=lmaxbh,MAX=lmaxi) ; plot the 'decimated' image for comparison loadct,13 IF (NOT KEYWORD_SET(device)) OR (STRUPCASE(device) EQ 'X') THEN BEGIN WINDOW,2,XSIZE=l,YSIZE=l TVSCL,ROTATE(bi,2) ENDIF PRINT,SYSTIME(1)-t0,' seconds elapsed...' ; create arrays giving the column and row numbers of all pixels PRINT,'Make azimuth and zenith angle maps...' w=REFORM(TEMPORARY(INDGEN(l^2)),l,l) one2two,w,bi,col,row stop w='empty' ; parameters of the star fit for camera 0 ;c0=130.575/ff ;r0=126.297/ff ;r=203.723/ff ;k=0.626410 ;ca=0.229637 ;c0=130.302/ff ;r0=126.375/ff c0=148.302/ff r0=144.375/ff r=199.895/ff k=0.638308 ca=0.227637 ; apply the inverse transformation, from col/row to az/za dc=col-REPLICATE(c0,l,l) col='empty' dr=row-REPLICATE(r0,l,l) row='empty' rho=SQRT(dc^2.+dr^2.)