FORTRAN Generation
(/./ftp/cats/VII/259)

Conversion of standardized ReadMe file for file /./ftp/cats/VII/259 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. VII/259             6dF  galaxy survey final redshift release   (Jones+, 2009)
*================================================================================
*6dF galaxy survey final redshift release
*    Jones D.H., Read M.A., Saunders W., Colless M., Jarrett T., Parker Q.A.,
*    Fairall A.P., Mauch T., Sadler E.M., Watson F.G., Burton D., Campbell L.A.,
*    Cass P., Croom S.M., Dawe J., Fiegert K., Frankcombe L., Hartley M.,
*    Huchra J., James D., Kirby E., Lahav O., Lucey J., Mamon G.A., Moore L.,
*    Peterson B.A., Prior S., Proust D., Russell K., Safouris V.,
*    Wakamatsu K.-I., Westra E., Williams M.
*   <Mon. Not. R. Astron. Soc. 399, 683 (2009) >
*   =2009MNRAS.399..683J
C=============================================================================

C  Internal variables

      integer*4 i__

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

C  Declarations for '6dfgs.dat'	! The 6dF Galaxy Survey Redshift Catalogue Data
                            Release 3 (final release)

      integer*4 nr__
      parameter (nr__=124647)	! Number of records
      character*178 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)

      character*15  v6dFGS      ! Galaxy survey target ID (gHHMMSSs+DDMMSS)
      integer*4     RAh         ! (h) Right ascension (J2000)
      integer*4     RAm         ! (min) Right ascension (J2000)
      real*4        RAs         ! (s) [0,60] 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) [0,60] Declination (J2000)
      integer*4     Nm          ! Number of 6dFGS measurements (of any quality)
      integer*4     Nz          ! Number of measurements used in final cz
*                                   (of quality 3 or 4 only)
      real*4        bJmag       ! (mag) Recalibrated b_J_ magnitude (BMAG)
      integer*4     PrID        ! Programme ID number (PROGID in database)
      real*4        rFmag       ! (mag) Recalibrated r_F_ magnitude (RMAG)
      integer*4     S_G         ! [0/4] SuperCOSMOS star/galaxy classifier:
*                                    1=galaxy, 2=star, 3=unclassifiable, 4=noise
      integer*4     f_cz        ! Comparison flags between z measurements (2)
      integer*4     cz          ! (km/s) Best available combined recession velocity cz
      integer*4     e_cz        ! (km/s) Combined uncertainty in cz (3)
      integer*4     r_cz        ! Code identifying source of redshift (4)
      integer*4     q_cz        ! Best redshift quality value available (5)
      real*4        GLON        ! (deg) [0,360.0] Galactic longitude
      real*4        GLAT        ! (deg) Galactic latitude
      real*4        AV          ! (mag) Galactic extinction in V magnitudes (from
*                                   Schlegel et al., 1998ApJ...500..525S)
      integer*4     w           ! Original weight source had for first round of
*                                   fibre allocation
      integer*4     Target      ! [2/179260] TARGETID number in 6dFGS database
      character*9   Template    ! Template code(s) (6)
      character*18  FileName    ! Name of redshift field file containing the
*                                   redshift (7)
      character*29  SpecID      ! SPECID values of redshifts contributing to the
*                                   final combined redshift
*Note (2): The comparison threshold is 330km/s, and the
*     flag is the sum of the following individual values:
*      0 = sole measurement or agreement within threshold
*      1 = >=1 6dFGS-6dFGS disagreement  (median cz listed)
*      2 = >=1 6dFGS-ZCAT disagreement   (6dFGS cz listed)
*      4 = >=1 6dFGS-2dFGRS disagreement (6dFGS cz listed)
*      8 = >=1 6dFGS-SDSS disagreement   (6dFGS cz listed)
*     16 = >=1 6dFGS-ZCAT agreement      (6dFGS cz listed)
*     32 = >=1 6dFGS-2dFGRS agreement    (6dFGS cz listed)
*     64 = >=1 6dFGS-SDSS agreement      (6dFGS cz listed)
*
*     The 6dFGS cz values (Q=3,4) are listed in all cases in preference to
*     the external value for redshift. ZCAT/2dFGRS/SDSS values are listed
*     when no Q=3,4 6dFGS cz is available. Note that in the case of three or
*     more 6dFGS measurements, just because one pair of 6dFGS measurements
*     disagree, the redshift may in fact be secure through the remaining
*     measurements. This can be checked against items Nmeas and Ncz.
*Note (3): Obtained by error-weighting individual redshifts, where Q=3
*     redshifts have uncertainty 55km/s and Q=4 have 45km/s. 6dFGS redshifts
*     deemed unsuitable for extragalactic use (either because of measurement
*     uncertainty or spectral classification) have had their uncertainties
*     set to 0km/s. SDSS redshifts have an uncertainty of 30km/s (Abazajian
*     et al., 2005AJ....129.1755A). 2dFGRS redshifts have uncertainties of
*     123km/s or 89km/s for redshift Q=3 or Q=4 respectively (Colless et al.
*     2001, Cat. <VII/250>). and col. "q_cz" below). ZCAT redshifts carry
*     the uncertainties from their original surveys and so vary.
*Note (4): Sources of redshift are:
*      0 = no (or unreliable 6dFGS) measure;
*  1..99 = ZCAT;
*    126 = 6dFGS;
*    250 = SDSS;
*    392 = 2dFGRS
*Note (5): Quality value as follows:
*      0 = no redshift quality value available
*      1 = 6dFGS or 2dFGRS, unusable measurement.
*      2 = 6dFGS or 2dFGRS, possible, but doubtful redshift estimate
*      3 = 6dFGS or 2dFGRS, 'probable' redshift (notionally 90% confidence)
*      4 = 6dFGS or 2dFGRS, reliable redshift (notionally 99% confidence)
*      6 = 6dFGS confirmed Galactic source
*      9 = SDSS and ZCAT sources (not a measure of quality)
*
*     See Jones et al. (2004MNRAS.355..747J) or Colless et al. (2001, Cat.
*     VII/250, 2001MNRAS.328.1039C) for details on the quality schemes used
*     by 6dFGS and 2dFGRS respectively).
*Note (6): 6dFGS template if number, Z for ZCAT redshift, T for 2dFGRS,
*     S for SDSS, or 0 if not available. 6dFGS template number (KBESTR)
*     is 1 or 2 for early-type galaxy, 3, 4 or 5 for late-type galaxies.
*Note (7): Name of redshift field file if sourced from 6dFGS; or the words
*     2dFGRS, ZCAT, or SDSS if the redshift is from those surveys; otherwise
*     "not_available" if the field information is not available, for
*     whatever reason.

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

