CDS.headStuff2 FORTRAN Generation
()

Conversion of standardized ReadMe file for catalog into FORTRAN code for loading all data files into arrays.

Note that special values are assigned to unknown or unspecified numbers (also called NULL numbers); when necessary, the coordinate components making up the right ascension and declination are converted into floating-point numbers representing these angles in degrees.



      program load_ReadMe
C=============================================================================
C  F77-compliant program generated by readme2f_1.81 (2015-09-23), on 2024-Apr-25
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. II/241           2MASS Catalog Incremental Data Release   (IPAC/UMass, 2000)
*================================================================================
*The Two Micron All Sky Survey, 2nd Incremental Data Release
*    Skrutskie M.F., Schneider S.E., Stiening R., Strom S.E., Weinberg M.D.,
*    Beichman C., Chester T., Cutri R., Lonsdale C.,
*    Elias J., Elston R., Capps R., Carpenter J., Huchra J.,
*    Liebert J., Monet D., Price S., Seitzer P.
*   <Proc. Workshop "The Impact of Large Scale Near-IR Sky Surveys", 25 (1997)>
C=============================================================================

C  Internal variables

      integer*4 i__

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

C  Declarations for 'out.sam'	! 2MASS Point Source Catalogue, sample output,
                                 incremental data release 2 (March 2000).

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

C  J2000 position composed of: RAdeg DEdeg
      real*8        RAdeg      (nr__) ! (deg) Right ascension (J2000)
      real*8        DEdeg      (nr__) ! (deg) Declination (J2000)
      real*4        MajAxis    (nr__) ! (arcsec) ? Major axis of position error ellipse
      real*4        MinAxis    (nr__) ! (arcsec) ? Minor axis of position error ellipse
      integer*4     Theta      (nr__) ! (deg) [0,180]? Position angle of error ellipse
*                                  major axis (E of N)
      character*1   f_Name     (nr__) ! [* ] A '*' flags a non-unique source
*                                  designation
      character*14  Name       (nr__) ! Source designation
*--------------------------------------------------------------------------------
      real*8        Jmag       (nr__) ! (mag) ?=-99.999 J selected "default" magnitude (1)
      real*4        e_Jmag_d   (nr__) ! (mag) ? J "default" magnitude uncertainty (2)
      real*4        e_Jmag     (nr__) ! (mag) ? J "total" magnitude uncertainty (3)
      real*8        Hmag       (nr__) ! (mag) ?=-99.999 H selected "default" magnitude (1)
      real*4        e_Hmag_d   (nr__) ! (mag) ? H "default" magnitude uncertainty (2)
      real*4        e_Hmag     (nr__) ! (mag) ? H "total" magnitude uncertainty (3)
      real*8        Kmag       (nr__) ! (mag) ?=-99.999 K selected "default" magnitude (1)
      real*4        e_Kmag_d   (nr__) ! (mag) ? Ks "default" magnitude uncertainty (2)
      real*4        e_Kmag     (nr__) ! (mag) ? Ks "total" magnitude uncertainty (3)
*--------------------------------------------------------------------------------
      character*3   rd_flg     (nr__) ! [012348] Source of JHK "default" mag (4)
      character*3   bl_flg     (nr__) ! [012] JHK components fit to source (5)
      character*3   cc_flg     (nr__) ! [UNPCDSRGB0] Artifact contamin./confusion (6)
      integer*4     extd_flg   (nr__) ! [0,2]? Extended source contamination (7)
      integer*4     mp_flg     (nr__) ! [0,1]? Association with asteroid or comet (8)
*--------------------------------------------------------------------------------
      character*1   Id_opt     (nr__) ! [UT] Associated optical source (9)
      real*4        Bmag       (nr__) ! (mag) ? Blue mag of associated optical source
      real*4        Rmag       (nr__) ! (mag) ? Red mag of associated optical source
      real*4        Dist_opt   (nr__) ! (arcsec) ? Distance to associated optical source
      integer*4     PAopt      (nr__) ! (deg) [0,360]?  position angle to optical source
      integer*4     Nopt_mchs  (nr__) ! ? Number of optical sources within 5 arcsec
*--------------------------------------------------------------------------------
      character*10  Date       (nr__) ! Observation date (MM/DD/YYYY)
      character*1   Hemis      (nr__) ! [ns] Hemisphere of observation
      integer*4     Scan       (nr__) ! ? Scan number (within date)
      integer*4     Id         (nr__) ! Source id number (within scan)
      real*8        GLON       (nr__) ! (deg) Galactic longitude
      real*8        GLAT       (nr__) ! (deg) Galactic latitude
      real*4        Jpsfchi    (nr__) ! ? J band reduced chi2 value of fit
      real*4        Hpsfchi    (nr__) ! ? H band reduced chi2 value of fit
      real*4        Kpsfchi    (nr__) ! ? K band reduced chi2 value of fit
