FORTRAN Generation
(/./ftp/cats/J/A_A/504/981)

Conversion of standardized ReadMe file for file /./ftp/cats/J/A_A/504/981 into FORTRAN code for reading data files line by line.

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-19
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/504/981    Proper motions of cool stars in Upper Sco OB   (Bouy+, 2009)
*================================================================================
*Proper motions of cool and ultracool candidate members in the Upper Scorpius OB
*association.
*    Bouy H., Martin E.L.
*   <Astron. Astrophys., 504, 981-990 (2009)>
*   =2009A&A...504..981B
C=============================================================================

C  Internal variables

      integer*4 i__

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

C  Declarations for 'table3.dat'	! Sample of Upper Scorpius objects with a
                             counterpart in the USNO-B (<I/284>) only or
                             USNO-B and UCAC2 (<I/294>) catalogues

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

C  J2000 position composed of: RAh RAm RAs DE- DEd DEm DEs
      real*8        RAdeg       ! (deg) Right Ascension J2000
      real*8        DEdeg       ! (deg)     Declination J2000
C  ---------------------------------- ! (position vector(s) in degrees)

      integer*4     r_Name      ! Reference for name (G1)
      character*23  Name        ! Name
      character*2   n_Name      ! [ab ] Note on Name (G2)
      integer*4     RAh         ! (h) Right ascension (J2000)
      integer*4     RAm         ! (min) Right ascension (J2000)
      real*4        RAs         ! (s) Right ascension (J2000)
      character*1   DE_         ! Declination sign (J2000)
      integer*4     DEd         ! (deg) Declination (J2000)
      integer*4     DEm         ! (arcmin) Declination (J2000)
      real*4        DEs         ! (arcsec) Declination (J2000)
      character*5   SpT         ! MK spectral type
      real*4        Rmag        ! (mag) ?=- R magnitude from literature
      real*4        Imag        ! (mag) ?=- I magnitude from literature
      character*1   l_EWHa      ! Limit flag on EWHa
      real*8        EWHa        ! (0.1nm) Halpha equivalent width (from literature)
      real*4        r           ! (arcsec) Distance between the object and its closest
*                                     USNO-B (<I/284>) counterpart
      real*4        Epoch       ! (yr) USNO-B(<I/284>) epoch
      integer*4     Nobs        ! Number of epochs used for the proper motion
*                                     measurement in USNO-B (<I/284>) catalogue
      real*4        R1mag       ! (mag) USNO-B (<I/284>) R1 magnitude
      real*4        R2mag       ! (mag) USNO-B (<I/284>) R2 magnitude
      real*4        Imag1       ! (mag) ?=- USNO-B (<I/284>) I magnitude
      integer*4     pmRA        ! (mas/yr) USNO-B (<I/284>) proper motion along RA,
*                                     pmRA*cosDE
      integer*4     e_pmRA      ! (mas/yr) rms uncertainty on pmRA
      integer*4     pmDE        ! (mas/yr) USNO-B (<I/284>) proper motion along DE
      integer*4     e_pmDE      ! (mas/yr) rms uncertainty on pmDE
      real*4        muProb      ! Probability estimator for the likelihood
*                                     that the proper motion is correct as
*                                     defined in the USNO-B (<I/284>) catalogue
      character*2   l_Mm        ! Limit flag on Mm
      real*4        Mm          ! (%) Membership probability for USNO-B (<I/284>)
*                                     catalog
      real*4        r2          ! (arcsec) ?=- Distance between the object and its
*                                        closest UCAC2 (<I/294>) counterpart
      real*4        pmRA2       ! (mas/yr) ?=- UCAC2 (<I/294>) proper motion along RA,
*                                        pmRA*cosDE
      real*4        e_pmRA2     ! (mas/yr) ? rms uncertainty on pmRA
      real*4        pmDE2       ! (mas/yr) ?=- UCAC2 (<I/294>) proper motion along DE
      real*4        e_pmDE2     ! (mas/yr) ? rms uncertainty on pmDE
      character*2   l_Mm2       ! Limit flag on Mm2
      real*4        Mm2         ! (%) ?=- Membership probability for UCAC2
*                                        (<I/294>) catalog

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

