SUBROUTINE COE2EQ C C COE2EQ C C Convert a pixel position on a conic equal-area projection C image to RA,Dec C C Richard Hook, ST-ECF, April 17th 1997 C Renamed from COE, 10/12/97 C IMPLICIT NONE INTEGER ISTAT,ID,N DOUBLE PRECISION XCO(100),YCO(100),RAOFF,DECOFF INTEGER NC,MPIX REAL DUMMY DOUBLE PRECISION X(1),Y(1),RAREF,DECREF DOUBLE PRECISION CRPIX1,CRPIX2,RPP,RA,DEC DOUBLE PRECISION CDELT1,CDELT2,FLXSCL CHARACTER*80 IMAGE,CHARS DOUBLE PRECISION PIBY PIBY=3.141592653589/180.0 C Get the image name and try to open it CALL UCLGST('image',IMAGE,ISTAT) CALL UIMOPN(IMAGE,1,ID,ISTAT) IF(ISTAT.NE.0) THEN CALL UMSPUT('! Unable to open input image', : 1,0,ISTAT) GO TO 99 ENDIF C Get information from the header CALL EIGTCO(ID,RAREF,CRPIX1,DECREF,CRPIX2, : CDELT1,CDELT2,MPIX,FLXSCL, : XCO,YCO,RAOFF,DECOFF,NC,ISTAT) IF(ISTAT.NE.0) THEN CALL UMSPUT('! Failed to get all header values', : 1,0,ISTAT) GO TO 99 ENDIF C Get the position to be converted CALL UCLGSR('xpix',DUMMY,ISTAT) X(1)=DBLE(DUMMY) CALL UCLGSR('ypix',DUMMY,ISTAT) Y(1)=DBLE(DUMMY) N=1 C Get the scale - assuming it is the same in X and Y RPP=ABS(CDELT1) C Convert the position CALL COE2RD(X,Y,N,RAREF,DECREF,CRPIX1,CRPIX2, : RPP,RA,DEC) C Display the results CALL UMSPUT( : ' X (pixels) Y RA (degrees) Dec', : 1,0,ISTAT) WRITE(CHARS,'(2F10.4,2F15.8)') X(1),Y(1),RA/PIBY,DEC/PIBY CALL UMSPUT(CHARS,1,0,ISTAT) C Close the image CALL UIMCLO(ID,ISTAT) 99 CONTINUE RETURN END