FORTRAN Generation
(/./ftp/cats/III/279)

Conversion of standardized ReadMe file for file /./ftp/cats/III/279 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-Mar-28
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. III/279                   RAVE 5th data release                  (Kunder+, 2017)
*================================================================================
*The Radial Velocity Experiment (RAVE): Fifth Data Release.
*     Kunder A., Kordopatis G., Steinmetz M., Zwitter T., McMillan P.,
*     Casagrande L., Enke H., Wojno J., Valentini M., Chiappini C.,
*     Matijevic G., Siviero A., de Laverny P., Recio-Blanco A., Bijaoui A.,
*     Wyse R.F.G., Binney J., Grebel E.K., Helmi A., Jofre P., Gilmore G.,
*     Siebert A., Famaey B., Bienayme O., Gibson B.K., Freeman K.C.,
*     Navarro J.F., Munari U., Seabroke G., Anguiano Jimenez B., Reid W.,
*     Bland-Hawthorn J., Watson F., Gerhard O., Davies G.R., Elsworth Y.P.,
*     Lund M., Miglio A., Chaplin W.J., Mosser B.
*    <Astron. J., 153, 75 (2017)>
*    =2017AJ....153...75K
*    =2017yCat.3279....0K
C=============================================================================

C  Internal variables

      integer*4 i__

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

C  Declarations for 'rave_dr5.dat'	! Main catalog

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

C  J2000.0 position composed of: RAdeg DEdeg (Epoch=J2000)
      character*21  Name        ! ! Target designation (RAVE_OBS_ID)
      integer*4     HEALPix     ! Hierarchical Equal-Area iso-Latitude
*                                      Pixelisation value (N_side=4096)
*                                      (HEALPix) (1)
      character*16  RAVE        ! ! RAVE designation(JHHMMSS.S+DDMMSS)
*                                      (RAVEID)
      real*8        RAdeg       ! (deg) Right ascension (J2000.0, Ep=J2000) (RAdeg)
      real*8        DEdeg       ! (deg) Declination (J2000.0, Ep=J2000) (DEdeg)
      real*8        GLON        ! (deg) Galactic longitude (Glon)
      real*8        GLAT        ! (deg) Galactic latitude (Glat)
      real*8        HRV         ! (km/s) Heliocentric radial velocity (HRV)
      real*8        e_HRV       ! (km/s) Error on HRV (eHRV)
      real*8        s_HRV       ! (km/s) ? Standard deviation in HRV from 10
*                                      resampled spectra (StdDev_HRV)
      real*8        S_HRV_1     ! (km/s) ? Median absolute deviation in HRV from 10
*                                      resampled spectra (MAD_HRV)
      real*8        SNRS        ! Signal/Noise Ratio of SPARV pipeline
*                                      (STN_SPARV) (2)
      integer*4     SNRK        ! ? Signal/Noise Ratio of Kordopatis
*                                      pipeline (SNR_K) (2)
      real*8        TeffK       ! (K) ? Effective temperature (Teff_K) (2)
      real*8        cTeffK      ! (K) ? Calibrated effective temperature
*                                      (Teff_N_K) (2)
      integer*4     e_TeffK     ! (K) ? Effective Temperature error (eTeff_K)
      real*8        S_TeffK     ! (K) ? Median absolute deviation in TeffK
*                                      from 10 resampled spectra (MAD_Teff_K)
      real*8        s_TeffK_1   ! (K) ? Standard deviation in Teff_K from 10
*                                      resampled spectra (StdDev_Teff_K)
      real*4        loggK       ! ([cm/s2]) ?  Log gravity (logg_K) (2)
      real*8        cloggK      ! ([cm/s2]) ? Calibrated log gravity (logg_N_K) (2)
      real*4        e_loggK     ! ([cm/s2]) ? Error Log gravity (elogg_K) (2)
      real*8        s_loggK     ! ([cm/s2]) ? Standard deviation in loggK from 10
*                                      resampled spectra (MAD_logg_K)
      real*8        S_loggK_1   ! ([cm/s2]) ? Median absolute deviation in loggK from
*                                      10 resampled spectra (StdDev_logg_K)
      real*4        v_M_H_K     ! ([-]) ? Metallicity [m/H] (Met_K) (2)
      real*8        v_M_H_NK    ! ([-]) ? Calibrated metallicity (Met_N_K) (2)
      real*4        e__M_H_K    ! ([-]) ? Error on metallicity (eMet_K) (2)
      real*8        s__M_H_K    ! ([-]) ? Standard deviation in [M/H]K from 10
*                                      resampled spectra (MAD_Met_K)
      real*8        S__M_H_K_1  ! ([-]) ? Median absolute deviation in [M/H]K
*                                      from 10 resampled spectra (StdDev_Met_K)
      real*8        CHISQK      ! ? Chi-square from the stellar parameter
*                                      pipeline (CHISQ_K) (2)
      integer*4     QK          ! [0/4]? Quality flag for stellar parameter
*                                      pipeline (Algo_Conv_K) (2) (3)
      integer*4     TeffIR      ! (K) Temperature from infrared flux method
*                                      (Teff_IR)
      integer*4     e_TeffIR    ! (K) ?=-9 Internal error on TeffIR (eTeff_IR)
      character*4   IRdirect    ! Infrared flux method flag (IR_direct) (4)
      real*4        v_Mg_H_c    ! ([-]) ? Abundance of Mg (Mg) (2)
      integer*4     o__Mg_H_c   ! [0/6]? Number of used spectral lines for
*                                      calculation (Mg_N) (2)
      real*4        v_Al_H_c    ! ([-]) ? Abundance of Al (Al) (2)
      integer*4     o__Al_H_c   ! ? Number of used spectral lines for
*                                      calculation (Al_N) (2)
      real*4        v_Si_H_c    ! ([-]) ? Abundance of Si (Si) (2)
      integer*4     o__Si_H_c   ! ? Number of used spectral lines for
*                                      calculation (Si_N) (2)
      real*4        v_Ti_H_c    ! ([-]) ? Abundance of Ti (Ti) (2)
      integer*4     o__Ti_H_c   ! ? Number of used spectral lines for
*                                      calculation (Ti_N) (2)
      real*4        v_Fe_H_c    ! ([-]) ? Abundance of Fe (Fe) (2)
      integer*4     o__Fe_H_c   ! ? Number of used spectral lines for
*                                      calculation (Fe_N) (2)
      real*4        v_Ni_H_c    ! ([-]) ? Abundance of Ni (Ni) (2)
      integer*4     o__Ni_H_c   ! ? Number of used spectral lines for
*                                      calculation (Ni_N) (2)
      real*4        v_a_Fe_c    ! ([-]) ? Alpha-enhancement from chemi
*                                      cal pipeline (Alpha_c) (2)
      real*8        CHISQc      ! ? Chi-square of chemi
*                                      cal pipeline (CHISQ_c) (2)
      real*4        fracc       ! ? Fraction of spectrum used for
*                                      calculation of abundances (frac_c) (2)
      real*8        AVSchl      ! (mag) ? Total extinction in V-band from Schlegel
*                                      et al. (1998ApJ...500..525S) (AV_Schlegel)
      real*8        Dist        ! (pc) ? Spectrophotometric distance
*                                      (distance) (10)
      real*8        e_Dist      ! (pc) ? Error on distance (edistance) (10)
      real*8        logAv       ! ? Log Av extinction (log_Av) (10)
      real*8        e_logAv     ! ? Error on LogAv (elog_Av) (10)
      real*8        plx         ! (mas) ? Spectrophotometric parallax
*                                      (parallax) (10)
      real*8        e_plx       ! (mas) ? Error on plx (eparallax) (10)
      real*8        DM          ! (mag) ? Distance modulus
*                                      (DistanceModulus_Binne) (10)
      real*8        e_DM        ! (mag) ? Error on DM (eDistanceModulus_Binne) (10)
      integer*4     FFB         ! ? Fit flag see sec.3 of Binney et al.
*                                      (2014MNRAS.437..351B) (Fit_Flag_Binney)
      real*4        FQB         ! ? Fit quality "F" given by Eq. 15 of Binney
*                                      et al. (2014MNRAS.437..351B)
*                                      (FitQuality_Binney)
      integer*4     NGauss      ! ? Number of components required for
*                                       multi-Gaussian distance modulus fit
*                                       (N_Gauss_fit)
      real*8        Gm1         ! ? Mean of 1st Gaussian (Gauss_mean_1)
      real*8        Gs1         ! ? Sigma of 1st Gaussian (Gauss_sigma_1)
      real*8        Gf1         ! ? Normalisation of 1st Gaussian
*                                      (Gauss_frac_1)
      real*8        Gm2         ! ? Mean of 2nd Gaussian (Gauss_mean_2)
      real*8        Gs2         ! ? Sigma of 2nd Gaussian (Gauss_sigma_2)
      real*8        Gf2         ! ? Normalisation of 2nd Gaussian
*                                      (Gauss_frac_2)
      real*8        Gm3         ! ? Mean of 3rd Gaussian (Gauss_mean_3)
      real*8        Gs3         ! ? Sigma of 3rd Gaussian (Gauss_sigma_3)
      real*8        Gf3         ! ? Normalisation of 3rd Gaussian