C  Declarations for 'table4.dat'	! Sample of Upper Scorpius objects with a
                             counterpart in the UCAC2 (<I/294>) catalogue only

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

C  J2000 position composed of: RAh RAm RAs DE- DEd DEm DEs
      real*8        RAdeg_1     ! (deg) Right Ascension J2000
      real*8        DEdeg_1     ! (deg)     Declination J2000
C  ---------------------------------- ! (position vector(s) in degrees)

      integer*4     r_Name_1    ! Reference for name (G1)
      character*23  Name_1      ! Name
      character*2   n_Name_1    ! [ab ] Note on Name (G2)
      integer*4     RAh_1       ! (h) Right ascension (J2000)
      integer*4     RAm_1       ! (min) Right ascension (J2000)
      real*4        RAs_1       ! (s) Right ascension (J2000)
      character*1   DE__1       ! Declination sign (J2000)
      integer*4     DEd_1       ! (deg) Declination (J2000)
      integer*4     DEm_1       ! (arcmin) Declination (J2000)
      integer*4     DEs_1       ! (arcsec) Declination (J2000)
      character*2   SpT_1       ! MK spectral type
      real*4        Rmag_1      ! (mag) R magnitude from literature
      real*4        EWHa_1      ! (0.1nm) Halpha equivalent width from literature
      real*4        r2_1        ! (arcsec) Distance between the object and its closest
*                                     UCAC2 (<I/294>) counterpart
      real*4        pmRA2_1     ! (mas/yr) UCAC2 (<I/294>) proper motion along RA,
*                                     pmRA*cosDE
      real*4        e_pmRA2_1   ! (mas/yr) rms uncertainty on pmRA
      real*4        pmDE2_1     ! (mas/yr) UCAC2 (<I/294>) proper motion along DE
      real*4        e_pmDE2_1   ! (mas/yr) rms uncertainty on pmDE
      character*2   l_Mm2_1     ! Limit flag on Mm2
      real*4        Mm2_1       ! (%) Membership probability for UCAC2 (<I/294>)
*                                     catalog

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

C  Loading file 'table3.dat'	! Sample of Upper Scorpius objects with a
*                             counterpart in the USNO-B (<I/284>) only or
*                             USNO-B and UCAC2 (<I/294>) catalogues

C  Format for file interpretation

    1 format(
     +  I1,1X,A23,A2,1X,I2,1X,I2,1X,F4.1,1X,A1,I2,1X,I2,1X,F4.1,1X,A5,
     +  1X,F5.2,1X,F6.3,1X,A1,F7.2,1X,F5.3,1X,F6.1,1X,I1,1X,F5.2,1X,
     +  F5.2,1X,F5.2,1X,I4,1X,I2,1X,I4,1X,I2,1X,F3.1,1X,A2,F4.1,1X,
     +  F5.3,1X,F6.1,1X,F4.1,1X,F6.1,1X,F4.1,2X,A2,F4.1)

C  Effective file loading

      open(unit=1,status='old',file=
     +'table3.dat')
      write(6,*) '....Loading file: table3.dat'
      do i__=1,227
        read(1,'(A176)')ar__
        read(ar__,1)
     +  r_Name,Name,n_Name,RAh,RAm,RAs,DE_,DEd,DEm,DEs,SpT,Rmag,Imag,
     +  l_EWHa,EWHa,r,Epoch,Nobs,R1mag,R2mag,Imag1,pmRA,e_pmRA,pmDE,
     +  e_pmDE,muProb,l_Mm,Mm,r2,pmRA2,e_pmRA2,pmDE2,e_pmDE2,l_Mm2,Mm2
        if (idig(ar__(58:62)).EQ.0) Rmag =  rNULL__
        if (idig(ar__(64:69)).EQ.0) Imag =  rNULL__
        if (idig(ar__(107:111)).EQ.0) Imag1 =  rNULL__
        if (idig(ar__(140:144)).EQ.0) r2 =  rNULL__
        if (idig(ar__(146:151)).EQ.0) pmRA2 =  rNULL__
        if(ar__(153:156) .EQ. '') e_pmRA2 = rNULL__
        if (idig(ar__(158:163)).EQ.0) pmDE2 =  rNULL__
        if(ar__(165:168) .EQ. '') e_pmDE2 = rNULL__
        if (idig(ar__(173:176)).EQ.0) Mm2 =  rNULL__
        RAdeg = rNULL__
        DEdeg = rNULL__
