FORTRAN Generation
(/./ftp/cats/V/136)

Conversion of standardized ReadMe file for file /./ftp/cats/V/136 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. V/136                 Teff and metallicities for Tycho-2 stars   (Ammons+, 2006)
*================================================================================
*The N2K consortium.
*IV. New temperatures and metallicities for more than 100,000 FGK dwarfs.
*    Ammons S.M., Robinson S.E., Strader J., Laughlin G., Fischer D., Wolf A.
*   <Astrophys. J., 638, 1004-1017 (2006)>
*   =2006ApJ...638.1004A
C=============================================================================

C  Internal variables

      integer*4 i__

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

C  Declarations for 'tycall.dat'	! Photometry and derived parameters for all
                               Tycho 2 stars, including giants

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

C  J2000 position composed of: RAdeg DEdeg (Epoch=J2000)
      character*12  Tycho       ! Tycho identification (G1)
      integer*4     HIP         ! ?=0 Hipparcos identification number (G1)
      real*8        RAdeg       ! (deg) Right Ascension IRCS, Ep=J2000 (degrees) (G1)
      real*8        DEdeg       ! (deg) Declination IRCS, Ep=J2000 (degrees) (G1)
      real*8        pmRA        ! (mas/yr) ?=* Proper motion parallel to RA (G1)
      real*8        pmDE        ! (mas/yr) ?=* Proper motion parallel to DE (G1)
      real*4        e_pmRA      ! (mas/yr) Standard error (sigma) on pmRA (G1)
      real*4        e_pmDE      ! (mas/yr) Standard error (sigma) on pmDE (G1)
      real*4        Bmag        ! (mag) HIP BT magnitude (G1)
      real*4        e_Bmag      ! (mag) Standard error (sigma) on Bmag (G1)
      real*4        Vmag        ! (mag) HIP VT magnitude (G1)
      real*4        e_Vmag      ! (mag) Standard error (sigma) on Vmag (G1)
      real*4        Jmag        ! (mag) ?=0 2MASS J magnitude (G2)
      real*4        e_Jmag      ! (mag) ?=0 Standard error (sigma) on Jmag (G2)
      real*4        Hmag        ! (mag) ?=0 2MASS H magnitude (G2)
      real*4        e_Hmag      ! (mag) ?=0 Standard error (sigma) on Hmag (G2)
      real*4        Ksmag       ! (mag) ?=0 2MASS Ks magnitude (G2)
      real*4        e_Ksmag     ! (mag) ?=0 Standard error (sigma) on Ksmag (G2)
      real*8        Teff        ! (K) ?=99999 Effective temperature (coarse spline)
      real*8        E_Teff      ! (K) ?=99999 Positive error bar (sigma) on Te
      real*8        e_Teff_1    ! (K) ?=99999 Negative error bar (sigma) on Te
      real*8        Dist        ! (pc) ?=9999 Estimated distance
      real*8        E_Dist      ! (pc) ?=9999 Positive error bar (sigma) on Dist
      real*8        e_Dist_1    ! (pc) ?=9999 Negative error bar (sigma) on Dist

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

C  Declarations for 'tycdwarf.dat'	! Photometry and derived parameters for dwarfs

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

