FORTRAN Generation
(/./ftp/cats/J/ApJ/817/73)

Conversion of standardized ReadMe file for file /./ftp/cats/J/ApJ/817/73 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/ApJ/817/73    QSOs and RR Lyrae in Pan-STARRS1 3{pi} Data (Hernitschek+ 2016)
*================================================================================
*Finding, Characterizing, and Classifying variable sources in multi-epoch sky
*surveys: QSOs and RR Lyrae in PS1 3{pi} data
*    Hernitschek N., Schlafly E.F., Sesar B., Rix H.-W., Hogg D.W., Ivezic Z.,
*    Grebel E.K., Bell E.F., Martin N.F., Burgett W.S., Flewelling H.,
*    Hodapp K.W., Kaiser N., Magnier E.A., Metcalfe N., Wainscoat R.J., Waters C.
*   <Astrophys. J., 817, 73 (2016)>
*   =2016ApJ...817...73H
C=============================================================================

C  Internal variables

      integer*4 i__

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

C  Declarations for 'list.dat'	! List of available catalogs

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

      character*11  FileName   (nr__) ! Name of the catalog
      integer*4     Nsources   (nr__) ! Number of sources
      character*53  Title      (nr__) ! Title of the file

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

C  Declarations for 'catpv3.dat'	! Catalog of variable sources in PS1 3{pi}, with
                                 PV3 version

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

C  J2000 position composed of: RAdeg DEdeg
      real*8        RAdeg      (nr__1) ! (deg) Right ascension (J2000) (RAdeg)
      real*8        DEdeg      (nr__1) ! (deg) Declination (J2000) (DECdeg)
      real*4        chi2       (nr__1) ! [-7/26040] Variability quantity {chi}^2^-hat,
*                                (chi2_hat) (G1)
      real*4        omega      (nr__1) ! [0.01/3.16] Amplitude parameter (omega_best) (G2)
      real*8        tau        (nr__1) ! [0.04/5000] Timescale parameter (tau_best) (G2)
      real*8        gmag       (nr__1) ! (mag) ?=9999.9902 mean g_P1_ (errorweightedmeanmag_g)
      real*8        rmag       (nr__1) ! (mag) ?=9999.9902 mean r_P1_ (errorweightedmeanmag_r)
      real*8        imag       (nr__1) ! (mag) ?=9999.9902 mean i_P1_ (errorweightedmeanmag_i)
      real*8        zmag       (nr__1) ! (mag) ?=9999.9902 mean z_P1_ (errorweightedmeanmag_z)
      real*8        ymag       (nr__1) ! (mag) ?=9999.9902 mean y_P1_ (errorweightedmeanmag_y)
      real*8        W2         (nr__1) ! (mag) ?=-9999.9902  WISE W2 magnitude (W2)
      real*4        pQSO       (nr__1) ! [0/1]  Probability of QSO p_QSO_ (p_QSO)
      real*4        pRRL       (nr__1) ! [0/1] Probability of RR Lyr p_RRL_ (p_RRLyrae)

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

C  Declarations for 'catalog.dat'	! The catalog of variable sources in PS1 3{pi}

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

C  J2000 position composed of: RAdeg DEdeg
      real*8        RAdeg_1    (nr__2) ! (deg) Right ascension, J2000 (RAdeg)
      real*8        DEdeg_1    (nr__2) ! (deg) Declination J2000 (DECdeg)
      real*4        chi2_1     (nr__2) ! [-4/106570] Variability quantity {chi}^2^-hat,
*                                (chi2_hat) (G1)
      real*4        omega_1    (nr__2) ! (mag) [0.01/3.16] amplitude parameter (omega_best) (G2)
      real*8        tau_1      (nr__2) ! (d) [0.04/5000] timescale parameter (tau_best) (G2)
      real*8        gmag_1     (nr__2) ! (mag) ?=- mean g_P1_ (errorweightedmeanmag_g)
      real*8        rmag_1     (nr__2) ! (mag) ?=- mean r_P1_ (errorweightedmeanmag_r)
      real*8        imag_1     (nr__2) ! (mag) ?=- mean i_P1_ (errorweightedmeanmag_i)
      real*8        zmag_1     (nr__2) ! (mag) ?=- mean z_P1_ (errorweightedmeanmag_z)
      real*8        ymag_1     (nr__2) ! (mag) ?=- mean y_P1_ (errorweightedmeanmag_y)
      real*4        W12        (nr__2) ! (mag) [-2.8/6.7]?=- WISE W1-W2 color (W12)
      real*4        pQSO_1     (nr__2) ! [0/1] Probability of QSO p_QSO_ (p_QSO)
      real*4        pRRL_1     (nr__2) ! [0/1] Probability of RR Lyr p_RRL_ (p_RRLyrae)
      character*1   fd         (nr__2) ! [*] Flag (*) indicating 2 solutions (G3)

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