*                                      (Gauss_frac_3)
      character*1   c1          ! 1st minimum distance (c1) (5)
      character*1   c2          ! 2nd minimum distance (c2) (5)
      character*1   c3          ! 3rd minimum distance (c3) (5)
      character*1   c4          ! 4th minimum distance (c4) (5)
      character*1   c5          ! 5th minimum distance (c5) (5)
      character*1   c6          ! 6th minimum distance (c6) (5)
      character*1   c7          ! 7th minimum distance (c7) (5)
      character*1   c8          ! 8th minimum distance (c8) (5)
      character*1   c9          ! 9th minimum distance (c9) (5)
      character*1   c10         ! 10th minimum distance (c10) (5)
      character*1   c11         ! 11th minimum distance (c11) (5)
      character*1   c12         ! 12th minimum distance (c12) (5)
      character*1   c13         ! 13th minimum distance (c13) (5)
      character*1   c14         ! 14th minimum distance (c14) (5)
      character*1   c15         ! 15th minimum distance (c15) (5)
      character*1   c16         ! 16th minimum distance (c16) (5)
      character*1   c17         ! 17th minimum distance (c17) (5)
      character*1   c18         ! 18th minimum distance (c18) (5)
      character*1   c19         ! 19th minimum distance (c19) (5)
      character*1   c20         ! 20th minimum distance (c20) (5)
      integer*4     RepFlag     ! [1]? Repetition flag (Rep_Flag) (6)
      integer*4     ClSFlag     ! [1]? Cluster star flag (CluStar_Flag) (7)
      integer*4     FPFlag      ! [1]? Footprint flag FootPrint_Flag) (8)
      integer*8     TGAS        ! ? TGAS target designation (ID_TGAS_source)
      integer*4     XTGAS       ! ? Cross-match quality flag TGAS 
*                                      (empty field) (MatchFlag_TGAS) (9)
      real*8        RATGAS      ! (deg) ? TGAS right ascension (Ep=2015.0)
*                                      (RA_TGAS)
      real*8        DETGAS      ! (deg) ? TGAS declination (Ep=2015.0) (DE_TGAS)
      real*8        pmRATGAS    ! (mas/yr) ? Proper motion RA from TGAS (pmRA_TGAS)
      real*8        e_pmRATGAS  ! (mas/yr) ? Error on proper motion RA from TGAS
*                                      (pmRA_error_TGAS)
      real*8        pmDETGAS    ! (mas/yr) ? Proper motion DE from TGAS
*                                      (pmDE_TGAS)
      real*8        e_pmDETGAS  ! (mas/yr) ? Error on proper motion DE from TGAS
*                                      (pmDE_error_TGAS)
      real*8        plxTGAS     ! (mas) ? Parallax from TGAS (parallax_TGAS)
      real*8        e_plxTGAS   ! (mas) ? Error on parallax from TGAS
*                                      (parallax_error_TGAS)
      real*8        GmagTGAS    ! (mag) ? TGAS G magnitude (phot_g_mean_mag_TGAS)
      real*8        GfluxTGAS   ! (e-/s) ? TGAS flux in G band
*                                      (phot_g_mean_flux_TGAS)
      real*8        e_GfluxTGAS ! (e-/s) ? Error on G band flux from TGAS
*                                      (phot_g_mean_flux_error_TGAS)
      integer*4     Hipparcos   ! ? Hipparcos target designation
*                                      (ID_Hipparcos)
      character*12  TYCHO2      ! Tycho-2 target designation (ID_TYCHO2)
      real*8        distT2      ! (arcsec) ? Distance to Tycho-2 source (Dist_TYCHO2)
      character*4   XT2         ! Cross-match quality flag Tycho-2
*                                      (MatchFlag_TYCHO2) (9)
      real*4        BTmagT2     ! (mag) ? Tycho-2 BT magnitude (BTmag_TYCHO2)
      real*4        e_BTmagT2   ! (mag) ? Error on Tycho-2 BT magnitude
*                                      (eBTmag_TYCHO2)
      real*4        VTmagT2     ! (mag) ? Tycho-2 VT magnitude (VTmag_TYCHO2)
      real*4        e_VTmagT2   ! (mag) ? Error on Tycho-2 VT magnitude
*                                      (eVTmag_TYCHO2)
      real*8        pmRAT2      ! (mas/yr) ? Proper motion RA from Tycho-2
*                                      (pmRA_TYCHO2)
      real*4        e_pmRAT2    ! (mas/yr) ? Error on proper motion RA from Tycho-2
*                                      (epmRA_TYCHO2)
      real*8        pmDET2      ! (mas/yr) ? Proper motion De from Tycho-2
*                                      (pmDE_TYCHO2)
      real*4        e_pmDET2    ! (mas/yr) ? Error on proper motion DE from Tycho-2
*                                      (epmDE_TYCHO2)
      character*10  UCAC4       ! UCAC4 target designation (ID_UCAC4)
      real*8        distU4      ! (arcsec) ? Distance to UCAC4 source (Dist_UCAC4)
      character*4   XU4         ! Cross-match quality flag UCAC4
*                                      (MatchFlag_UCAC4) (9)
      real*8        pmRAU4      ! (mas/yr) ? Proper motion RA from UCAC4 (pmRA_UCAC4)
      real*4        e_pmRAU4    ! (mas/yr) ? Error on proper motion RA from UCAC4
*                                      (epmRA_UCAC4)
      real*8        pmDEU4      ! (mas/yr) ? Proper motion DE from UCAC4 (pmDE_UCAC4)
      real*4        e_pmDEU4    ! (mas/yr) ? Error on proper motion DE from UCAC4
*                                      (epmDE_UCAC4)
      integer*8     PPMXL       ! ? PPMXL target designation (ID_PPMXL)
      real*8        distP       ! (arcsec) ? Distance to PPMXL source (Dist_PPMXL)
      character*4   XP          ! Cross-match quality flag PPMXL
*                                      (MatchFlag_PPMXL) (9)
      real*8        pmRAP       ! (mas/yr) ? Proper motion RA from PPMXL (pmRA_PPMXL)
      real*4        e_pmRAP     ! (mas/yr) ? Error on proper motion RA from PPMXL
*                                      (epmRA_PPMXL)
      real*8        pmDEP       ! (mas/yr) ? Proper motion DE from PPMXL (pmDE_PPMXL)
      real*4        e_pmDEP     ! (mas/yr) ? Error on proper motion DE from PPMXL
*                                      (epmDE_PPMXL)
      character*17  v2MASS      ! 2MASS target designation (ID_2MASS)
      real*8        dist2       ! (arcsec) ? Distance to 2MASS source (Dist_2MASS)
      character*4   X2          ! Cross-match quality flag 2MASS
*                                      (MatchFlag_2MASS) (9)
      real*4        Jmag2       ! (mag) ? 2MASS J magnitude (Jmag_2MASS)
      real*4        e_Jmag2     ! (mag) ? Error on 2MASS J magnitude (eJmag_2MASS)
      real*4        Hmag2       ! (mag) ? 2MASS H magnitude (Hmag_2MASS)
      real*4        e_Hmag2     ! (mag) ? Error on 2MASS H magnitude (eHmag_2MASS)
      real*4        Kmag2       ! (mag) ? 2MASS K magnitude (Kmag_2MASS)
      real*4        e_Kmag2     ! (mag) ? Error on 2MASS K magnitude (eKmag_2MASS)
      character*19  ALLWISE     ! ALLWISE target designation (ID_ALLWISE)
      real*8        distW       ! (arcsec) ? Distance to ALLWISE source (Dist_ALLWISE)
      character*4   XW          ! Cross-match quality flag ALLWISE
*                                      (MatchFlag_ALLWISE) (9)
      real*4        W1magW      ! (mag) ? ALLWISE W1 magnitude (W1mag_ALLWISE)
      real*4        e_W1magW    ! (mag) ? Error on ALLWISE W1 magnitude
*                                      (eW1mag_ALLWISE)
      real*4        W2magW      ! (mag) ? ALLWISE W2 magnitude (W2mag_ALLWISE)
      real*4        e_W2magW    ! (mag) ? Error on ALLWISE W2 magnitude
*                                      (eW2mag_ALLWISE)
      real*4        W3magW      ! (mag) ? ALLWISE W3 magnitude (W3mag_ALLWISE)
      real*4        e_W3magW    ! (mag) ? Error on ALLWISE W3 magnitude
*                                      (eW3mag_ALLWISE)
      real*4        W4magW      ! (mag) ? ALLWISE W4 magnitude (W4mag_ALLWISE)
      real*4        e_W4magW    ! (mag) ? Error on ALLWISE W4 magnitude
*                                      (eW4mag_ALLWISE)
      character*4   ccflagsW    ! Prioritized artifacts affecting the source
*                                      in each band (cc_flags_ALLWISE)
      integer*4     extflgW     ! ? Probability source morphology is not
*                                      consistent with single PSF
*                                      (ext_flg_ALLWISE)
      character*4   varflgW     ! Probability that flux varied in any band
*                                      greater than amount expected
*                                      (var_flg_ALLWISE)
      character*4   phqualW     ! (mag) Photometric quality of each band
*                                      A=highest, U=upper limit (ph_qual_ALLWISE)
      real*8        distADR9    ! (arcsec) ? Distance to APASS DR9 source
*                                      (Dist_APASSDR9)
      character*4   XADR9       ! Cross-match quality flag APASSDR9
*                                      (MatchFlag_APASSDR9) (9)
      real*4        BmagADR9    ! (mag) ? APASS DR9 B magnitude (Bmag_APASSDR9)
      real*4        e_BmagADR9  ! (mag) ? Error APASS DR9 B magnitude
*                                      (eBmag_APASSDR9)
      real*4        VmagADR9    ! (mag) ? APASS DR9 V magnitude (Vmag_APASSDR9)
      real*4        e_VmagADR9  ! (mag) ? Error APASS DR9 V magnitude
*                                      (eVmag_APASSDR9)
      real*4        gpmagADR9   ! (mag) ? APASS DR9 g' magnitude (gpmag_APASSDR9)
      real*4        e_gpmagADR9 ! (mag) ? Error APASS DR9 g' magnitude
