FORTRAN Generation
(/./ftp/cats/J/A_A/493/339)

Conversion of standardized ReadMe file for file /./ftp/cats/J/A_A/493/339 into FORTRAN code for loading all data files into arrays.

Note that special values are assigned to unknown or unspecified numbers (also called NULL numbers); when necessary, the coordinate components making up the right ascension and declination are converted into floating-point numbers representing these angles in degrees.



      program load_ReadMe
C=============================================================================
C  F77-compliant program generated by readme2f_1.81 (2015-09-23), on 2024-Apr-20
C=============================================================================
*  This code was generated from the ReadMe file documenting a catalogue
*  according to the "Standard for Documentation of Astronomical Catalogues"
*  currently in use by the Astronomical Data Centers (CDS, ADC, A&A)
*  (see full documentation at URL http://vizier.u-strasbg.fr/doc/catstd.htx)
*  Please report problems or questions to   
C=============================================================================

      implicit none
*  Unspecified or NULL values, generally corresponding to blank columns,
*  are assigned one of the following special values:
*     rNULL__    for unknown or NULL floating-point values
*     iNULL__    for unknown or NULL   integer      values
      real*4     rNULL__
      integer*4  iNULL__
      parameter  (rNULL__=--2147483648.)  	! NULL real number
      parameter  (iNULL__=(-2147483647-1))	! NULL int  number
      integer    idig			! testing NULL number

C=============================================================================
Cat. J/A+A/493/339       XMM-Newton serendipitous Survey. V.      (Watson+, 2009)
*================================================================================
*The XMM-Newton serendipitous Survey.
*V. The second XMM-Newton serendipitous source catalogue.
*     Watson M.G., Schroder A.C., Fyfe D., Page C.G., Lamer G., Mateos S.,
*     Pye J., Sakano M., Rosen S., Ballet J., Barcons X., Barret D., Boller T.,
*     Brunner H., Brusa M., Caccianiga A., Carrera F.J., Ceballos M.,
*     Della Ceca R., Denby M., Denkinson G., Dupuy S., Farrell S., Fraschetti F.,
*     Freyberg M.J., Guillout P., Hambaryan V., Maccacaro T., Mathiesen B.,
*     McMahon R., Michel L., Motch C., Osborne J.P., Page M., Pakull M.W.,
*     Pietsch W., Saxton R., Schwope A., Severgnini P., Simpson M., Sironi G.,
*     Stewart G., Stewart I.M., Stobbart A-M., Tedds J., Warwick R., Webb N.,
*     West R., Worrall D., Yuan W.
*    <Astron. Astrophys. 493, 339 (2009)>
*    =2009A&A...493..339W
C=============================================================================

C  Internal variables

      integer*4 i__

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'obs.dat'	! XMM-Newton observations and exposures included
                               in the 2XMM catalogue (IX/40)
                               (table D1 in the paper)

      integer*4 nr__
      parameter (nr__=3491)	! Number of records
      character*140 ar__   	! Full-size record

C  J2000 position composed of: RAdeg DEdeg
      integer*4     Rev        (nr__) ! Satellite revolution number
*                                   (consecutive in time)
      integer*8     ObsID      (nr__) ! Observation number
      integer*4     ODF        (nr__) ! ODF (Observation Data File) version number
      real*8        RAdeg      (nr__) ! (deg) Right ascension in decimal degrees (J2000)
      real*8        DEdeg      (nr__) ! (deg) Declination in decimal degrees (J2000)
      character*20  Target     (nr__) ! Target name
      integer*4     q_Target   (nr__) ! [0/5] Quality classification, 0=best (1)
      integer*4     Ndet       (nr__) ! Number of detections in the field
      integer*4     Ngood      (nr__) ! Number of good detections in the field
      integer*4     PNexp      (nr__) ! [1/3]? Number of the PN exposures merged for
*                                   the source detection
      character*3   PNft       (nr__) ! Filter of the PN exposures (2)
      character*4   PNmd       (nr__) ! PN observing mode (3)
      integer*4     PNtm       (nr__) ! (s) ? Total exposure time of the PN exposures
      integer*4     M1exp      (nr__) ! [1/3]? Number of the MOS1 exposures merged for
*                                         the source detection
      character*3   M1ft       (nr__) ! Filter of the MOS1 exposures (2)
      character*5   M1md       (nr__) ! MOS1 observing mode (3)
      integer*4     M1tm       (nr__) ! (s) ? Total exposure time of the MOS1 exposures
      integer*4     M2exp      (nr__) ! [1/3]? Number of the MOS2 exposures merged for
*                                         the source detection
      character*3   M2ft       (nr__) ! Filter of the MOS2  exposures (2)
      character*5   M2md       (nr__) ! MOS2 observing mode (3)
      integer*4     M2tm       (nr__) ! (s) ? Total exposure time of the MOS2 exposures
*Note (1): Quality classification of the whole observation based on the area
*     flagged as bad in the manual flagging process as compared to the whole
*     detection area, see Sect 7.4. The quality flag as follows:
*      0 = nothing has been flagged
*      1 = 0%<area<0.1% of the total detection mask has been flagged
*      2 = 0.1%<=area<1% has been flagged
*      3 = 1%<= area<10% has been flagged
*      4 = 10%<=area<100% has been flagged
*      5 = the whole field was flagged as bad
*Note (2): Filters are
*    Med = Medium,
*    Tck = Thick,
*    Tn1 = Thin1,
*    Tn2 = Thin2.
*Note (3):  Observing modes from table1, as follows:
*   PFW  = (MOS) Prime Full Window: covering full FOV
*   PPW2 = (MOS) Prime Partial W2:  small central window
*   PPW3 = (MOS) Prime Partial W3:  large central window
*   PPW4 = (MOS) Prime Partial W4:  small central window
*   PPW5 = (MOS) Prime Partial W5:  large central window
*   FU   = (MOS) Fast Uncompressed: central CCD in timing mode
*   RFS  = (MOS) Prime Partial RFS: central CCD
*                with different frame time (Refreshed Frame Store)
*   PFWE = (PN) Prime Full Window Extended: covering full FOV
*   PFW  = (PN) Prime Full Window:  covering full FOV
*   PLW  = (PN) Prime Large Window: half the height of PFW/PFWE

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'table1.dat'	! Data modes of XMM-Newton exposures included in
                               the 2XMM catalogue

      integer*4 nr__1
      parameter (nr__1=10)	! Number of records
      character*98 ar__1  	! Full-size record

      character*3   Inst       (nr__1) ! Instrument (PN or MOS)
      character*4   md         (nr__1) ! Observing mode
      character*26  Name       (nr__1) ! Designation of the mode
      character*61  Comments   (nr__1) ! Description of the mode

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'target.dat'	! 2XMM catalogue fields and targets identifications
                               (table D2 in the paper)

      integer*4 nr__2
      parameter (nr__2=3504)	! Number of records
      character*166 ar__2  	! Full-size record

C  J2000 position composed of: RAdeg DEdeg
      integer*4     Rev_1      (nr__2) ! Satellite revolution number
*                                   (consecutive in time)
      integer*8     ObsID_1    (nr__2) ! Observation number
      character*1   n_ObsID    (nr__2) ! [*] indicates a note in notes.dat file (1)
      integer*4     SRC        (nr__2) ! ?=- Source number per observation of the
*                                      identified
      integer*4     DETID      (nr__2) ! ?=- Detection ID of the identified target
      character*1   Fld        (nr__2) ! Field classification (2)
      character*1   Crd        (nr__2) ! [nps- ] Coordinate preference between proposal
*                                          position and Simbad position (3)
      character*3   Categ      (nr__2) ! Proposal category as taken from the XSA (4)
      character*5   Prog       (nr__2) ! Proposal program as taken from the XSA (5)
      real*8        RAdeg_1    (nr__2) ! (deg) ? Proposal right ascension
*                                    in decimal degrees (J2000) (6)
      real*8        DEdeg_1    (nr__2) ! (deg) ? Proposal declination
*                                    in decimal degrees (J2000) (6)
      character*20  Target_1   (nr__2) ! Proposal target name
      real*8        RASdeg     (nr__2) ! (deg) ?=- Simbad right ascension
*                                      in decimal degrees (J2000)
      real*8        DESdeg     (nr__2) ! (deg) ?=- Simbad declination
*                                      in decimal degrees (J2000)
      character*3   Type       (nr__2) ! Simbad object type
      character*32  SName      (nr__2) ! ?=--- Simbad name for the field
      real*8        RAXdeg     (nr__2) ! (deg) ? XSA right ascension (J2000) (7)
      real*8        DEXdeg     (nr__2) ! (deg) ? XSA declination (J2000) (7)
*Note (1): a star indicates if there is a note for this observation or
*     for this proposal-ID (repeated for the several observations for
*     this proposal) in notes.dat file.
*Note (2): Field classification as follows:
*      p = point or point-like source
*      s = small extended (r<3arcmin)
*      l = large extended (r>3arcmin)
*      e = extended source of unknown extent
*      f = field (all detections are potential targets)
*      x = X-ray shadow experiment and similar, that is, only the spectra
*          of fore- and background objects are of interest (though the
*          location of the field should be considered as target)
*      t = two clearly identified targets (e.g., a double star)
*      n = there is no target associated with the field
*      u = unknown target, i.e., the target could not be classified or
*          is of unknown nature
*Note (3): Coordinate preference between (p) proposal position and (s)
*     Simbad position, depending on which defined the target better; in case
*     of offset positions (usually indicated in the field name from the
*     proposal) (n) no preference is given.
*Note (4): Proposal category as taken from the XMM Science Archive (XSA)
*     as follows:
*      I = Stars, White Dwarfs and Solar System
*     II = White Dwarf Binaries, Neutron Star Binaries,
*          Cataclysmic Variables, ULXs and Black Holes
*    III = Supernovae, Supernova Remnants, Diffuse Emission, and
*          Isolated Neutron Stars
*     IV = Galaxies and Galactic Surveys
*      V = Groups of Galaxies, Clusters of Galaxies, and Superclusters
*     VI = Active Galactic Nuclei, Quasars, BL Lac Objects, and X-ray Background
*    VII = X-ray Background and Surveys
*Note (5): Proposal program as taken from the XSA as follows:
*     GO = Guest Observer
*    Cal = Calibration
*    ToO = Targets of Opportunity
*    Cha = Co-Chandra
*    ESO = Co-ESO
*   Trig = Triggered
*  Large = Large
*Note (6): The proposal position refers to the position given by the
*     observer; this position is placed at a specified detector location
*     which depends on the prime instrument (EPIC or RGS) as indicated by
*     the observer and which avoids chip gaps, dead spots etc, unless an
*     offset is indicated by the investigator.
*Note (7): The XMM Science Archive (XSA) gives the coordinates of the prime
*     instrument viewing direction which are corrected for the star tracker
*     mis-alignment.

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'notes.dat'	! Notes

      integer*4 nr__3
      parameter (nr__3=149)	! Number of records
      character*80 ar__3  	! Full-size record

      integer*8     ObsID_2    (nr__3) ! Observation number
      character*69  Note       (nr__3) ! Text of the note

C=============================================================================

C  Loading file 'obs.dat'	! XMM-Newton observations and exposures included
*                               in the 2XMM catalogue (IX/40)
*                               (table D1 in the paper)

C  Format for file interpretation

    1 format(
     +  I4,1X,I10,1X,I3,1X,F10.6,1X,F10.6,1X,A20,1X,I1,1X,I3,1X,I3,4X,
     +  I1,2X,A3,1X,A4,1X,I6,4X,I1,2X,A3,1X,A5,1X,I6,4X,I1,2X,A3,1X,
     +  A5,1X,I6)

C  Effective file loading

      open(unit=1,status='old',file=
     +'obs.dat')
      write(6,*) '....Loading file: obs.dat'
      do i__=1,3491
        read(1,'(A140)')ar__
        read(ar__,1)
     +  Rev(i__),ObsID(i__),ODF(i__),RAdeg(i__),DEdeg(i__),
     +  Target(i__),q_Target(i__),Ndet(i__),Ngood(i__),PNexp(i__),
     +  PNft(i__),PNmd(i__),PNtm(i__),M1exp(i__),M1ft(i__),M1md(i__),
     +  M1tm(i__),M2exp(i__),M2ft(i__),M2md(i__),M2tm(i__)
        if(ar__(77:77) .EQ. '') PNexp(i__) = iNULL__
        if(ar__(89:94) .EQ. '') PNtm(i__) = iNULL__
        if(ar__(99:99) .EQ. '') M1exp(i__) = iNULL__
        if(ar__(112:117) .EQ. '') M1tm(i__) = iNULL__
        if(ar__(122:122) .EQ. '') M2exp(i__) = iNULL__
        if(ar__(135:140) .EQ. '') M2tm(i__) = iNULL__
c    ..............Just test output...........
        write(6,1)
     +  Rev(i__),ObsID(i__),ODF(i__),RAdeg(i__),DEdeg(i__),
     +  Target(i__),q_Target(i__),Ndet(i__),Ngood(i__),PNexp(i__),
     +  PNft(i__),PNmd(i__),PNtm(i__),M1exp(i__),M1ft(i__),M1md(i__),
     +  M1tm(i__),M2exp(i__),M2ft(i__),M2md(i__),M2tm(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================

C  Loading file 'table1.dat'	! Data modes of XMM-Newton exposures included in
*                               the 2XMM catalogue

C  Format for file interpretation

    2 format(A3,2X,A4,1X,A26,1X,A61)

C  Effective file loading

      open(unit=1,status='old',file=
     +'table1.dat')
      write(6,*) '....Loading file: table1.dat'
      do i__=1,10
        read(1,'(A98)')ar__1
        read(ar__1,2)Inst(i__),md(i__),Name(i__),Comments(i__)
c    ..............Just test output...........
        write(6,2)Inst(i__),md(i__),Name(i__),Comments(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================

C  Loading file 'target.dat'	! 2XMM catalogue fields and targets identifications
*                               (table D2 in the paper)

C  Format for file interpretation

    3 format(
     +  I4,1X,I10,1X,A1,1X,I3,1X,I6,1X,A1,1X,A1,1X,A3,1X,A5,1X,F10.6,
     +  1X,F10.6,1X,A20,1X,F10.6,1X,F10.6,1X,A3,1X,A32,1X,F10.6,1X,
     +  F10.6)

C  Effective file loading

      open(unit=1,status='old',file=
     +'target.dat')
      write(6,*) '....Loading file: target.dat'
      do i__=1,3504
        read(1,'(A166)')ar__2
        read(ar__2,3)
     +  Rev_1(i__),ObsID_1(i__),n_ObsID(i__),SRC(i__),DETID(i__),
     +  Fld(i__),Crd(i__),Categ(i__),Prog(i__),RAdeg_1(i__),
     +  DEdeg_1(i__),Target_1(i__),RASdeg(i__),DESdeg(i__),Type(i__),
     +  SName(i__),RAXdeg(i__),DEXdeg(i__)
        if (SRC(i__) .EQ. 45) SRC(i__) =  iNULL__
        if (DETID(i__) .EQ. 45) DETID(i__) =  iNULL__
        if(ar__2(44:53) .EQ. '') RAdeg_1(i__) = rNULL__
        if(ar__2(55:64) .EQ. '') DEdeg_1(i__) = rNULL__
        if (idig(ar__2(87:96)).EQ.0) RASdeg(i__) =  rNULL__
        if (idig(ar__2(98:107)).EQ.0) DESdeg(i__) =  rNULL__
        if(ar__2(146:155) .EQ. '') RAXdeg(i__) = rNULL__
        if(ar__2(157:166) .EQ. '') DEXdeg(i__) = rNULL__
c    ..............Just test output...........
        write(6,3)
     +  Rev_1(i__),ObsID_1(i__),n_ObsID(i__),SRC(i__),DETID(i__),
     +  Fld(i__),Crd(i__),Categ(i__),Prog(i__),RAdeg_1(i__),
     +  DEdeg_1(i__),Target_1(i__),RASdeg(i__),DESdeg(i__),Type(i__),
     +  SName(i__),RAXdeg(i__),DEXdeg(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================

C  Loading file 'notes.dat'	! Notes

C  Format for file interpretation

    4 format(I10,1X,A69)

C  Effective file loading

      open(unit=1,status='old',file=
     +'notes.dat')
      write(6,*) '....Loading file: notes.dat'
      do i__=1,149
        read(1,'(A80)')ar__3
        read(ar__3,4)ObsID_2(i__),Note(i__)
c    ..............Just test output...........
        write(6,4)ObsID_2(i__),Note(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================
      stop
      end

C Locate position of first digit in string; or return 0
      integer function idig(c)
      character*(*) c
      character*1 c1
      integer lc,i
      lc=len(c)
      idig=0
      do i=1,lc
         if(c(i:i).ne.' ') go to 1
      end do
    1 if(i.gt.lc) return
      c1=c(i:i)
      if(c1.eq.'.'.or.c1.eq.'-'.or.c1.eq.'+') i=i+1
      if(i.gt.lc) return
      c1=c(i:i)
      if(c1.ge.'0'.and.c1.le.'9') idig=i
      return
      end