C  J2000 position composed of: RAdeg DEdeg
      character*12  Tycho_1     ! Tycho identification (G1)
      integer*4     HIP_1       ! ?=0 Hipparcos identification number (G1)
      real*8        RAdeg_1     ! (deg) Right Ascension J2000 (degrees) (G1)
      real*8        DEdeg_1     ! (deg) Declination J2000 (degrees) (G1)
      real*8        pmRA_1      ! (mas/yr) ?=* Proper motion parallel to RA (G1)
      real*8        pmDE_1      ! (mas/yr) ?=* Proper motion parallel to DE (G1)
      real*4        e_pmRA_1    ! (mas/yr) Standard error (sigma) on pmRA (G1)
      real*4        e_pmDE_1    ! (mas/yr) Standard error (sigma) on pmDE (G1)
      real*4        Bmag_1      ! (mag) Tycho B magnitude (G1)
      real*4        e_Bmag_1    ! (mag) Standard error (sigma) on Bmag (G1)
      real*4        Vmag_1      ! (mag) Tycho V magnitude (G1)
      real*4        e_Vmag_1    ! (mag) Standard error (sigma) on Vmag (G1)
      real*4        Jmag_1      ! (mag) 2MASS J magnitude (G2)
      real*4        e_Jmag_1    ! (mag) Standard error (sigma) on Jmag (G2)
      real*4        Hmag_1      ! (mag) 2MASS H magnitude (G2)
      real*4        e_Hmag_1    ! (mag) Standard error (sigma) on Hmag (G2)
      real*4        Ksmag_1     ! (mag) 2MASS Ks magnitude (G2)
      real*4        e_Ksmag_1   ! (mag) Standard error (sigma) on Ksmag (G2)
      real*8        Teff_1      ! (K) ?=99999 Effective temperature (coarse spline)
      real*8        E_Teff_2    ! (K) ?=99999 Positive error bar (sigma) on Teff
      real*8        e_Teff_3    ! (K) ?=99999 Negative error bar (sigma) on Teff
      real*8        Dist_1      ! (pc) Estimated distance
      real*8        E_Dist_2    ! (pc) Positive error bar (sigma) on Dist
      real*8        e_Dist_3    ! (pc) Negative error bar (sigma) on Dist
      real*8        TeffF       ! (K) ?=99999 Effective temperature
*                                    (fine spline) (3)
      real*8        E_TeffF     ! (K) Positive error bar (sigma) on TeffF
      real*8        e_TeffF_1   ! (K) Negative error bar (sigma) on TeffF
      real*8        v_Fe_H_     ! ([Sun]) Estimated Metallicity ([Fe/H])
      real*8        E__Fe_H_    ! ([Sun]) Positive error bar (sigma) on [Fe/H]
      real*8        e__Fe_H__1  ! ([Sun]) Negative error bar (sigma) on [Fe/H]
      real*8        pM          ! ? Probability of Multiplicity (KTG IMF) (4)
      real*8        E_pM        ! Positive error bar (sigma) on pM
      real*8        e_pM_1      ! Negative error bar (sigma) on pM
      real*8        pMm         ! ? Probability of Multiplicity
*                                    (modified KTG IMF) (5)
      real*8        E_pMm       ! Positive error bar (sigma) on pMm
      real*8        e_pMm_1     ! Negative error bar (sigma) on pMm
      real*8        E_B_V       ! (mag) Foreground Galactic extinction (6)
*Note (3):
*  * "Fine spline" temperature calibration is trained on dwarf stars
*    and is more accurate than the "Coarse spline" for dwarfs.
*  * The "coarse spline" temperature calibration is to be used on both
*    giants and dwarfs.
*Note (4): KTG IMF: Kroupa, Tout & Gilmore (1993MNRAS.262..545K)
*Note (5): modified KTG IMG has a slope of {alpha}=-2.35 for masses above
*     solar as opposed to {alpha}=-2.7
*Note (6): Foreground Galactic extinction from Schlegel et al.
*     (1998ApJ...500..525S)

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

C  Loading file 'tycall.dat'	! Photometry and derived parameters for all
*                               Tycho 2 stars, including giants