*                                      (egpmag_APASSDR9)
      real*4        rpmagADR9   ! (mag) ? APASS DR9 r' magnitude (rpmag_APASSDR9)
      real*4        e_rpmagADR9 ! (mag) ? Error APASS DR9 r' magnitude
*                                      (erpmag_APASSDR9)
      real*4        ipmagADR9   ! (mag) ? APASS DR9 i' magnitude (ipmag_APASSDR9)
      real*4        e_ipmagADR9 ! (mag) ? Error APASS DR9 i' magnitude
*                                      (eipmag_APASSDR9)
      character*16  DENIS       ! DENIS target designation (ID_DENIS)
      real*8        distD       ! (arcsec) ? Distance to DENIS source (Dist_DENIS)
      character*4   XD          ! Cross-match quality flag DENIS
*                                      (MatchFlag_DENIS) (9)
      real*4        ImagD       ! (mag) ? DENIS I magnitude (Imag_DENIS)
      real*4        e_ImagD     ! (mag) ? Error DENIS I magnitude (eImag_DENIS)
      real*4        JmagD       ! (mag) ? DENIS J magnitude (Jmag_DENIS)
      real*4        e_JmagD     ! (mag) ? Error DENIS J magnitude (eJmag_DENIS)
      real*4        KmagD       ! (mag) ? DENIS K magnitude (Kmag_DENIS)
      real*4        e_KmagD     ! (mag) ? Error DENIS K magnitude (eKmag_DENIS)
      character*13  USNOB1      ! USNO-B1 target designation (ID_USNOB1)
      real*8        distUB1     ! (arcsec) ? Distance to USNO-B1 source (Dist_USNOB1)
      character*4   XUB1        ! Cross-match quality flag USNO-B1
*                                      (MatchFlag_USNOB1) (9)
      real*4        B1magUB1    ! (mag) ? USNO-B1 B1 magnitude (B1mag_USNOB1)
      real*4        R1magUB1    ! (mag) ? USNO-B1 R1 magnitude (R1mag_USNOB1)
      real*4        B2magUB1    ! (mag) ? USNO-B1 B2 magnitude (B2mag_USNOB1)
      real*4        R2magUB1    ! (mag) ? USNO-B1 R2 magnitude (R2mag_USNOB1)
      real*4        ImagUB1     ! (mag) ? USNO-B1 I magnitude (Imag_USNOB1)
      integer*4     pmRAUB1     ! (mas/yr) ? Proper motion RA from USNO-B1
*                                      (pmRA_USNOB1)
      integer*4     e_pmRAUB1   ! (mas/yr) ? Error on proper motion RA from USNO-B1
      integer*4     pmDEUB1     ! (mas/yr) ? Proper motion DE from USNO-B1
*                                      (pmDE_USNOB1)
      integer*4     e_pmDEUB1   ! (mas/yr) ? Error on proper motion DE from USNO-B1
      integer*4     Obsdate     ! ("YYYYMMDD") ! Observation date (Obsdate)
      character*8   FieldName   ! ! Name of RAVE field (FieldName)
      integer*4     FiberNb     ! [1/150] Fiber number (FiberNumber)
      integer*4     PlateNb     ! [1/3] Plate number (PlateNumber)
      real*8        MJDOBS      ! (d) Modified Julian date of observation
*                                      (MJD_OBS)
      character*8   LSTstart    ! ("h:m:s") Exposure start in Local sideral time
*                                      (LST_start)
      character*8   LSTend      ! ("h:m:s") Exposure end in local sideral time
*                                      (LST_end)
      character*8   UTCstart    ! ("h:m:s") Exposure start in UTC (UTC_start)
      character*8   UTCend      ! ("h:m:s") Exposure end in UTC (UTC_end)
*Note (1): HEALPix values were computed using the resolution parameter Nside=4096
* (resolution index of 12) and the NESTED numbering scheme. Any lower-resolution
* index HEALPix value can be computed from the given one by dividing it by
* 4(12-n) where n < 12 is the desired resolution index.
*Note (2): Originating from:
*  X_K   = indicates values from Stellar Parameter Pipeline,
*  c_X_K = indicates a calibrated value,
*  X_c   = indicates values from Chemical Pipeline,
*  X_S   = indicates values of Radial Velocity Pipeline SPARV V5.x (used in DR3).
*Note (3): Flag of Stellar Parameter Pipeline
*  0 = Pipeline converged.
*  1 = no convergence.
*  2 = MATISSE oscillates between two values and the mean has been performed.
*  3 = results of MATISSE at the boundaries or outside the grid and the
*      DEGAS value has been adopted
*  4 = the metal-poor giants with SNR<20 have been re-run by degas with a scale
*     factor (ie, internal parameter of DEGAS) of 0.40
*Note (4): Cross-identification flag as follows:
*  IRFM = Temperature derived from infrared flux method
*  CTRL = Temperature computed via color-Teff relations
*  NO   = No temperature derivation possible
*Note (5): Morphological Flag n.th minimum distance to base spectrum given by one
*  of the types a,b,c,d,e,g,h,n,o,p,t,u,w (see Matijevic et al.,
*  2012ApJS..200...14M) as follows:
*  a = spectrum of a carbon star
*  b = spectrum of a binary star
*  c = spectrum with problems in continuum
*  d = spectrum of a cool dwarf
*  e = spectrum with (chromospheric) emission
*  g = spectrum of a cool giant
*  h = spectrum of a hot giant
*  n = spectrum of a normal star (cooler than ~7000K)
*  o = hot spectrum (hotter than ~7000K)
*  p = peculiar spectrum (anything but other classifications)
*  t = spectrum with TiO bands
*  u = unclassified spectrum
*  w = spectrum with problems in wavelength calibration
*  X = not applicable
*Note (6): repetition flag
*  0 = single observation
*  1 = more than one observation
*Note (7): Cluster star flag
*  0 = not a targeted cluster observation
*  1 = targeted cluster observation
*Note (8): footprint flag
*  0 = star in RAVE selection function footprint
*  1 = outside footprint
*Note (9): Cross-identification flag as follows:
*  A = 1 association within 2 arcsec
*  B = 2 associations within 2 arcsec
*  C = More than 2 associations within 2 arcsec
*  D = Nearest neighbour more than 2 arcsec away
*  X = No association found (within 10 arcsec limit )
*Note (10): From Binney et al., 2014MNRAS.437..351B.

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

C  Declarations for 'rave_gra.dat'	! Astroseismic gravities (RAVE_Gravity_SC.dat)

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

      character*21  Name_1      ! ! Target designation (RAVE_OBS_ID)
      real*4        loggSC      ! ([cm/s2]) ? Log gravity calibrated astroseismically
*                                   (logg_SC)
      real*4        e_loggSC    ! ([cm/s2]) ? Error on loggSC (elogg_SC)
      integer*4     Flag050     ! [0/1] Difference between loggSC and loggK
*                                   less than 0.5dex (1=true, 0=false) (Flag050)
      integer*4     Flag075     ! [0/1]? Difference between loggSC and loggK
*                                   less than 0.75dex (1=true, 0=false) (Flag075)
      integer*4     FlagM       ! [0/1]? Normal star, meaning c1-c20 are
*                                   all "n" (1=true, 0=false) (Flag_M)
      integer*4     TeffIR_1    ! (K) ? Temperature from infrared flux (Teff_IR)
      real*4        v_Mg_H_     ! ([-]) ? Abundance of Mg (Mg) (2)
      integer*4     o__Mg_H_    ! ? Number of used spectral lines for
*                                   calculation (Mg_N)
      real*4        v_Al_H_     ! ([-]) ? Abundance of Al (Al) (2)
      integer*4     o__Al_H_    ! ? Number of used spectral lines for
*                                   calculation (Al_N)
      real*4        v_Si_H_     ! ([-]) ? Abundance of Si (Si) (2)
      integer*4     o__Si_H_    ! ? Number of used spectral lines for
*                                   calculation (Si_N)
      real*4        v_Ti_H_     ! ([-]) ? Abundance of Ti (Ti) (2)
      integer*4     o__Ti_H_    ! ? Number of used spectral lines for
*                                   calculation (Ti_N)
      real*4        v_Fe_H_     ! ([-]) ? Abundance of Fe (Fe) (2)
      integer*4     o__Fe_H_    ! ? Number of used spectral lines for
*                                   calculation (Fe_N)
      real*4        v_Ni_H_     ! ([-]) ? Abundance of Ni (Ni) (2)
      integer*4     o__Ni_H_    ! ? Number of used spectral lines for
*                                   calculation (Ni_N)
      real*4        v_a_Fe_c_1  ! ([-]) ? Alpha-enhancement from chemical pipeline
*                                   (Alpha_c)
      real*8        CHISQc_1    ! ? Chi-square of chemical pipeline
*                                   (CHISQ_c) (2)
      real*4        fracc_1     ! ? Fraction of spectrum used for calculation
*                                   of abundances (frac_c)
      real*8        AVSchl_1    ! (mag) ? Total extinction in V-band from Schlegel et
*                                   al. (1998ApJ...500..525S) (AV_Schlegel)
      real*8        Dist_1      ! (kpc) ? Spectrophotometric distance (distance) (1)
      real*8        e_Dist_1    ! (kpc) ? Error on distance (edistance) (1)
      real*8        logAv_1     ! ? Log Av extinction (log_Av) (1)
      real*8        e_logAv_1   ! ? Error on LogAv (elog_Av) (1)
      real*8        plx_1       ! (mas) ? Spectrophotometric parallax (parallax) (1)
      real*8        e_plx_1     ! (mas) ? Error on plx (eparallax) (1)
      real*8        DM_1        ! ? Distance modulus