C  Loading file 'list.dat'	! List of available catalogs

C  Format for file interpretation

    1 format(A11,1X,I8,1X,A53)

C  Effective file loading

      open(unit=1,status='old',file=
     +'list.dat')
      write(6,*) '....Loading file: list.dat'
      do i__=1,2
        read(1,'(A74)')ar__
        read(ar__,1)FileName(i__),Nsources(i__),Title(i__)
c    ..............Just test output...........
        write(6,1)FileName(i__),Nsources(i__),Title(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'catpv3.dat'	! Catalog of variable sources in PS1 3{pi}, with
*                                 PV3 version

C  Format for file interpretation

    2 format(
     +  F11.7,1X,F11.7,1X,E12.6,1X,F6.4,1X,F7.2,1X,F9.4,1X,F9.4,1X,
     +  F9.4,1X,F9.4,1X,F9.4,1X,F10.4,1X,F5.3,1X,F5.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'catpv3.dat')
      write(6,*) '....Loading file: catpv3.dat'
      do i__=1,76804905
        read(1,'(A124)')ar__1
        read(ar__1,2)
     +  RAdeg(i__),DEdeg(i__),chi2(i__),omega(i__),tau(i__),gmag(i__),
     +  rmag(i__),imag(i__),zmag(i__),ymag(i__),W2(i__),pQSO(i__),
     +  pRRL(i__)
c    ..............Just test output...........
        write(6,2)
     +  RAdeg(i__),DEdeg(i__),chi2(i__),omega(i__),tau(i__),gmag(i__),
     +  rmag(i__),imag(i__),zmag(i__),ymag(i__),W2(i__),pQSO(i__),
     +  pRRL(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'catalog.dat'	! The catalog of variable sources in PS1 3{pi}

C  Format for file interpretation

    3 format(
     +  F11.7,1X,F11.7,1X,E12.5,1X,F6.4,1X,F7.2,1X,F7.4,1X,F7.4,1X,
     +  F7.4,1X,F7.4,1X,F7.4,1X,F6.3,1X,F5.3,1X,F5.3,A1)

C  Effective file loading

      open(unit=1,status='old',file=
     +'catalog.dat')
      write(6,*) '....Loading file: catalog.dat'
      do i__=1,25409009
        read(1,'(A111)')ar__2
        read(ar__2,3)
     +  RAdeg_1(i__),DEdeg_1(i__),chi2_1(i__),omega_1(i__),tau_1(i__),
     +  gmag_1(i__),rmag_1(i__),imag_1(i__),zmag_1(i__),ymag_1(i__),
     +  W12(i__),pQSO_1(i__),pRRL_1(i__),fd(i__)
        if (idig(ar__2(53:59)).EQ.0) gmag_1(i__) =  rNULL__
        if (idig(ar__2(61:67)).EQ.0) rmag_1(i__) =  rNULL__
        if (idig(ar__2(69:75)).EQ.0) imag_1(i__) =  rNULL__
        if (idig(ar__2(77:83)).EQ.0) zmag_1(i__) =  rNULL__
        if (idig(ar__2(85:91)).EQ.0) ymag_1(i__) =  rNULL__
        if (idig(ar__2(93:98)).EQ.0) W12(i__) =  rNULL__
c    ..............Just test output...........
        write(6,3)
     +  RAdeg_1(i__),DEdeg_1(i__),chi2_1(i__),omega_1(i__),tau_1(i__),
     +  gmag_1(i__),rmag_1(i__),imag_1(i__),zmag_1(i__),ymag_1(i__),
     +  W12(i__),pQSO_1(i__),pRRL_1(i__),fd(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