c  Derive coordinates RAdeg and DEdeg from input data
c  (RAdeg and DEdeg are set to rNULL__ when unknown)
        if(RAh .GT. -180) RAdeg=RAh*15.
        if(RAm .GT. -180) RAdeg=RAdeg+RAm/4.
        if(RAs .GT. -180) RAdeg=RAdeg+RAs/240.
        if(DEd .GE. 0) DEdeg=DEd
        if(DEm .GE. 0) DEdeg=DEdeg+DEm/60.
        if(DEs .GE. 0) DEdeg=DEdeg+DEs/3600.
        if(DE_.EQ.'-'.AND.DEdeg.GE.0) DEdeg=-DEdeg
c    ..............Just test output...........
        write(6,1)
     +  r_Name,Name,n_Name,RAh,RAm,RAs,DE_,DEd,DEm,DEs,SpT,Rmag,Imag,
     +  l_EWHa,EWHa,r,Epoch,Nobs,R1mag,R2mag,Imag1,pmRA,e_pmRA,pmDE,
     +  e_pmDE,muProb,l_Mm,Mm,r2,pmRA2,e_pmRA2,pmDE2,e_pmDE2,l_Mm2,Mm2
        write(6,'(6H Pos: 2F8.4)') RAdeg,DEdeg
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'table4.dat'	! Sample of Upper Scorpius objects with a
*                             counterpart in the UCAC2 (<I/294>) catalogue only

C  Format for file interpretation

    2 format(
     +  I1,1X,A23,A2,1X,I2,1X,I2,1X,F4.1,1X,A1,I2,1X,I2,1X,I2,1X,A2,
     +  1X,F4.1,1X,F5.1,1X,F5.3,1X,F5.1,1X,F4.1,1X,F5.1,1X,F4.1,1X,A2,
     +  F4.1)

C  Effective file loading

      open(unit=1,status='old',file=
     +'table4.dat')
      write(6,*) '....Loading file: table4.dat'
      do i__=1,22
        read(1,'(A97)')ar__1
        read(ar__1,2)
     +  r_Name_1,Name_1,n_Name_1,RAh_1,RAm_1,RAs_1,DE__1,DEd_1,DEm_1,
     +  DEs_1,SpT_1,Rmag_1,EWHa_1,r2_1,pmRA2_1,e_pmRA2_1,pmDE2_1,
     +  e_pmDE2_1,l_Mm2_1,Mm2_1
        RAdeg_1 = rNULL__
        DEdeg_1 = rNULL__
c  Derive coordinates RAdeg_1 and DEdeg_1 from input data
c  (RAdeg_1 and DEdeg_1 are set to rNULL__ when unknown)
        if(RAh_1 .GT. -180) RAdeg_1=RAh_1*15.
        if(RAm_1 .GT. -180) RAdeg_1=RAdeg_1+RAm_1/4.
        if(RAs_1 .GT. -180) RAdeg_1=RAdeg_1+RAs_1/240.
        if(DEd_1 .GE. 0) DEdeg_1=DEd_1
        if(DEm_1 .GE. 0) DEdeg_1=DEdeg_1+DEm_1/60.
        if(DEs_1 .GE. 0) DEdeg_1=DEdeg_1+DEs_1/3600.
        if(DE__1.EQ.'-'.AND.DEdeg_1.GE.0) DEdeg_1=-DEdeg_1
c    ..............Just test output...........
        write(6,2)
     +  r_Name_1,Name_1,n_Name_1,RAh_1,RAm_1,RAs_1,DE__1,DEd_1,DEm_1,
     +  DEs_1,SpT_1,Rmag_1,EWHa_1,r2_1,pmRA2_1,e_pmRA2_1,pmDE2_1,
     +  e_pmDE2_1,l_Mm2_1,Mm2_1
        write(6,'(6H Pos: 2F8.4)') RAdeg_1,DEdeg_1
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