*                                   (DistanceModulus_Binney) (1)
      real*8        e_DM_1      ! ? Error on DM (eDistanceModulus_Binney) (1)
      integer*4     FFB_1       ! ? Fit flag see sec.3 of Binney et al.
*                                   (2014MNRAS.437..351B) (Fit_Flag_Binney)
      integer*4     FQB_1       ! ? Fit quality "F" given by Eq. 15 of
*                                   Binney et al. (2014MNRAS.437..351B)
*                                   (FitQuality_Binney)
      integer*4     NGauss_1    ! ? Number of components required for
*                                   multi-Gaussian distance modulus fit
*                                   (N_Gauss_fit)
      real*8        Gm1_1       ! ? Mean of 1st Gaussian (Gauss_mean_1)
      real*8        Gs1_1       ! ? Sigma of 1st Gaussian (Gauss_sigma_1)
      real*8        Gf1_1       ! ? Normalisation of 1st Gaussian (Gauss_frac_1)
      real*8        Gm2_1       ! ? Mean of 2nd Gaussian (Gauss_mean_2)
      real*8        Gs2_1       ! ? Sigma of 2nd Gaussian (Gauss_sigma_2)
      real*8        Gf2_1       ! ? Normalisation of 2nd Gaussian (Gauss_frac_2)
      real*8        Gm3_1       ! ? Mean of 3rd Gaussian (Gauss_mean_3)
      real*8        Gs3_1       ! ? Sigma of 3rd Gaussian (Gauss_sigma_3)
      real*8        Gf3_1       ! ? Normalisation of 3rd Gaussian (Gauss_frac_3)
*Note (1): From Binney et al., 2014MNRAS.437..351B.
*Note (2): Values from Chemical Pipeline.

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

C  Declarations for 'rave_on.dat'	! Stellar parameters from Cannon

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

C  J2000.0 position composed of: RAdeg DEdeg (Epoch=J2000)
      character*21  Name_2      ! ! Target designation (RAVE_OBS_ID)
      character*16  RAVE_1      ! ! RAVE designation(JHHMMSS.S+DDMMSS) (RAVEID)
      real*8        RAdeg_1     ! (deg) Right ascension (J2000.0, Ep=J2000) (RAdeg)
      real*8        DEdeg_1     ! (deg) Declination (J2000.0, Ep=J2000) (DEdeg)
      real*8        HRV_1       ! (km/s) Heliocentric radial velocity (HRV)
      real*8        e_HRV_1     ! (km/s) Error on HRV (eHRV)
      real*8        s_HRV_2     ! (km/s) ?=- Standard deviation in HRV from 10
*                                   resampled spectra (StdDev_HRV)
      real*8        S_HRV_3     ! (km/s) ?=- Median absolute deviation in HRV from 10
*                                   resampled spectra (MAD_HRV)
      real*4        R           ! Tonry-Davis R correlation coefficient
*                                   (CorrelationCoeff)
      real*4        hcp         ! Height of correlation peak (PeakHeight)
      real*8        wcp         ! (km/s) Width of correlation peak (PeakWidth)
      real*8        cRV         ! (km/s) Zero point correction applied HRV
*                                   (CorrectionRV)
      real*8        HRVsky      ! (km/s) Measured HRV of sky (SkyRV)
      real*8        e_HRVsky    ! (km/s) Error HRV of sky (eSkyRV)
      real*4        Rsky        ! Correlation Coefficient R of sky
*                                   (SkyCorrelationCoeff)
      integer*4     VrotS       ! (km/s) ?=- Rotational Velocity from SPARV pipeline
*                                   (Vrot_SPARV)
      character*4   ZPFLAG      ! Quality Flag for ZeroPoint correction
*                                   (ZeroPointFLAG) (1)
      character*1   c1_1        ! 1st minimum distance (c1) (2)
      character*1   c2_1        ! 2nd minimum distance (c2) (2)
      character*1   c3_1        ! 3rd minimum distance (c3) (2)
      character*1   c4_1        ! 4th minimum distance (c4) (2)
      character*1   c5_1        ! 5th minimum distance (c5) (2)
      character*1   c6_1        ! 6th minimum distance (c6) (2)
      character*1   c7_1        ! 7th minimum distance (c7) (2)
      character*1   c8_1        ! 8th minimum distance (c8) (2)
      character*1   c9_1        ! 9th minimum distance (c9) (2)
      character*1   c10_1       ! 10th minimum distance (c10) (2)
      character*1   c11_1       ! 11th minimum distance (c11) (2)
      character*1   c12_1       ! 12th minimum distance (c12) (2)
      character*1   c13_1       ! 13th minimum distance (c13) (2)
      character*1   c14_1       ! 14th minimum distance (c14) (2)
      character*1   c15_1       ! 15th minimum distance (c15) (2)
      character*1   c16_1       ! 16th minimum distance (c16) (2)
      character*1   c17_1       ! 17th minimum distance (c17) (2)
      character*1   c18_1       ! 18th minimum distance (c18) (2)
      character*1   c19_1       ! 19th minimum distance (c19) (2)
      character*1   c20_1       ! 20th minimum distance (c20) (2)
      real*8        Teff        ! (K) ?=- Effective temperature (TEFF) (3)
      real*8        logg        ! ([cm/s2]) ?=- Log gravity (LOGG) (3)
      real*8        v_Fe_H__1   ! ([-]) ?=- Abundance of Fe (FE_H) (3)
      real*8        v_O_H_      ! ([-]) ?=- Abundance of O (O_H) (3)
      real*8        v_Mg_H__1   ! ([-]) ?=- Abundance of Mg (MG_H) (3)
      real*8        v_Al_H__1   ! ([-]) ?=- Abundance of Al (AL_H) (3)
      real*8        v_Si_H__1   ! ([-]) ?=- Abundance of Si (SI_H) (3)
      real*8        v_Ca_H_     ! ([-]) ?=- Abundance of Ca (CA_H) (3)
      real*8        v_Ni_H__1   ! ([-]) ?=- Abundance of Ni (NI_H) (3)
      real*8        e_Teff      ! (K) ?=- Error on effective temperature
*                                   (e_TEFF) (3)
      real*8        e_logg      ! ([cm/s2]) ?=- Error on log gravity (E_LOGG) (3)
      real*8        e__Fe_H_    ! ([-]) ?=- Error on [Fe/H] (E_FE_H) (3)
      real*8        e__O_H_     ! ([-]) ?=- Error on [O/H] (E_O_H) (3)
      real*8        e__Mg_H_    ! ([-]) ?=- Error on [Mg/H] (E_MG_H) (3)
      real*8        e__Al_H_    ! ([-]) ?=- Error on [Al/H] (E_AL_H) (3)
      real*8        e__Si_H_    ! ([-]) ?=- Error on [Si/H] (E_SI_H) (3)
      real*8        e__Ca_H_    ! ([-]) ?=- Error on [Ca/H] (E_CA_H) (3)
      real*8        e__Ni_H_    ! ([-]) ?=- Error on [Ni/H] (E_NI_H) (3)
      real*8        SNR         ! ? Signal to noise ratio (SNR) (3)
      real*8        RCHISQ      ! ? Chi-square (R_CHI_SQ) (3)
      integer*4     QC          ! Quality flag (QC) (3)
*Note (1): Flag value of the form FGSH as follows:
*  F : for the entire plate
*  G : for the 50 fibres group to which the fibre belongs
*  S : flag the zero-point correction used:
*          C for cubic, S for a constant shift
*  H : if H is set to * the fibre is close to a 15 fibre gap.
*
*  For F and G the values can be A, B, C, D, or E
*   A = dispersion around correction lower than 1km/s
*   B = dispersion between 1 and 2km/s
*   C = dispersion between 2 and 3km/s
*   D = dispersion larger than 3km/s
*   E = less than 15 fibres available for the fit
*   M = Manual
*Note (2): Morphological Flag n.th minimum distance to base spectrum given by one
*  of the types a,b,c,d,e,g,h,n,o,p,t,u,w (see Matijevic et al.,
*  2012ApJS..200...14M) as follows:
*  a = spectrum of a carbon star
*  b = spectrum of a binary star
*  c = spectrum with problems in continuum
*  d = spectrum of a cool dwarf
*  e = spectrum with (chromospheric) emission
*  g = spectrum of a cool giant
*  h = spectrum of a hot giant
*  n = spectrum of a normal star (cooler than ~7000K)
*  o = hot spectrum (hotter than ~7000K)
*  p = peculiar spectrum (anything but other classifications)
*  t = spectrum with TiO bands
*  u = unclassified spectrum
*  w = spectrum with problems in wavelength calibration
*Note (3): From Casey et al. (2016, arXiv:1609.02914)

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

C  Declarations for 'rave_com.dat'	! RAVE completeness (RAVE_completeness_PBP.dat)

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

      integer*4     HEALPix32   ! Hierarchical Equal-Area iso-Latitude
*                                   Pixelisation value (N_side = 4096) (1)
      integer*4     CF00_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_2      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_3      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_4      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_5      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_6      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_7      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_8      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF00_9      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_2      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_3      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_4      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_5      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_6      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_7      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_8      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF01_9      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_2      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_3      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_4      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_5      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_6      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_7      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_8      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF02_9      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_2      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_3      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_4      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_5      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_6      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_7      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_8      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF03_9      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_2      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_3      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_4      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_5      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_6      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_7      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_8      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF04_9      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_2      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*4        CF05_4      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_5      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_6      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_7      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_8      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF05_9      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF06_0      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF06_1      ! Completness fraction (N_RAVE / N_2MASS)
      integer*4     CF06_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF06_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF06_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*4        CF06_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*4        CF06_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF06_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF06_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*4        CF06_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF07_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF08_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF09_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF10_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF11_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF12_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_0      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_1      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_2      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_3      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_4      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_5      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_6      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_7      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_8      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF13_9      ! Completness fraction (N_RAVE / N_2MASS)
      real*8        CF14_0      ! Completness fraction (N_RAVE / N_2MASS)