*--------------------------------------------------------------------------------
      real*8        Jm_stdap   (nr__) ! (mag) ? J standard or BF aperture magnitude (10)
      real*4        e_Jm_stdap (nr__) ! (mag) ? error on J_m_stdap
      real*8        Hm_stdap   (nr__) ! (mag) ? H standard or BF aperture magnitude (10)
      real*4        e_Hm_stdap (nr__) ! (mag) ? error on H_m_stdap
      real*8        Km_stdap   (nr__) ! (mag) ? K standard or BF aperture magnitude (10)
      real*4        e_Km_stdap (nr__) ! (mag) ? error on K_m_stdap
*--------------------------------------------------------------------------------
      character*6   Ndet_flg   (nr__) ! [0-9 ] Number of aperture measurements
*                                         (jjhhkk) (11)
*Note (1): This is the selected "default" magnitude for each band
*    (centered at J: 1.25, H: 1.65 and Ks: 2.17{mu}m).
*    For most sources, the [jhk]_m values are the PSF fit mags for each
*    band (rd_flg=2). If the source has a null PSF-fit magnitude but a
*    valid std. aperture magnitude in a band, the [jhk]_m value for that
*    band is the std. aperture magnitude (rd_flg=4). If the source is
*    saturated in R2-R1 in a band, but not saturated in the R1 exposure,
*    the default magnitude is the R1 aperture magnitude (rd_flg=1). If the
*    source is saturated in even the R1 exposure (rd_flg=3) or if the
*    source is a bright star placeholder (rd_flg=8), the default magnitude
*    is given as -99.999. Finally, if a source is band-filled in a band,
*    the value of [jhk]_m for that band is the band-fill 95%-confidence
*    upper limit mag (rd_flg=0).
*
*    This value is computed as follows:
*
*        Lim95 = integrated flux + (2 * noise)
*
*    where the noise in this case means the "local noise", computed as
*    follows (using the DAOPHOT algorithm):
*
*        noise = sqrt(error1 + error2 + error3)
*    where
*
*        error1 = variance in the local sky
*               = npix * skyvar
*          npix = number of pixels in the aperture
*        skyvar = the variance of the sky brightness
*        error2 = photon noise
*               = int. flux * Gain
*        error3 = (skyvar/nsky) * (npix ** 2)
*          nsky = number pixels in sky annulus
*    (skyvar/nsky) = square of the standard error of the mean sky brightness
*
*    For the case in which the integrated flux is negative, the upper limit
*    is
*        Lim95 = 2 * noise
*    where
*        noise = sqrt(error1 + error3)
*Note (2): The mag sigma values corresponding to the selected "default"
*    magnitude for each band are put in the [jhk]_msig fields. For
*    non-detections (band-fills), the mag sigmas are null. An unphysically
*    large magnitude sigma value (e.g. >0.36) indicates that the source was
*    detected in that band, but either the brightness measurement
*    encountered problems due to confusion or other contamination, or the
*    detection is of very low confidence. Objects that are saturated in R1
*    in any band have magnitude sigmas of 9.999.
*Note (3): The "combined" uncertainty in the quoted magnitude for each band
*    that provides an estimate of all random errors that contribute to the
*    photometric uncertainty. This uncertainty is the quadratic combination
*    of the extraction uncertainites ([jhk]_msig), and the photometric zero
*    point offset uncertainties from the night during which the source was
*    observed ([jhk]_zperr from the "Scan Data" table), and the residual
*    flat-fielding errors (estimated to be 0.005 mags for all bands). For
*    R1 sources, the quadratic sum includes the RMS uncertainty in the
*    normalization of the R1 photometry to the R2-R1 photometry
*    ([jhk]_r1normrms from the "Scan Data" table).
*Note (4): The read flag indicates the source of J,H,K "default" magnitudes
*    as a 3-digit integer, where the 1st digit corresponds to the J band,
*    the 2nd to the H band, and the 3rd to the Ks band. The values are as
*    follows:
*    0: source is not detected in this band (is band-filled)
*    1: default mag is R1 aperture
*    2: default mag is R2-R1 profile-fit
*    3: default magnitude is -99.999. Source is saturated in R1.
*    4: default mag is R2-R1 standard aperture mag
*    8: default magnitude is -99.999. Source is "placeholder" for a very
*       bright star heavily saturated in R1. Position information derived
*       from Positions and Proper Motions Star Catalogue (Roser and Bastian,
*       1991, See Catalogues <I/146>, <I/193>, <I/208>).
*Note (5): The "blend" flag indicates how many point source components
*    were fit to each band's source during the profile fitting process. It
*    is a 3-digit integer, where each digit can be
*       0: source not detected in band,
*       1: single profile fit to isolated source, or
*       2: multiple sources detected abd fit simultaneously
*    The 1st digit corresponds to the J band, the 2nd to the H band, and
*    the 3rd to the Ks band.
*Note (6): The contamination/confusion flag indicates whether the
*    source's photometry and position may be affected by artifacts of
*    nearby bright stars or by confusion with other nearby sources. The
*    flag consists of a 3 character string, where the 1st character
*    corresponds to the J band, the 2nd to the H band, and the 3rd to the
*    Ks band.
*
*    Sources are tested for contamination and/or confusion in the order
*    given below, and once a flag is applied to the source, testing is
*    stopped in that band. The flag values indicate the source may be:
*
*    U: unreliable source. Most likely a spurious detection of a meteor
*       trail or a noise excursion
*    N: photometric normalization problem due to the influence of a very
*       bright star in the scan. Photometry in this band may be as much as
*       1 magnitude offset from the correct value
*    P: affected by a nearby persistence artifact
*    D: affected by a nearby diffraction spike
*    S: affected by a horizontal "stripe" artifact (due to a bright star)
*    R: affected by a nearby bright star reflection artifact
*    C: affected by confusion with another nearby source
*    B: affected by confusion in bandmerging
*    0: default value -- not contaminated or not detected in the band
*Note (7): The "extended" flag is set to
*    0 if the point source is not associated with an extended source,
*    1 if it is identically associated with an object in the extended
*      source catalog (e.g. the nucleus of a galaxy), or
*    2 if it is simply contaminated by an extended source (e.g. a star
*      superimposed on the disk of a galaxy).
*Note (8): This object is positionally associated with the location of
*    a known minor planet or comet at the time of the 2MASS observation.
*    See the table of known asteroid and comet detections for more
*    information.
*Note (9): The catalog ID and other association parameters are given for
*    the closest optical match found within 5 arcsec. The ID consists of a
*    single-letter abbreviation for the catalog:
*    'T' for Tycho-ACT (see Cat. <I/246>)
*    'U' for USNO-A (see Cat. I/252>)
*Note (10): If a source is not detected in a band (band-filled),
*    this field in that band contains the band-filled aperture-photometry
*    mag. It is calculated by measuring the brightness within an 8"
*    diameter aperture at the position of the source on the Atlas Image:
*
*        BFMag = ZERO_CAL - 2.5 log10(flux)
*
*    where ZERO_CAL is the zero calibration magnitude. Note that this field
*    may have to represent a negative flux; in such a case, the value is:
*
*        BFMag = 99.0 - [ZERO_CAL - 2.5 log10(|flux|)]
*
*    This encoding requires fluxes close to zero to be clipped. The
*    clipping distance is set to 0.01 DN above zero for positive fluxes and
*    below zero for negative fluxes. For example, the positive flux 0.0005
*    DN would be clipped at 0.01 DN and encoded as:
*
*        BFMag = ZERO_CAL - 2.5 log10(0.01)
*              = 24.93 (for ZERO_CAL = 19.93)
*
*    For a negative flux of -0.0005 DN, the clipping would yield -0.01 DN,
*    and the encoding would be
*
*        BFMag = 99.0 - [ZERO_CAL - 2.5 log10(0.01)]
*              = 74.07 (for ZERO_CAL = 19.93)
*
*    BFMags near 50 cannot occur, so 50 marks the boundary between positive
*    and negative flux encoding.
*Note (11): This flag consists of 6 single-digit numbers,
*    two digits per band in the order JJHHKK.
*    The 1st digit for each band indicates the number of frames with
*        >3-sigma aperture mag measurements, and
*    the 2nd digit indicates the number of frames in which aperture
*        measurements were possible. (This flag is AKA the
*        N-out-of-M statistic).

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