C  Declarations for 'spectra.dat'	! Table of spectral observations

      integer*4 nr__1
      parameter (nr__1=136304)	! Number of records
      character*148 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     SpecID_1    ! Unique ID number used for spectrum image
      integer*4     Target_1    ! [1/500528] TARGETID number in 6dFGS database
      character*15  v6dFGS_1    ! Matching name in target table, used to name
*                                   FITS files and generate thumbnail images
      integer*4     RAh_1       ! (h) Observed right ascension (J2000)
      integer*4     RAm_1       ! (min) Observed right ascension (J2000)
      real*4        RAs_1       ! (s) [0/60] Observed right ascension (J2000)
      character*1   DE__1       ! Observed Declination sign (J2000)
      integer*4     DEd_1       ! (deg) Observed Declination (J2000)
      integer*4     DEm_1       ! (arcmin) Observed Declination (J2000)
      real*4        DEs_1       ! (arcsec) [0/60] Observed Declination (J2000)
      real*4        dr          ! (arcsec) ?=-9.99 Position match error (arcsec)
      real*8        zraw        ! ?=-9.999 Raw measured redshift
      real*8        z           ! ?=-9.999 Heliocentric redshift
      integer*4     q_z         ! [0/6] Redshift measurement quality:
*                                        4=good to 1=bad (6=star)
      real*4        Rcor        ! ?=-9.99 Cross-correlation peak
      integer*4     ExpV        ! (s) V reference frame exposure time seconds
      real*8        MJD_V       ! (d) ?=0 MJD of observation in V band
      integer*4     ExpR        ! (s) R reference frame exposure time seconds
      real*8        MJD_R       ! (d) ?=0 MJD of observation in R band
      character*29  Com         ! Comments on redshift

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

C  Loading file '6dfgs.dat'	! The 6dF Galaxy Survey Redshift Catalogue Data
*                            Release 3 (final release)

C  Format for file interpretation

    1 format(
     +  A15,2X,I2,1X,I2,1X,F5.2,2X,A1,I2,1X,I2,1X,F4.1,2X,I1,3X,I1,1X,
     +  F5.2,1X,I3,1X,F5.2,2X,I1,1X,I2,1X,I7,1X,I3,1X,I3,2X,I1,2X,
     +  F6.2,1X,F6.2,1X,F5.2,1X,I1,1X,I6,1X,A9,1X,A18,1X,A29)

C  Effective file loading

      open(unit=1,status='old',file=
     +'6dfgs.dat')
      write(6,*) '....Loading file: 6dfgs.dat'
      do i__=1,124647
        read(1,'(A178)')ar__
        read(ar__,1)
     +  v6dFGS,RAh,RAm,RAs,DE_,DEd,DEm,DEs,Nm,Nz,bJmag,PrID,rFmag,S_G,
     +  f_cz,cz,e_cz,r_cz,q_cz,GLON,GLAT,AV,w,Target,Template,
     +  FileName,SpecID
        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)
     +  v6dFGS,RAh,RAm,RAs,DE_,DEd,DEm,DEs,Nm,Nz,bJmag,PrID,rFmag,S_G,
     +  f_cz,cz,e_cz,r_cz,q_cz,GLON,GLAT,AV,w,Target,Template,
     +  FileName,SpecID
        write(6,'(6H Pos: 2F8.4)') RAdeg,DEdeg
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'spectra.dat'	! Table of spectral observations

C  Format for file interpretation

    2 format(
     +  I6,1X,I6,1X,A15,1X,I2,1X,I2,1X,F5.2,1X,A1,I2,1X,I2,1X,F4.1,1X,
     +  F6.3,2X,F8.5,1X,F8.5,1X,I1,1X,F6.2,2X,I4,1X,F8.2,2X,I4,1X,
     +  F8.2,1X,A29)

C  Effective file loading

      open(unit=1,status='old',file=
     +'spectra.dat')
      write(6,*) '....Loading file: spectra.dat'
      do i__=1,136304
        read(1,'(A148)')ar__1
        read(ar__1,2)
     +  SpecID_1,Target_1,v6dFGS_1,RAh_1,RAm_1,RAs_1,DE__1,DEd_1,
     +  DEm_1,DEs_1,dr,zraw,z,q_z,Rcor,ExpV,MJD_V,ExpR,MJD_R,Com
        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)
     +  SpecID_1,Target_1,v6dFGS_1,RAh_1,RAm_1,RAs_1,DE__1,DEd_1,
     +  DEm_1,DEs_1,dr,zraw,z,q_z,Rcor,ExpV,MJD_V,ExpR,MJD_R,Com
        write(6,'(6H Pos: 2F8.4)') RAdeg_1,DEdeg_1
c    .......End.of.Just test output...........
      end do
      close(1)

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