*Note (1): HEALPix values were computed using the resolution parameter Nside=4096
* (resolution index of 12) and the NESTED numbering scheme. Any lower-resolution
* index HEALPix value can be computed from the given one by dividing it by
* 4(12-n) where n<12 is the desired resolution index.

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

C  Loading file 'rave_dr5.dat'	! Main catalog

C  Format for file interpretation

    1 format(
     +  A21,1X,I9,1X,A16,1X,F21.17,1X,F23.19,1X,F9.5,1X,F9.5,1X,F9.3,
     +  1X,F8.3,1X,F34.29,1X,F33.28,1X,F21.17,1X,I4,1X,F7.2,1X,F7.2,
     +  1X,I4,1X,F25.20,1X,F24.19,1X,F4.2,1X,F8.6,1X,F4.2,1X,F22.20,
     +  1X,F21.19,1X,F5.2,1X,F14.11,1X,F4.2,1X,F22.20,1X,F21.19,1X,
     +  F14.5,4X,I1,1X,I4,1X,I3,1X,A4,1X,F5.2,1X,I4,1X,F5.2,1X,I4,1X,
     +  F5.2,1X,I4,1X,F5.2,1X,I4,1X,F5.2,1X,I4,1X,F5.2,1X,I4,1X,F5.2,
     +  1X,F9.1,1X,F4.2,1X,F12.8,1X,F11.5,1X,F11.6,1X,F14.11,1X,
     +  F15.13,1X,F12.7,1X,F13.9,1X,F10.7,1X,F10.8,1X,I4,1X,E22.18,1X,
     +  I4,1X,F10.7,1X,F10.8,1X,F8.6,1X,F10.7,1X,F9.7,1X,F11.9,1X,
     +  F10.7,1X,F9.7,1X,F11.9,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,
     +  A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,
     +  A1,1X,A1,1X,A1,1X,A1,4X,I1,4X,I1,4X,I1,1X,I19,4X,I1,1X,F22.18,
     +  1X,F24.20,1X,F26.20,1X,F21.18,1X,F25.20,1X,F21.18,1X,F24.20,
     +  1X,F19.17,1X,F19.16,1X,F21.11,1X,F22.15,1X,I4,1X,A12,1X,F10.8,
     +  1X,A4,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F7.1,1X,F4.1,1X,F7.1,
     +  1X,F4.1,1X,A10,1X,F8.6,1X,A4,1X,F7.1,1X,F4.1,1X,F7.1,1X,F4.1,
     +  1X,I19,1X,F8.6,1X,A4,1X,F7.1,1X,F4.1,1X,F7.1,1X,F4.1,1X,A17,
     +  1X,F8.6,1X,A4,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,1X,F6.3,1X,F5.3,
     +  1X,A19,1X,F8.6,1X,A4,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,A4,1X,I4,1X,A4,1X,A4,1X,F8.6,1X,A4,
     +  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,A16,1X,F8.6,1X,A4,1X,F5.2,1X,F4.2,1X,
     +  F5.2,1X,F4.2,1X,F5.2,1X,F4.2,1X,A13,1X,F8.6,1X,A4,1X,F5.2,1X,
     +  F5.2,1X,F5.2,1X,F5.2,1X,F5.2,1X,I5,1X,I4,1X,I5,1X,I4,1X,I8,1X,
     +  A8,1X,I3,1X,I1,1X,F14.8,1X,A8,1X,A8,1X,A8,1X,A8)