C  Format for file interpretation

    1 format(
     +  A12,1X,I6,1X,F10.6,1X,F10.6,1X,F7.2,1X,F7.2,1X,F5.2,1X,F5.2,
     +  1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,
     +  F5.3,1X,F6.3,1X,F5.3,1X,F10.3,2X,F9.3,2X,F9.3,1X,F10.3,2X,
     +  F9.3,2X,F9.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'tycall.dat')
      write(6,*) '....Loading file: tycall.dat'
      do i__=1,2399792
        read(1,'(A200)')ar__
        read(ar__,1)
     +  Tycho,HIP,RAdeg,DEdeg,pmRA,pmDE,e_pmRA,e_pmDE,Bmag,e_Bmag,
     +  Vmag,e_Vmag,Jmag,e_Jmag,Hmag,e_Hmag,Ksmag,e_Ksmag,Teff,E_Teff,
     +  e_Teff_1,Dist,E_Dist,e_Dist_1
        if (idig(ar__(43:49)).EQ.0) pmRA =  rNULL__
        if (idig(ar__(51:57)).EQ.0) pmDE =  rNULL__
c    ..............Just test output...........
        write(6,1)
     +  Tycho,HIP,RAdeg,DEdeg,pmRA,pmDE,e_pmRA,e_pmDE,Bmag,e_Bmag,
     +  Vmag,e_Vmag,Jmag,e_Jmag,Hmag,e_Hmag,Ksmag,e_Ksmag,Teff,E_Teff,
     +  e_Teff_1,Dist,E_Dist,e_Dist_1
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'tycdwarf.dat'	! Photometry and derived parameters for dwarfs

C  Format for file interpretation

    2 format(
     +  A12,1X,I6,1X,F10.6,1X,F10.6,1X,F7.2,1X,F7.2,1X,F5.2,1X,F5.2,
     +  1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,
     +  F5.3,1X,F6.3,1X,F5.3,1X,F10.3,2X,F9.3,2X,F9.3,1X,F10.3,2X,
     +  F9.3,2X,F9.3,1X,F10.3,2X,F9.3,2X,F9.3,1X,F7.3,1X,F7.3,1X,F7.3,
     +  1X,F10.6,2X,F9.6,2X,F9.6,1X,F10.6,2X,F9.6,2X,F9.6,1X,F10.6)

C  Effective file loading

      open(unit=1,status='old',file=
     +'tycdwarf.dat')
      write(6,*) '....Loading file: tycdwarf.dat'
      do i__=1,611798
        read(1,'(A334)')ar__1
        read(ar__1,2)
     +  Tycho_1,HIP_1,RAdeg_1,DEdeg_1,pmRA_1,pmDE_1,e_pmRA_1,e_pmDE_1,
     +  Bmag_1,e_Bmag_1,Vmag_1,e_Vmag_1,Jmag_1,e_Jmag_1,Hmag_1,
     +  e_Hmag_1,Ksmag_1,e_Ksmag_1,Teff_1,E_Teff_2,e_Teff_3,Dist_1,
     +  E_Dist_2,e_Dist_3,TeffF,E_TeffF,e_TeffF_1,v_Fe_H_,E__Fe_H_,
     +  e__Fe_H__1,pM,E_pM,e_pM_1,pMm,E_pMm,e_pMm_1,E_B_V
        if (idig(ar__1(43:49)).EQ.0) pmRA_1 =  rNULL__
        if (idig(ar__1(51:57)).EQ.0) pmDE_1 =  rNULL__
        if(ar__1(259:268) .EQ. '') pM = rNULL__
        if(ar__1(292:301) .EQ. '') pMm = rNULL__
c    ..............Just test output...........
        write(6,2)
     +  Tycho_1,HIP_1,RAdeg_1,DEdeg_1,pmRA_1,pmDE_1,e_pmRA_1,e_pmDE_1,
     +  Bmag_1,e_Bmag_1,Vmag_1,e_Vmag_1,Jmag_1,e_Jmag_1,Hmag_1,
     +  e_Hmag_1,Ksmag_1,e_Ksmag_1,Teff_1,E_Teff_2,e_Teff_3,Dist_1,
     +  E_Dist_2,e_Dist_3,TeffF,E_TeffF,e_TeffF_1,v_Fe_H_,E__Fe_H_,
     +  e__Fe_H__1,pM,E_pM,e_pM_1,pMm,E_pMm,e_pMm_1,E_B_V
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