;------------------------------------------------------------------ ;+ ; NAME: ; CENTERE ; PURPOSE: ; Find center Sun position in BBSO polar magnetograms. ; This procedure estimates the Sun center position in pixel ; coordinates. This procedure uses the center X, Y position ; (provided by the guider) along with image scale information ; provided by the user. ; CATEGORY: ; POLAR ; CALLING SEQUENCE: ; centere(vimg,jimg,vih,jih,imgscl) ; INPUTS: ; vimg = IDL image for input magnetogram (FITS format). ; jimg = IDL image for input direct image (FITS format). ; vih = FITS header for vimg ; jih = FITS header for jimg ; imgscl = image scale (pixels / arcsec). ; KEYWORD PARAMETERS: ; gcorr = correction to picture center coordinates. The ; real coordinates are the file coordinates divided ; by gcorr. If gcorr is zero or not present, no correction ; is applied. ; OUTPUTS: ; The FITS headers in vfile and jfile have the following ; FITS keywords added: ; CENTERX, CENTERY = center Sun coordinates in pixels. ; RADIUS = radius of Sun in pixels. ; SDRAD = standard deviation of radius in pixels (always 0 ; for centere). ; COMMON BLOCKS: ; NOTES: ; The time, date, and position information are taken from the ; V image. The FITS keywords are added in BOTH images. ; This assumes that the time and position are the same for both ; images. ; MODIFICATION HISTORY: ; J. Varsik, 13 Oct. 1995 --- Port from IRAF task ; J. Varsik, 26 Feb. 1999 --- Numerous changes. ;- ;------------------------------------------------------------------- pro centere,vi,ji,vih,jih,imgscl,c_corr=gcorrk ; Display IDL header if help is required. if (keyword_set(help)) then begin get_idlhdr,'centere.pro' goto,finishup endif ; Check for coordinate correction keyword if (keyword_set(gcorrk)) then gcorr=gcorrk else gcorr = 0.0 ; Obtain FITS parameters from V image ew = FXPAR(vih,'CRVAL1') ns = FXPAR(vih,'CRVAL2') datec = FXPAR(vih,'DATE-OBS') timec = FXPAR(vih,'TIME-OBS') ; Note new Y2K FITS format READS,datec,yrs,mon,day,FORMAT='(i4,1x,i2,1x,i2)' READS,timec,hour,min,sec,FORMAT='(i2,1x,i2,1x,i2)' hr = hour + ((min + (sec / 60.0)) / 60.0) ; Use solar ephemeris from Johns Hopkins library sun,yrs,mon,day,hr,pa=p,lat0=b,sd=rsun ; pandb,mon,day,yrs,hr,p,b,rsun,mjd sprad = rsun * imgscl sdrad = 0.0 if (gcorr EQ 0.0) then begin h = imgscl * ew + 256 k = (-1.0 * imgscl * ns) + 192 endif else begin h = imgscl * (ew / gcorr) + 256 k = (-1.0 * imgscl * (ns / gcorr)) + 192 endelse commx = 'center of sun, x-coordinate' commy = 'center of sun, y-coordinate' commr = 'radius of sun, pixels' commr2 = 'standard deviation in radius' fxaddpar,vih,'CENTERX',h,commx fxaddpar,vih,'CENTERY',k,commy fxaddpar,vih,'RADIUS',sprad,commr fxaddpar,vih,'SDRAD',sdrad,commr2 fxaddpar,jih,'CENTERX',h,commx fxaddpar,jih,'CENTERY',k,commy fxaddpar,jih,'RADIUS',sprad,commr fxaddpar,jih,'SDRAD',sdrad,commr2 finishup: return end