C  Effective file loading

      open(unit=1,status='old',file=
     +'rave_dr5.dat')
      write(6,*) '....Loading file: rave_dr5.dat'
      do i__=1,520701
        read(1,'(A1811)')ar__
        read(ar__,1)
     +  Name,HEALPix,RAVE,RAdeg,DEdeg,GLON,GLAT,HRV,e_HRV,s_HRV,
     +  S_HRV_1,SNRS,SNRK,TeffK,cTeffK,e_TeffK,S_TeffK,s_TeffK_1,
     +  loggK,cloggK,e_loggK,s_loggK,S_loggK_1,v_M_H_K,v_M_H_NK,
     +  e__M_H_K,s__M_H_K,S__M_H_K_1,CHISQK,QK,TeffIR,e_TeffIR,
     +  IRdirect,v_Mg_H_c,o__Mg_H_c,v_Al_H_c,o__Al_H_c,v_Si_H_c,
     +  o__Si_H_c,v_Ti_H_c,o__Ti_H_c,v_Fe_H_c,o__Fe_H_c,v_Ni_H_c,
     +  o__Ni_H_c,v_a_Fe_c,CHISQc,fracc,AVSchl,Dist,e_Dist,logAv,
     +  e_logAv,plx,e_plx,DM,e_DM,FFB,FQB,NGauss,Gm1,Gs1,Gf1,Gm2,Gs2,
     +  Gf2,Gm3,Gs3,Gf3,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,
     +  c14,c15,c16,c17,c18,c19,c20,RepFlag,ClSFlag,FPFlag,TGAS,XTGAS,
     +  RATGAS,DETGAS,pmRATGAS,e_pmRATGAS,pmDETGAS,e_pmDETGAS,plxTGAS,
     +  e_plxTGAS,GmagTGAS,GfluxTGAS,e_GfluxTGAS,Hipparcos,TYCHO2,
     +  distT2,XT2,BTmagT2,e_BTmagT2,VTmagT2,e_VTmagT2,pmRAT2,
     +  e_pmRAT2,pmDET2,e_pmDET2,UCAC4,distU4,XU4,pmRAU4,e_pmRAU4,
     +  pmDEU4,e_pmDEU4,PPMXL,distP,XP,pmRAP,e_pmRAP,pmDEP,e_pmDEP,
     +  v2MASS,dist2,X2,Jmag2,e_Jmag2,Hmag2,e_Hmag2,Kmag2,e_Kmag2,
     +  ALLWISE,distW,XW,W1magW,e_W1magW,W2magW,e_W2magW,W3magW,
     +  e_W3magW,W4magW,e_W4magW,ccflagsW,extflgW,varflgW,phqualW,
     +  distADR9,XADR9,BmagADR9,e_BmagADR9,VmagADR9,e_VmagADR9,
     +  gpmagADR9,e_gpmagADR9,rpmagADR9,e_rpmagADR9,ipmagADR9,
     +  e_ipmagADR9,DENIS,distD,XD,ImagD,e_ImagD,JmagD,e_JmagD,KmagD,
     +  e_KmagD,USNOB1,distUB1,XUB1,B1magUB1,R1magUB1,B2magUB1,
     +  R2magUB1,ImagUB1,pmRAUB1,e_pmRAUB1,pmDEUB1,e_pmDEUB1,Obsdate,
     +  FieldName,FiberNb,PlateNb,MJDOBS,LSTstart,LSTend,UTCstart,
     +  UTCend
        if(ar__(135:168) .EQ. '') s_HRV = rNULL__
        if(ar__(170:202) .EQ. '') S_HRV_1 = rNULL__
        if(ar__(226:229) .EQ. '') SNRK = iNULL__
        if(ar__(231:237) .EQ. '') TeffK = rNULL__
        if(ar__(239:245) .EQ. '') cTeffK = rNULL__
        if(ar__(247:250) .EQ. '') e_TeffK = iNULL__
        if(ar__(252:276) .EQ. '') S_TeffK = rNULL__
        if(ar__(278:301) .EQ. '') s_TeffK_1 = rNULL__
        if(ar__(303:306) .EQ. '') loggK = rNULL__
        if(ar__(308:315) .EQ. '') cloggK = rNULL__
        if(ar__(317:320) .EQ. '') e_loggK = rNULL__
        if(ar__(322:343) .EQ. '') s_loggK = rNULL__
        if(ar__(345:365) .EQ. '') S_loggK_1 = rNULL__
        if(ar__(367:371) .EQ. '') v_M_H_K = rNULL__
        if(ar__(373:386) .EQ. '') v_M_H_NK = rNULL__
        if(ar__(388:391) .EQ. '') e__M_H_K = rNULL__
        if(ar__(393:414) .EQ. '') s__M_H_K = rNULL__
        if(ar__(416:436) .EQ. '') S__M_H_K_1 = rNULL__
        if(ar__(438:451) .EQ. '') CHISQK = rNULL__
        if(ar__(456:456) .EQ. '') QK = iNULL__
        if(ar__(472:476) .EQ. '') v_Mg_H_c = rNULL__
        if(ar__(478:481) .EQ. '') o__Mg_H_c = iNULL__
        if(ar__(483:487) .EQ. '') v_Al_H_c = rNULL__
        if(ar__(489:492) .EQ. '') o__Al_H_c = iNULL__
        if(ar__(494:498) .EQ. '') v_Si_H_c = rNULL__
        if(ar__(500:503) .EQ. '') o__Si_H_c = iNULL__
        if(ar__(505:509) .EQ. '') v_Ti_H_c = rNULL__
        if(ar__(511:514) .EQ. '') o__Ti_H_c = iNULL__
        if(ar__(516:520) .EQ. '') v_Fe_H_c = rNULL__
        if(ar__(522:525) .EQ. '') o__Fe_H_c = iNULL__
        if(ar__(527:531) .EQ. '') v_Ni_H_c = rNULL__
        if(ar__(533:536) .EQ. '') o__Ni_H_c = iNULL__
        if(ar__(538:542) .EQ. '') v_a_Fe_c = rNULL__
        if(ar__(544:552) .EQ. '') CHISQc = rNULL__
        if(ar__(554:557) .EQ. '') fracc = rNULL__
        if(ar__(559:570) .EQ. '') AVSchl = rNULL__
        if(ar__(572:582) .EQ. '') Dist = rNULL__
        if(ar__(584:594) .EQ. '') e_Dist = rNULL__
        if(ar__(596:609) .EQ. '') logAv = rNULL__
        if(ar__(611:625) .EQ. '') e_logAv = rNULL__
        if(ar__(627:638) .EQ. '') plx = rNULL__
        if(ar__(640:652) .EQ. '') e_plx = rNULL__
        if(ar__(654:663) .EQ. '') DM = rNULL__
        if(ar__(665:674) .EQ. '') e_DM = rNULL__
        if(ar__(676:679) .EQ. '') FFB = iNULL__
        if(ar__(681:702) .EQ. '') FQB = rNULL__
        if(ar__(704:707) .EQ. '') NGauss = iNULL__
        if(ar__(709:718) .EQ. '') Gm1 = rNULL__
        if(ar__(720:729) .EQ. '') Gs1 = rNULL__
        if(ar__(731:738) .EQ. '') Gf1 = rNULL__
        if(ar__(740:749) .EQ. '') Gm2 = rNULL__
        if(ar__(751:759) .EQ. '') Gs2 = rNULL__
        if(ar__(761:771) .EQ. '') Gf2 = rNULL__
        if(ar__(773:782) .EQ. '') Gm3 = rNULL__
        if(ar__(784:792) .EQ. '') Gs3 = rNULL__
        if(ar__(794:804) .EQ. '') Gf3 = rNULL__
        if(ar__(849:849) .EQ. '') RepFlag = iNULL__
        if(ar__(854:854) .EQ. '') ClSFlag = iNULL__
        if(ar__(859:859) .EQ. '') FPFlag = iNULL__
        if(ar__(861:879) .EQ. '') TGAS = iNULL__
        if(ar__(884:884) .EQ. '') XTGAS = iNULL__
        if(ar__(886:907) .EQ. '') RATGAS = rNULL__
        if(ar__(909:932) .EQ. '') DETGAS = rNULL__
        if(ar__(934:959) .EQ. '') pmRATGAS = rNULL__
        if(ar__(961:981) .EQ. '') e_pmRATGAS = rNULL__
        if(ar__(983:1007) .EQ. '') pmDETGAS = rNULL__
        if(ar__(1009:1029) .EQ. '') e_pmDETGAS = rNULL__
        if(ar__(1031:1054) .EQ. '') plxTGAS = rNULL__
        if(ar__(1056:1074) .EQ. '') e_plxTGAS = rNULL__
        if(ar__(1076:1094) .EQ. '') GmagTGAS = rNULL__
        if(ar__(1096:1116) .EQ. '') GfluxTGAS = rNULL__
        if(ar__(1118:1139) .EQ. '') e_GfluxTGAS = rNULL__
        if(ar__(1141:1144) .EQ. '') Hipparcos = iNULL__
        if(ar__(1159:1168) .EQ. '') distT2 = rNULL__
        if(ar__(1175:1180) .EQ. '') BTmagT2 = rNULL__
        if(ar__(1182:1186) .EQ. '') e_BTmagT2 = rNULL__
        if(ar__(1188:1193) .EQ. '') VTmagT2 = rNULL__
        if(ar__(1195:1199) .EQ. '') e_VTmagT2 = rNULL__
        if(ar__(1201:1207) .EQ. '') pmRAT2 = rNULL__
        if(ar__(1209:1212) .EQ. '') e_pmRAT2 = rNULL__
        if(ar__(1214:1220) .EQ. '') pmDET2 = rNULL__
        if(ar__(1222:1225) .EQ. '') e_pmDET2 = rNULL__
        if(ar__(1238:1245) .EQ. '') distU4 = rNULL__
        if(ar__(1252:1258) .EQ. '') pmRAU4 = rNULL__
        if(ar__(1260:1263) .EQ. '') e_pmRAU4 = rNULL__
        if(ar__(1265:1271) .EQ. '') pmDEU4 = rNULL__
        if(ar__(1273:1276) .EQ. '') e_pmDEU4 = rNULL__
        if(ar__(1278:1296) .EQ. '') PPMXL = iNULL__
        if(ar__(1298:1305) .EQ. '') distP = rNULL__
        if(ar__(1312:1318) .EQ. '') pmRAP = rNULL__
        if(ar__(1320:1323) .EQ. '') e_pmRAP = rNULL__
        if(ar__(1325:1331) .EQ. '') pmDEP = rNULL__
        if(ar__(1333:1336) .EQ. '') e_pmDEP = rNULL__
        if(ar__(1356:1363) .EQ. '') dist2 = rNULL__
        if(ar__(1370:1375) .EQ. '') Jmag2 = rNULL__
        if(ar__(1377:1381) .EQ. '') e_Jmag2 = rNULL__
        if(ar__(1383:1388) .EQ. '') Hmag2 = rNULL__
        if(ar__(1390:1394) .EQ. '') e_Hmag2 = rNULL__
        if(ar__(1396:1401) .EQ. '') Kmag2 = rNULL__
        if(ar__(1403:1407) .EQ. '') e_Kmag2 = rNULL__
        if(ar__(1429:1436) .EQ. '') distW = rNULL__
        if(ar__(1443:1448) .EQ. '') W1magW = rNULL__
        if(ar__(1450:1454) .EQ. '') e_W1magW = rNULL__
        if(ar__(1456:1461) .EQ. '') W2magW = rNULL__
        if(ar__(1463:1467) .EQ. '') e_W2magW = rNULL__
        if(ar__(1469:1474) .EQ. '') W3magW = rNULL__
        if(ar__(1476:1480) .EQ. '') e_W3magW = rNULL__
        if(ar__(1482:1487) .EQ. '') W4magW = rNULL__
        if(ar__(1489:1493) .EQ. '') e_W4magW = rNULL__
        if(ar__(1500:1503) .EQ. '') extflgW = iNULL__
        if(ar__(1515:1522) .EQ. '') distADR9 = rNULL__
        if(ar__(1529:1534) .EQ. '') BmagADR9 = rNULL__
        if(ar__(1536:1540) .EQ. '') e_BmagADR9 = rNULL__
        if(ar__(1542:1547) .EQ. '') VmagADR9 = rNULL__
        if(ar__(1549:1553) .EQ. '') e_VmagADR9 = rNULL__
        if(ar__(1555:1560) .EQ. '') gpmagADR9 = rNULL__
        if(ar__(1562:1566) .EQ. '') e_gpmagADR9 = rNULL__
        if(ar__(1568:1573) .EQ. '') rpmagADR9 = rNULL__
        if(ar__(1575:1579) .EQ. '') e_rpmagADR9 = rNULL__
        if(ar__(1581:1586) .EQ. '') ipmagADR9 = rNULL__
        if(ar__(1588:1592) .EQ. '') e_ipmagADR9 = rNULL__
        if(ar__(1611:1618) .EQ. '') distD = rNULL__
        if(ar__(1625:1629) .EQ. '') ImagD = rNULL__
        if(ar__(1631:1634) .EQ. '') e_ImagD = rNULL__
        if(ar__(1636:1640) .EQ. '') JmagD = rNULL__
        if(ar__(1642:1645) .EQ. '') e_JmagD = rNULL__
        if(ar__(1647:1651) .EQ. '') KmagD = rNULL__
        if(ar__(1653:1656) .EQ. '') e_KmagD = rNULL__
        if(ar__(1672:1679) .EQ. '') distUB1 = rNULL__
        if(ar__(1686:1690) .EQ. '') B1magUB1 = rNULL__
        if(ar__(1692:1696) .EQ. '') R1magUB1 = rNULL__
        if(ar__(1698:1702) .EQ. '') B2magUB1 = rNULL__
        if(ar__(1704:1708) .EQ. '') R2magUB1 = rNULL__
        if(ar__(1710:1714) .EQ. '') ImagUB1 = rNULL__
        if(ar__(1716:1720) .EQ. '') pmRAUB1 = iNULL__
        if(ar__(1722:1725) .EQ. '') e_pmRAUB1 = iNULL__
        if(ar__(1727:1731) .EQ. '') pmDEUB1 = iNULL__
        if(ar__(1733:1736) .EQ. '') e_pmDEUB1 = iNULL__