C  Loading file 'out.sam'	! 2MASS Point Source Catalogue, sample output,
*                                 incremental data release 2 (March 2000).

C  Format for file interpretation

    1 format(
     +  F10.6,1X,F10.6,1X,F4.2,1X,F4.2,2X,I3,1X,A1,A14,1X,F7.3,1X,
     +  F5.3,1X,F5.3,1X,F7.3,1X,F5.3,1X,F5.3,1X,F7.3,1X,F5.3,1X,F5.3,
     +  1X,A3,2X,A3,2X,A3,4X,I1,1X,I1,4X,A1,1X,F5.2,1X,F5.2,2X,F4.2,
     +  2X,I3,3X,I2,2X,A10,4X,A1,2X,I3,1X,I6,1X,F10.6,1X,F10.6,1X,
     +  F6.2,1X,F6.2,1X,F6.2,1X,F7.3,1X,F6.3,1X,F7.3,1X,F6.3,1X,F7.3,
     +  1X,F6.3,3X,A6)

C  Effective file loading

      open(unit=1,status='old',file=
     +'out.sam')
      write(6,*) '....Loading file: out.sam'
      do i__=1,1000
        read(1,'(A292)')ar__
        read(ar__,1)
     +  RAdeg(i__),DEdeg(i__),MajAxis(i__),MinAxis(i__),Theta(i__),
     +  f_Name(i__),Name(i__),Jmag(i__),e_Jmag_d(i__),e_Jmag(i__),
     +  Hmag(i__),e_Hmag_d(i__),e_Hmag(i__),Kmag(i__),e_Kmag_d(i__),
     +  e_Kmag(i__),rd_flg(i__),bl_flg(i__),cc_flg(i__),extd_flg(i__),
     +  mp_flg(i__),Id_opt(i__),Bmag(i__),Rmag(i__),Dist_opt(i__),
     +  PAopt(i__),Nopt_mchs(i__),Date(i__),Hemis(i__),Scan(i__),
     +  Id(i__),GLON(i__),GLAT(i__),Jpsfchi(i__),Hpsfchi(i__),
     +  Kpsfchi(i__),Jm_stdap(i__),e_Jm_stdap(i__),Hm_stdap(i__),
     +  e_Hm_stdap(i__),Km_stdap(i__),e_Km_stdap(i__),Ndet_flg(i__)
        if(ar__(23:26) .EQ. '') MajAxis(i__) = rNULL__
        if(ar__(28:31) .EQ. '') MinAxis(i__) = rNULL__
        if(ar__(34:36) .EQ. '') Theta(i__) = iNULL__
        if(ar__(62:66) .EQ. '') e_Jmag_d(i__) = rNULL__
        if(ar__(68:72) .EQ. '') e_Jmag(i__) = rNULL__
        if(ar__(82:86) .EQ. '') e_Hmag_d(i__) = rNULL__
        if(ar__(88:92) .EQ. '') e_Hmag(i__) = rNULL__
        if(ar__(102:106) .EQ. '') e_Kmag_d(i__) = rNULL__
        if(ar__(108:112) .EQ. '') e_Kmag(i__) = rNULL__
        if(ar__(131:131) .EQ. '') extd_flg(i__) = iNULL__
        if(ar__(133:133) .EQ. '') mp_flg(i__) = iNULL__
        if(ar__(140:144) .EQ. '') Bmag(i__) = rNULL__
        if(ar__(146:150) .EQ. '') Rmag(i__) = rNULL__
        if(ar__(153:156) .EQ. '') Dist_opt(i__) = rNULL__
        if(ar__(159:161) .EQ. '') PAopt(i__) = iNULL__
        if(ar__(165:166) .EQ. '') Nopt_mchs(i__) = iNULL__
        if(ar__(186:188) .EQ. '') Scan(i__) = iNULL__
        if(ar__(219:224) .EQ. '') Jpsfchi(i__) = rNULL__
        if(ar__(226:231) .EQ. '') Hpsfchi(i__) = rNULL__
        if(ar__(233:238) .EQ. '') Kpsfchi(i__) = rNULL__
        if(ar__(240:246) .EQ. '') Jm_stdap(i__) = rNULL__
        if(ar__(248:253) .EQ. '') e_Jm_stdap(i__) = rNULL__
        if(ar__(255:261) .EQ. '') Hm_stdap(i__) = rNULL__
        if(ar__(263:268) .EQ. '') e_Hm_stdap(i__) = rNULL__
        if(ar__(270:276) .EQ. '') Km_stdap(i__) = rNULL__
        if(ar__(278:283) .EQ. '') e_Km_stdap(i__) = rNULL__
c    ..............Just test output...........
        write(6,1)
     +  RAdeg(i__),DEdeg(i__),MajAxis(i__),MinAxis(i__),Theta(i__),
     +  f_Name(i__),Name(i__),Jmag(i__),e_Jmag_d(i__),e_Jmag(i__),
     +  Hmag(i__),e_Hmag_d(i__),e_Hmag(i__),Kmag(i__),e_Kmag_d(i__),
     +  e_Kmag(i__),rd_flg(i__),bl_flg(i__),cc_flg(i__),extd_flg(i__),
     +  mp_flg(i__),Id_opt(i__),Bmag(i__),Rmag(i__),Dist_opt(i__),
     +  PAopt(i__),Nopt_mchs(i__),Date(i__),Hemis(i__),Scan(i__),
     +  Id(i__),GLON(i__),GLAT(i__),Jpsfchi(i__),Hpsfchi(i__),
     +  Kpsfchi(i__),Jm_stdap(i__),e_Jm_stdap(i__),Hm_stdap(i__),
     +  e_Hm_stdap(i__),Km_stdap(i__),e_Km_stdap(i__),Ndet_flg(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

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