c    ..............Just test output...........
        write(6,1)
     +  Name,HEALPix,RAVE,RAdeg,DEdeg,GLON,GLAT,HRV,e_HRV,s_HRV,
     +  S_HRV_1,SNRS,SNRK,TeffK,cTeffK,e_TeffK,S_TeffK,s_TeffK_1,
     +  loggK,cloggK,e_loggK,s_loggK,S_loggK_1,v_M_H_K,v_M_H_NK,
     +  e__M_H_K,s__M_H_K,S__M_H_K_1,CHISQK,QK,TeffIR,e_TeffIR,
     +  IRdirect,v_Mg_H_c,o__Mg_H_c,v_Al_H_c,o__Al_H_c,v_Si_H_c,
     +  o__Si_H_c,v_Ti_H_c,o__Ti_H_c,v_Fe_H_c,o__Fe_H_c,v_Ni_H_c,
     +  o__Ni_H_c,v_a_Fe_c,CHISQc,fracc,AVSchl,Dist,e_Dist,logAv,
     +  e_logAv,plx,e_plx,DM,e_DM,FFB,FQB,NGauss,Gm1,Gs1,Gf1,Gm2,Gs2,
     +  Gf2,Gm3,Gs3,Gf3,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,
     +  c14,c15,c16,c17,c18,c19,c20,RepFlag,ClSFlag,FPFlag,TGAS,XTGAS,
     +  RATGAS,DETGAS,pmRATGAS,e_pmRATGAS,pmDETGAS,e_pmDETGAS,plxTGAS,
     +  e_plxTGAS,GmagTGAS,GfluxTGAS,e_GfluxTGAS,Hipparcos,TYCHO2,
     +  distT2,XT2,BTmagT2,e_BTmagT2,VTmagT2,e_VTmagT2,pmRAT2,
     +  e_pmRAT2,pmDET2,e_pmDET2,UCAC4,distU4,XU4,pmRAU4,e_pmRAU4,
     +  pmDEU4,e_pmDEU4,PPMXL,distP,XP,pmRAP,e_pmRAP,pmDEP,e_pmDEP,
     +  v2MASS,dist2,X2,Jmag2,e_Jmag2,Hmag2,e_Hmag2,Kmag2,e_Kmag2,
     +  ALLWISE,distW,XW,W1magW,e_W1magW,W2magW,e_W2magW,W3magW,
     +  e_W3magW,W4magW,e_W4magW,ccflagsW,extflgW,varflgW,phqualW,
     +  distADR9,XADR9,BmagADR9,e_BmagADR9,VmagADR9,e_VmagADR9,
     +  gpmagADR9,e_gpmagADR9,rpmagADR9,e_rpmagADR9,ipmagADR9,
     +  e_ipmagADR9,DENIS,distD,XD,ImagD,e_ImagD,JmagD,e_JmagD,KmagD,
     +  e_KmagD,USNOB1,distUB1,XUB1,B1magUB1,R1magUB1,B2magUB1,
     +  R2magUB1,ImagUB1,pmRAUB1,e_pmRAUB1,pmDEUB1,e_pmDEUB1,Obsdate,
     +  FieldName,FiberNb,PlateNb,MJDOBS,LSTstart,LSTend,UTCstart,
     +  UTCend
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'rave_gra.dat'	! Astroseismic gravities (RAVE_Gravity_SC.dat)

C  Format for file interpretation

    2 format(
     +  A21,1X,F4.2,1X,F4.2,1X,I1,4X,I1,4X,I1,1X,I4,1X,F5.2,1X,I4,1X,
     +  F5.2,1X,I4,1X,F5.2,1X,I4,1X,F5.2,1X,I4,1X,F5.2,1X,I4,1X,F5.2,
     +  1X,I4,1X,F5.2,1X,F9.1,1X,F4.2,1X,F12.8,1X,F9.3,1X,F9.4,1X,
     +  F13.10,1X,F9.7,1X,F8.6,1X,F9.7,1X,F8.5,1X,F8.6,1X,I4,1X,I4,1X,
     +  I4,1X,F8.5,1X,F9.7,1X,F8.6,1X,F8.5,1X,F9.7,1X,F9.7,1X,F8.5,1X,
     +  F9.7,1X,F10.8)

C  Effective file loading

      open(unit=1,status='old',file=
     +'rave_gra.dat')
      write(6,*) '....Loading file: rave_gra.dat'
      do i__=1,262510
        read(1,'(A331)')ar__1
        read(ar__1,2)
     +  Name_1,loggSC,e_loggSC,Flag050,Flag075,FlagM,TeffIR_1,v_Mg_H_,
     +  o__Mg_H_,v_Al_H_,o__Al_H_,v_Si_H_,o__Si_H_,v_Ti_H_,o__Ti_H_,
     +  v_Fe_H_,o__Fe_H_,v_Ni_H_,o__Ni_H_,v_a_Fe_c_1,CHISQc_1,fracc_1,
     +  AVSchl_1,Dist_1,e_Dist_1,logAv_1,e_logAv_1,plx_1,e_plx_1,DM_1,
     +  e_DM_1,FFB_1,FQB_1,NGauss_1,Gm1_1,Gs1_1,Gf1_1,Gm2_1,Gs2_1,
     +  Gf2_1,Gm3_1,Gs3_1,Gf3_1
        if(ar__1(23:26) .EQ. '') loggSC = rNULL__
        if(ar__1(28:31) .EQ. '') e_loggSC = rNULL__
        if(ar__1(38:38) .EQ. '') Flag075 = iNULL__
        if(ar__1(43:43) .EQ. '') FlagM = iNULL__
        if(ar__1(45:48) .EQ. '') TeffIR_1 = iNULL__
        if(ar__1(50:54) .EQ. '') v_Mg_H_ = rNULL__
        if(ar__1(56:59) .EQ. '') o__Mg_H_ = iNULL__
        if(ar__1(61:65) .EQ. '') v_Al_H_ = rNULL__
        if(ar__1(67:70) .EQ. '') o__Al_H_ = iNULL__
        if(ar__1(72:76) .EQ. '') v_Si_H_ = rNULL__
        if(ar__1(78:81) .EQ. '') o__Si_H_ = iNULL__
        if(ar__1(83:87) .EQ. '') v_Ti_H_ = rNULL__
        if(ar__1(89:92) .EQ. '') o__Ti_H_ = iNULL__
        if(ar__1(94:98) .EQ. '') v_Fe_H_ = rNULL__
        if(ar__1(100:103) .EQ. '') o__Fe_H_ = iNULL__
        if(ar__1(105:109) .EQ. '') v_Ni_H_ = rNULL__
        if(ar__1(111:114) .EQ. '') o__Ni_H_ = iNULL__
        if(ar__1(116:120) .EQ. '') v_a_Fe_c_1 = rNULL__
        if(ar__1(122:130) .EQ. '') CHISQc_1 = rNULL__
        if(ar__1(132:135) .EQ. '') fracc_1 = rNULL__
        if(ar__1(137:148) .EQ. '') AVSchl_1 = rNULL__
        if(ar__1(150:158) .EQ. '') Dist_1 = rNULL__
        if(ar__1(160:168) .EQ. '') e_Dist_1 = rNULL__
        if(ar__1(170:182) .EQ. '') logAv_1 = rNULL__
        if(ar__1(184:192) .EQ. '') e_logAv_1 = rNULL__
        if(ar__1(194:201) .EQ. '') plx_1 = rNULL__
        if(ar__1(203:211) .EQ. '') e_plx_1 = rNULL__
        if(ar__1(213:220) .EQ. '') DM_1 = rNULL__
        if(ar__1(222:229) .EQ. '') e_DM_1 = rNULL__
        if(ar__1(231:234) .EQ. '') FFB_1 = iNULL__
        if(ar__1(236:239) .EQ. '') FQB_1 = iNULL__
        if(ar__1(241:244) .EQ. '') NGauss_1 = iNULL__
        if(ar__1(246:253) .EQ. '') Gm1_1 = rNULL__
        if(ar__1(255:263) .EQ. '') Gs1_1 = rNULL__
        if(ar__1(265:272) .EQ. '') Gf1_1 = rNULL__
        if(ar__1(274:281) .EQ. '') Gm2_1 = rNULL__
        if(ar__1(283:291) .EQ. '') Gs2_1 = rNULL__
        if(ar__1(293:301) .EQ. '') Gf2_1 = rNULL__
        if(ar__1(303:310) .EQ. '') Gm3_1 = rNULL__
        if(ar__1(312:320) .EQ. '') Gs3_1 = rNULL__
        if(ar__1(322:331) .EQ. '') Gf3_1 = rNULL__
c    ..............Just test output...........
        write(6,2)
     +  Name_1,loggSC,e_loggSC,Flag050,Flag075,FlagM,TeffIR_1,v_Mg_H_,
     +  o__Mg_H_,v_Al_H_,o__Al_H_,v_Si_H_,o__Si_H_,v_Ti_H_,o__Ti_H_,
     +  v_Fe_H_,o__Fe_H_,v_Ni_H_,o__Ni_H_,v_a_Fe_c_1,CHISQc_1,fracc_1,
     +  AVSchl_1,Dist_1,e_Dist_1,logAv_1,e_logAv_1,plx_1,e_plx_1,DM_1,
     +  e_DM_1,FFB_1,FQB_1,NGauss_1,Gm1_1,Gs1_1,Gf1_1,Gm2_1,Gs2_1,
     +  Gf2_1,Gm3_1,Gs3_1,Gf3_1
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'rave_on.dat'	! Stellar parameters from Cannon

C  Format for file interpretation

    3 format(
     +  A21,1X,A16,1X,F21.17,1X,F23.19,1X,F9.3,1X,F8.3,1X,F36.29,1X,
     +  F33.28,1X,F6.2,1X,F5.3,1X,F8.3,1X,F7.3,1X,F8.3,1X,F8.3,1X,
     +  F5.2,1X,I4,1X,A4,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,
     +  A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,A1,1X,
     +  A1,1X,A1,1X,A1,1X,F19.13,1X,F22.19,1X,F26.23,1X,F25.22,1X,
     +  F25.22,1X,F24.21,1X,F26.23,1X,F27.24,1X,F24.21,1X,F19.14,1X,
     +  F19.17,1X,F20.18,1X,F19.17,1X,F19.17,1X,F19.17,1X,F19.17,1X,
     +  F19.17,1X,F20.18,1X,F24.20,1X,F30.17,1X,I1)

C  Effective file loading

      open(unit=1,status='old',file=
     +'rave_on.dat')
      write(6,*) '....Loading file: rave_on.dat'
      do i__=1,520701
        read(1,'(A745)')ar__2
        read(ar__2,3)
     +  Name_2,RAVE_1,RAdeg_1,DEdeg_1,HRV_1,e_HRV_1,s_HRV_2,S_HRV_3,R,
     +  hcp,wcp,cRV,HRVsky,e_HRVsky,Rsky,VrotS,ZPFLAG,c1_1,c2_1,c3_1,
     +  c4_1,c5_1,c6_1,c7_1,c8_1,c9_1,c10_1,c11_1,c12_1,c13_1,c14_1,
     +  c15_1,c16_1,c17_1,c18_1,c19_1,c20_1,Teff,logg,v_Fe_H__1,
     +  v_O_H_,v_Mg_H__1,v_Al_H__1,v_Si_H__1,v_Ca_H_,v_Ni_H__1,e_Teff,
     +  e_logg,e__Fe_H_,e__O_H_,e__Mg_H_,e__Al_H_,e__Si_H_,e__Ca_H_,
     +  e__Ni_H_,SNR,RCHISQ,QC
        if (idig(ar__2(105:140)).EQ.0) s_HRV_2 =  rNULL__
        if (idig(ar__2(142:174)).EQ.0) S_HRV_3 =  rNULL__
        if (VrotS .EQ. 45) VrotS =  iNULL__
        if (idig(ar__2(280:298)).EQ.0) Teff =  rNULL__
        if (idig(ar__2(300:321)).EQ.0) logg =  rNULL__
        if (idig(ar__2(323:348)).EQ.0) v_Fe_H__1 =  rNULL__
        if (idig(ar__2(350:374)).EQ.0) v_O_H_ =  rNULL__
        if (idig(ar__2(376:400)).EQ.0) v_Mg_H__1 =  rNULL__
        if (idig(ar__2(402:425)).EQ.0) v_Al_H__1 =  rNULL__
        if (idig(ar__2(427:452)).EQ.0) v_Si_H__1 =  rNULL__
        if (idig(ar__2(454:480)).EQ.0) v_Ca_H_ =  rNULL__
        if (idig(ar__2(482:505)).EQ.0) v_Ni_H__1 =  rNULL__
        if (idig(ar__2(507:525)).EQ.0) e_Teff =  rNULL__
        if (idig(ar__2(527:545)).EQ.0) e_logg =  rNULL__
        if (idig(ar__2(547:566)).EQ.0) e__Fe_H_ =  rNULL__
        if (idig(ar__2(568:586)).EQ.0) e__O_H_ =  rNULL__
        if (idig(ar__2(588:606)).EQ.0) e__Mg_H_ =  rNULL__
        if (idig(ar__2(608:626)).EQ.0) e__Al_H_ =  rNULL__
        if (idig(ar__2(628:646)).EQ.0) e__Si_H_ =  rNULL__
        if (idig(ar__2(648:666)).EQ.0) e__Ca_H_ =  rNULL__
        if (idig(ar__2(668:687)).EQ.0) e__Ni_H_ =  rNULL__
        if(ar__2(689:712) .EQ. '') SNR = rNULL__
        if(ar__2(714:743) .EQ. '') RCHISQ = rNULL__
c    ..............Just test output...........
        write(6,3)
     +  Name_2,RAVE_1,RAdeg_1,DEdeg_1,HRV_1,e_HRV_1,s_HRV_2,S_HRV_3,R,
     +  hcp,wcp,cRV,HRVsky,e_HRVsky,Rsky,VrotS,ZPFLAG,c1_1,c2_1,c3_1,
     +  c4_1,c5_1,c6_1,c7_1,c8_1,c9_1,c10_1,c11_1,c12_1,c13_1,c14_1,
     +  c15_1,c16_1,c17_1,c18_1,c19_1,c20_1,Teff,logg,v_Fe_H__1,
     +  v_O_H_,v_Mg_H__1,v_Al_H__1,v_Si_H__1,v_Ca_H_,v_Ni_H__1,e_Teff,
     +  e_logg,e__Fe_H_,e__O_H_,e__Mg_H_,e__Al_H_,e__Si_H_,e__Ca_H_,
     +  e__Ni_H_,SNR,RCHISQ,QC
c    .......End.of.Just test output...........
      end do
      close(1)

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

C  Loading file 'rave_com.dat'	! RAVE completeness (RAVE_completeness_PBP.dat)

C  Format for file interpretation

    4 format(
     +  I5,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,
     +  I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,
     +  I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,
     +  I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,
     +  I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,
     +  I1,1X,I1,1X,I1,1X,I1,1X,I1,1X,F3.1,1X,I1,1X,I1,1X,I1,1X,I1,1X,
     +  I1,1X,I1,1X,I1,1X,I1,1X,F8.6,1X,F8.6,1X,F3.1,1X,F3.1,1X,F8.6,
     +  1X,F8.6,1X,F3.1,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,
     +  F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,
     +  1X,F8.6,1X,F8.6,1X,F9.7,1X,F9.7,1X,F8.6,1X,F9.7,1X,F8.6,1X,
     +  F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,
     +  1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,
     +  F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F9.7,1X,F10.8,
     +  1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,
     +  F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,
     +  1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,
     +  F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,1X,F10.8,
     +  1X,F10.8,1X,F12.10)

C  Effective file loading

      open(unit=1,status='old',file=
     +'rave_com.dat')
      write(6,*) '....Loading file: rave_com.dat'
      do i__=1,5525
        read(1,'(A905)')ar__3
        read(ar__3,4)
     +  HEALPix32,CF00_0,CF00_1,CF00_2,CF00_3,CF00_4,CF00_5,CF00_6,
     +  CF00_7,CF00_8,CF00_9,CF01_0,CF01_1,CF01_2,CF01_3,CF01_4,
     +  CF01_5,CF01_6,CF01_7,CF01_8,CF01_9,CF02_0,CF02_1,CF02_2,
     +  CF02_3,CF02_4,CF02_5,CF02_6,CF02_7,CF02_8,CF02_9,CF03_0,
     +  CF03_1,CF03_2,CF03_3,CF03_4,CF03_5,CF03_6,CF03_7,CF03_8,
     +  CF03_9,CF04_0,CF04_1,CF04_2,CF04_3,CF04_4,CF04_5,CF04_6,
     +  CF04_7,CF04_8,CF04_9,CF05_0,CF05_1,CF05_2,CF05_3,CF05_4,
     +  CF05_5,CF05_6,CF05_7,CF05_8,CF05_9,CF06_0,CF06_1,CF06_2,
     +  CF06_3,CF06_4,CF06_5,CF06_6,CF06_7,CF06_8,CF06_9,CF07_0,
     +  CF07_1,CF07_2,CF07_3,CF07_4,CF07_5,CF07_6,CF07_7,CF07_8,
     +  CF07_9,CF08_0,CF08_1,CF08_2,CF08_3,CF08_4,CF08_5,CF08_6,
     +  CF08_7,CF08_8,CF08_9,CF09_0,CF09_1,CF09_2,CF09_3,CF09_4,
     +  CF09_5,CF09_6,CF09_7,CF09_8,CF09_9,CF10_0,CF10_1,CF10_2,
     +  CF10_3,CF10_4,CF10_5,CF10_6,CF10_7,CF10_8,CF10_9,CF11_0,
     +  CF11_1,CF11_2,CF11_3,CF11_4,CF11_5,CF11_6,CF11_7,CF11_8,
     +  CF11_9,CF12_0,CF12_1,CF12_2,CF12_3,CF12_4,CF12_5,CF12_6,
     +  CF12_7,CF12_8,CF12_9,CF13_0,CF13_1,CF13_2,CF13_3,CF13_4,
     +  CF13_5,CF13_6,CF13_7,CF13_8,CF13_9,CF14_0
c    ..............Just test output...........
        write(6,4)
     +  HEALPix32,CF00_0,CF00_1,CF00_2,CF00_3,CF00_4,CF00_5,CF00_6,
     +  CF00_7,CF00_8,CF00_9,CF01_0,CF01_1,CF01_2,CF01_3,CF01_4,
     +  CF01_5,CF01_6,CF01_7,CF01_8,CF01_9,CF02_0,CF02_1,CF02_2,
     +  CF02_3,CF02_4,CF02_5,CF02_6,CF02_7,CF02_8,CF02_9,CF03_0,
     +  CF03_1,CF03_2,CF03_3,CF03_4,CF03_5,CF03_6,CF03_7,CF03_8,
     +  CF03_9,CF04_0,CF04_1,CF04_2,CF04_3,CF04_4,CF04_5,CF04_6,
     +  CF04_7,CF04_8,CF04_9,CF05_0,CF05_1,CF05_2,CF05_3,CF05_4,
     +  CF05_5,CF05_6,CF05_7,CF05_8,CF05_9,CF06_0,CF06_1,CF06_2,
     +  CF06_3,CF06_4,CF06_5,CF06_6,CF06_7,CF06_8,CF06_9,CF07_0,
     +  CF07_1,CF07_2,CF07_3,CF07_4,CF07_5,CF07_6,CF07_7,CF07_8,
     +  CF07_9,CF08_0,CF08_1,CF08_2,CF08_3,CF08_4,CF08_5,CF08_6,
     +  CF08_7,CF08_8,CF08_9,CF09_0,CF09_1,CF09_2,CF09_3,CF09_4,
     +  CF09_5,CF09_6,CF09_7,CF09_8,CF09_9,CF10_0,CF10_1,CF10_2,
     +  CF10_3,CF10_4,CF10_5,CF10_6,CF10_7,CF10_8,CF10_9,CF11_0,
     +  CF11_1,CF11_2,CF11_3,CF11_4,CF11_5,CF11_6,CF11_7,CF11_8,
     +  CF11_9,CF12_0,CF12_1,CF12_2,CF12_3,CF12_4,CF12_5,CF12_6,
     +  CF12_7,CF12_8,CF12_9,CF13_0,CF13_1,CF13_2,CF13_3,CF13_4,
     +  CF13_5,CF13_6,CF13_7,CF13_8,CF13_9,CF14_0
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