<?xml version="1.0"?>
<resource resdir="rave" schema="rave">
	<meta name="title">RAdial Velocity Experiment: RAVE DR5</meta>
	<meta name="creationDate">2009-09-30T14:53:00Z</meta>
	<meta name="schema-rank">100</meta>
	<meta name="creator">
		Kordopatis,G.; Gilmore, G.; Steinmetz, M.; Boeche, C.; Seabroke, G.M.;
		Siebert, A.; Zwitter, T.; Binney, J.; de Laverny, P.; Recio−Blanco, A.;
		Williams, M.E.K.; Piffl, T.; Enke, H.; Roeser, S.; Bijaoui, A.;
		Wyse, R.F.G.; Freeman, K.; Munari, U.; Carillo, I.; Anguiano, B.;
		Burton, D.; Campbell, R.; Cass, C.J.P.; Fiegert, K.; Hartley, M.;
		Parker, Q.A.; Reid, W.; Ritter, A.; Russell, K.S.; Stupart, M.;
		Watson, F.G.; Bienayme, ́O.; Bland−Hawthorn, J.; Gerhard, O.; Gibson, B.K.;
		Grebel, E.K.; Helmi, A.; Navarro, J.F.; Conrad, C.; Famaey, B.; Faure, C.;
		Just, A.; Kos, J.; Matijevic, G.; McMillan, P.J.; Minchev, I.; Scholz, R.;
		Sharma, S.; Siviero, A.; Wylie de Boer, E.; Zerjal, M.
	</meta>
	<meta name="version">Data Release 5</meta>

	<meta name="subject">surveys</meta>
	<meta name="subject">stars</meta>
	<meta name="subject">radial-velocity</meta>
	<meta name="subject">milky-way-galaxy</meta>

	<meta name="description">
	The RAdial Velocity Experiment (RAVE) contains stellar atmospheric parameters
	(effective temperature, surface gravity, overall metallicity), radial
	velocities, chemical abundances and distances. Observations between
	2003 and 2013 were used to build the five RAVE data releases.
	</meta>


	<meta name="_related"
		title="Project Website">http://www.rave-survey.org</meta>

	<meta name="coverage.waveband">Optical</meta>

	<meta name="_intro" format="rst"><![CDATA[
		For advanced queries, you can query
		`this </__system__/dc_tables/show/tableinfo/rave.main>`_
		and many other tables
		using our \RSTservicelink{/tap}{TAP service}.
	]]></meta>

	<meta name="source">2017AJ....153...75K</meta>

	<meta name="facility">UK Schmidt AAO</meta>

	<meta name="instrument">6dF</meta>

	<meta name="copyright">
		All publications making use of the RAVE data
		should refer to the paper given in source.
	</meta>

	<STREAM id="commoncolumns">
		<column name="raj2000"
			type="double precision"
			unit="deg"
			ucd="pos.eq.ra;meta.main"
			tablehead="RA"
			description="Right ascension (J2000.0)"
			/>
		<column name="dej2000"
			type="double precision"
			unit="deg"
			ucd="pos.eq.dec;meta.main"
			tablehead="Dec"
			description="Declination (J2000.0)"
			/>
		<column name="glon"
			type="double precision"
			unit="deg"
			ucd="pos.galactic.lon"
			tablehead="l"
			description="Galactic longitude"
			verbLevel="25"
			/>
		<column name="glat"
			type="double precision"
			unit="deg"
			ucd="pos.galactic.lat"
			tablehead="b"
			description="Galactic latitude"
			verbLevel="25"
			/>
		<column name="rv"
			type="real"
			unit="km/s"
			ucd="spect.dopplerVeloc;pos.heliocentric"
			tablehead="RV"
			description="Heliocentric radial velocity"
			verbLevel="5"
			/>
		<column name="e_rv"
			type="real"
			unit="km/s"
			ucd="stat.error;spect.dopplerVeloc;pos.heliocentric"
			tablehead="Err(RV)"
			description="Error in heliocentric radial velocity"
			verbLevel="15"
			/>
		<column name="obsdate"
			type="double precision"
			xtype="mjd"
			unit="d"
			ucd="time.epoch;obs"
			tablehead="Date"
			description="Observation date."
			displayHint="type=humanDate"
			/>
		<column name="field_name"
			type="text"
			ucd="meta.id;obs.field"
			tablehead="Field"
			description="Name of RAVE field (RA/DE)"
			verbLevel="20"
			/>
		<column name="plate_number"
			required="true"
			type="smallint"
			ucd="meta.id;obs.field"
			tablehead="PlateNumber"
			description="Number of field plate [1..3]"
			verbLevel="25"
			/>
		<column name="fiber_number"
			required="true"
			type="smallint"
			ucd="meta.number;instr.setup"
			tablehead="Fiber#"
			description="Number of optical fiber used to obtain the spectrum [1,150]."
			verbLevel="25"
			/>
		<column name="teff_k"
			type="real"
			unit="K"
			ucd="phys.temperature.effective"
			tablehead="Teff"
			description="Effective temperature from the stellar parameter pipeline."
			verbLevel="12"
			/>
		<column name="e_teff_k"
			type="real"
			unit="K"
			ucd="stat.error;phys.temperature.effective"
			tablehead="Err(Teff)"
			description="Error in the effective temperature from the
				stellar parameter pipeline."
			/>
		<column name="logg_k"
			type="real"
			ucd="phys.gravity"
			tablehead="log(g)"
			description="Log gravity as determined by the stellar pipeline."
			verbLevel="12"
			/>
		<column name="e_logg_k"
			type="real"
			ucd="stat.error;phys.gravity"
			tablehead="Err(log(g))"
			description="Error in logg_k."
			/>
		<column name="met_k"
			type="real"
			ucd="phys.abund.Z"
			tablehead="m/H"
			description="Metallicity [m/H] from the stellar parameter pipeline."
			/>
		<column name="met_n_k"
			type="real"
			ucd="phys.abund.Z"
			tablehead="Met_N_K"
			description="Calibrated metallicity [m/H] from the stellar
				parameter pipeline."
			/>
		<column name="e_met_k"
			type="real"
			ucd="stat.error;phys.abund.Z"
			tablehead="eMet_K"
			description="Error in metallicity [m/H] from the stellar
				parameter pipeline."
			/>
		<column name="snr_k"
			type="real"
			ucd="stat.snr"
			tablehead="SNR_K"
			description="Signal to noise value for the stellar parameter pipeline."
			/>
		<column name="algo_conv_k"
			type="real"
			ucd="meta.code.qual"
			tablehead="Conv?"
			description="Quality flag for stellar parameter pipeline [0..4]."
			note="5"
			/>

		<column name="al"
			type="real"
			ucd="phys.abund"
			tablehead="Al"
			description="Abundance of Al [Al/H]"
			verbLevel="10"
			/>
		<column name="al_n"
			type="integer"
			ucd="phys.abund"
			tablehead="Al_N"
			description="Number of spectral lines used for the computation of
				Al abundance."
			verbLevel="20">
			<values nullLiteral="0"/>
		</column>
		<column name="si"
			type="real"
			ucd="phys.abund"
			tablehead="Si"
			description="Abundance of Si [Si/H]"
			verbLevel="10"
			/>
		<column name="si_n"
			type="integer"
			ucd="phys.abund"
			tablehead="Si_N"
			description="Number of spectral lines used for the computation of
				Si abundance."
			verbLevel="20">
			<values nullLiteral="0"/>
		</column>
		<column name="fe"
			type="real"
			ucd="phys.abund.Fe"
			tablehead="Fe"
			description="Abundance of Fe [Fe/H]"
			verbLevel="10"
			/>
		<column name="fe_n"
			type="integer"
			ucd="phys.abund"
			tablehead="Fe_N"
			description="Number of spectral lines used for the computation of
				Fe abundance."
			verbLevel="20">
			<values nullLiteral="0"/>
		</column>
		<column name="ti"
			type="real"
			ucd="phys.abund"
			tablehead="Ti"
			description="Number of spectral lines used for the computation of
				Ti abundance."
			verbLevel="10"
			/>
		<column name="ti_n"
			type="integer"
			ucd="phys.abund"
			tablehead="Ti_N"
			description="Number of used spectral lines for calculation of
				Ti abundance."
			verbLevel="20">
			<values nullLiteral="0"/>
		</column>
		<column name="ni"
			type="real"
			ucd="phys.abund"
			tablehead="Ni"
			description="Abundance of Ni [Ni/H]"
			verbLevel="10"
			/>
		<column name="ni_n"
			type="integer"
			ucd="phys.abund"
			tablehead="Ni_N"
			description="Number of spectral lines used for the computation of
				Ni abundance."
			verbLevel="20">
			<values nullLiteral="0"/>
		</column>
		<column name="mg"
			type="real"
			ucd="phys.abund"
			tablehead="Mg"
			description="Abundance of Mg [Mg/H]"
			verbLevel="10"
			/>
		<column name="mg_n"
			type="integer"
			ucd="phys.abund"
			tablehead="Mg_N"
			description="Number of spectral lines used for the computation of
				Mg abundance."
			verbLevel="20">
			<values nullLiteral="0"/>
		</column>

		<column original="2mass/res/2mass#data.Jmag"/>
		<column original="2mass/res/2mass#data.e_Jmag"/>
		<column original="2mass/res/2mass#data.Hmag"/>
		<column original="2mass/res/2mass#data.e_Hmag"/>
		<column original="2mass/res/2mass#data.Kmag"/>
		<column original="2mass/res/2mass#data.e_Kmag"/>

		<column name="chisq_c"
			type="real"
			ucd="stat.fit.chi2"
			tablehead="χ²(chem)"
			description="χ² of the Chemical Pipeline"
			/>
		<column name="id_2mass"
			type="text"
			ucd="meta.id"
			tablehead="ID_2MASS"
			description="2MASS Target designation"
			/>
		<column name="id_denis"
			type="text"
			ucd="meta.id"
			tablehead="ID_DENIS"
			description="DENIS Target designation"
			/>
		<column name="id_usnob1"
			type="text"
			ucd="meta.id"
			tablehead="ID_USNOB1"
			description="USNOB1 Target designation"
			/>
		<column name="id_tycho2"
			type="text"
			ucd="meta.id"
			tablehead="TYCHO2"
			description="TYCHO2 target designation"
			/>
		<column name="id_ucac4"
			type="text"
			ucd="meta.id"
			tablehead="UCAC4"
			description="UCAC4 target designation"
			/>
		<column name="id_ppmxl"
			type="bigint"
			ucd="meta.id"
			tablehead="PPMXL"
			description="PPMXL target designation.">
			<values nullLiteral="-1"/>
		</column>
		<column name="parallax"
			unit="mas"
			ucd="pos.parallax"
			tablehead="parallax"
			description="Parallax (from 2014MNRAS.437..351B)"
			/>
		<column name="e_parallax"
			unit="mas"
			ucd="stat.error;pos.parallax"
			tablehead="e_parallax"
			description="Error Parallax (from 2014MNRAS.437..351B)"
			/>
		<column name="dist_binney"
			unit="kpc"
			ucd="pos.distance"
			tablehead="dist"
			description="Distance (from 2014MNRAS.437..351B)"
			/>
		<column name="e_dist"
			unit="kpc"
			ucd="stat.error;pos.distance"
			tablehead="e_dist"
			description="Error in Distance (from 2014MNRAS.437..351B)"
			/>
		<column name="distance_modulus"
			ucd="phot.mag.distMod"
			tablehead="DistanceModulus_Binney"
			description="Distance modulus (from 2014MNRAS.437..351B)"
			/>
		<column name="e_distance_modulus"
			ucd="stat.error;phot.mag.distMod"
			tablehead="eDistanceModulus_Binney"
			description="Distance modulus (from 2014MNRAS.437..351B)"
			/>
		<column name="log_av"
			ucd="phys.absorption"
			tablehead="log Av"
			description="Extinction (from 2014MNRAS.437..351B)"
			/>
		<column name="e_log_av"
			ucd="stat.error;phys.absorption"
			tablehead="Err. log Av"
			description="Error in extinction (from 2014MNRAS.437..351B)"
			/>
		<column name="min_dists"
			type="text"
			ucd=""
			tablehead="Min.Dists"
			description="20 minimum distances to the base spectrum given
				by alphabetic codes from 2012ApJS..200...14M."
			verbLevel="25"
			/>

		<meta name="note" tag="5">
			Flag of Stellar Parameter Pipeline.

			=== ==================================================================
			 0  Pipeline converged
			 1  no convergence.
			 2  MATISSE oscillates between two values and the mean is given.
			 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&lt;20 have been re-run by
			    DEGAS with a scale factor (ie, internal parameter of DEGAS)
			    of 0.40
			=== ==================================================================
		</meta>		
	</STREAM>

	<table id="main" onDisk="True" adql="True" primary="rave_obs_id"
			mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description">The RAVE object catalog of radial
		velocities, surface gravities, and chemical parameters
		for about 500000 stars, data release 5.  We have removed almost all
		fields originating from crossmatches (as this is intended for use
		within our TAP service, where users  can do the crossmatches themselves).
		Also, some obviously buggy columns (e.g., footprint_flag) were dropped.
		
		Note that columns with names ending in _k originate from the
		stellar parameters pipeline,
		those with names ending in _c come from the chemical pipeline.
		Columns ending in _n_k indicate calibrated
		values.
		</meta>

		<index columns="rv"/>
		<index columns="Jmag"/>
		<index columns="Hmag"/>
		<index columns="snr_k"/>

		<stc>Position ICRS SPHER3 "raj2000" "dej2000" "dist_binney"
		</stc>

		<column name="rave_obs_id" type="text"
			ucd="meta.id;meta.main"
			tablehead="RAVE UID"
			description="Unique Identifier for RAVE objects: Observation Date,
				Fieldname, Fibernumber"
			verbLevel="1"/>
		<column name="raveid" type="text"
			ucd="meta.id"
			tablehead="RAVE-ID"
			description="Main RAVE identifier"
			verbLevel="1"/>

		<FEED source="commoncolumns"/>

		<column name="stddev_rv"
			unit="km/s" ucd="stat.stdev;spect.dopplerVeloc;pos.heliocentric"
			tablehead="σ_HRV"
			description="Standard deviation in HRV from 10 resampled spectra"
			verbLevel="25"/>
		<column name="mad_rv"
			unit="km/s" ucd="stat.fit.residual;spect.dopplerVeloc;pos.heliocentric;stat.median"
			tablehead="Median A.D. HRV"
			description="Median absolute deviation in HRV from 10 resampled spectra"
			verbLevel="25"/>

		<column name="stddev_teff_k"
			unit="K" ucd="stat.stdev;phys.temperature.effective"
			tablehead="σ_Teff"
			description="Standard deviation in Teff_K from 10 resampled spectra"
			verbLevel="25"/>
		<column name="mad_teff_k"
			unit="K" ucd="stat.fit.residual;phys.temperature.effective;stat.median"
			tablehead="Median A.D. Teff"
			description="Median absolute deviation in Teff_K from 10
				resampled spectra"
			verbLevel="25"/>

		<column name="stddev_logg_k"
			unit="" ucd="stat.stdev;phys.gravity"
			tablehead="σ_logg"
			description="Standard deviation in Teff_K from 10 resampled spectra"
			verbLevel="25"/>
		<column name="mad_logg_k"
			unit="" ucd="stat.fit.residual;phys.gravity;stat.median"
			tablehead="Median A.D. logg"
			description="Median absolute deviation in surface gravity (logg_K)
				from 10 resampled spectra"
			verbLevel="25"/>

		<column name="stddev_met_k"
			ucd="stat.stdev;phys.abund.Z"
			tablehead="σ_logg"
			description="Standard deviation in metallicity from 10 resampled spectra"
			verbLevel="25"/>
		<column name="mad_logg_k"
			ucd="stat.fit.residual;phys.abund.Z;stat.median"
			tablehead="Median A.D. logg"
			description="Median absolute deviation in metallicity from 10
				resampled spectra"
			verbLevel="25"/>
	
		<column name="chisq_k"
			ucd="stat.fit.chi2"
			tablehead="χ²(stellar)"
			description="χ² of the Stellar Parameter Pipeline"
			verbLevel="15"/>
		<column name="teff_ir"
			unit="K" ucd="phys.temperature.effective"
			tablehead="Teff(IR)"
			description="Effective temperature from infrared flux method"
			verbLevel="22"/>
		<column name="e_teff_ir"
			unit="K" ucd="stat.error;phys.temperature.effective"
			tablehead="Err. Teff(IR)"
			description="Error in the effective temperature from infrared flux method"
			verbLevel="27"/>
		<column name="ir_direct" type="text"
			ucd="meta.code"
			tablehead="IR Temp Src"
			description="Infrared temperature method: IRFM -- Temperature derived
				from infrared flux method; CTRL -- Temperature computed via
				color-Teff relations; NO -- No temperature derivation possible"
			verbLevel="25"/>

		<column name="alpha_c"
			ucd="phys.abund"
			tablehead="Alpha enr."
			description="Alpha-enhancement from chemical pipeline
				(log solar ratio; 'dex')"
			verbLevel="15"/>
		<column name="frac_c"
			ucd="stat.value"
			tablehead="Frac. chem."
			description="Fraction of spectrum used for calculation of abundances"
			verbLevel="25"/>
		<column name="av_schlegel"
			unit="mag" ucd="phys.absorption"
			tablehead="Ext."
			description="Total Extinction in V-band from 1998ApJ...500..525S"
			verbLevel="15"/>

		<column name="n_gauss_fit" type="smallint"
			ucd="meta.number"
			tablehead="#Gauss dist."
			description="Number of components required for multi-Gaussian
				distance modulus fit."
			verbLevel="25">
			<values nullLiteral="0"/>
		</column>
		<LOOP listItems="1 2 3">
			<events>
				<column name="gauss_mean_\item"
					ucd="stat.fit.param"
					tablehead="Gauss \item µ"
					description="Gaussian number \item in the estimated PDF of
						the object distance, expectation."
					verbLevel="29"/>
				<column name="gauss_mean_\item"
					ucd="stat.fit.param"
					tablehead="Gauss \item σ"
					description="Gaussian number \item in the estimated PDF of
						the object distance, width."
					verbLevel="29"/>
				<column name="gauss_frac_\item"
					ucd="stat.fit.param"
					tablehead="Gauss \item weight"
					description="Gaussian number \item in the estimated PDF of
						the object distance, weight."
					verbLevel="29"/>
			</events>
		</LOOP>

		<column name="rep_flag" type="boolean" required="True"
			ucd="meta.code.qual"
			tablehead="Repeat?"
			description="True if the object was observed multiple times"
			verbLevel="25"/>
		<column name="cluster_flag" type="boolean" required="True"
			ucd="meta.code.qual"
			tablehead="Cluster?"
			description="True if this was a targeted cluster observation"
			verbLevel="25"/>
		<column name="id_tgas" type="bigint"
			ucd="meta.id.cross"
			tablehead="TGAS #"
			description="TGAS target designation"
			verbLevel="15">
			<values nullLiteral="-1"/>
		</column>
		<column name="id_tgas" type="bigint"
			ucd="meta.id.cross"
			tablehead="TGAS #"
			description="TGAS target designation"
			verbLevel="15">
			<values nullLiteral="-1"/>
		</column>
	</table>

	<coverage>
		<updater sourceTable="main" mocOrder="4"/>
		<temporal>52741 56386</temporal>
		<spatial>0/8,11 1/16,24,42-43 2/68,72,80,82,88,100,104,113,120,144,146,149,151-152,154,156-157,159-160,162,165 3/7,276-278,280-282,292-294,296,324-326,332,335,340,356,360-362,367,404,406,408,410,420-422,424-426,448,450-451,458,464-465,468-469,484-485,488-490,580-582,588,590,592-593,595,601-603,612,614,620,622,632-633,635,644-645,656-657,659,667,670-671 4/0-1,27,256,265,267-268,270,282,285,292-293,295,514,552,576,776,809,814,1116-1118,1136,1180-1181,1188-1190,1192-1194,1196,1207-1209,1216,1308,1310,1332,1334-1335,1338,1344-1345,1347-1349,1351,1357,1365,1368,1370,1374,1377,1379,1382,1386,1428-1430,1432-1434,1436,1452,1454,1456,1460,1463,1506,1512,1620-1622,1636-1638,1648,1653-1654,1659,1692,1708,1710,1728,1796-1798,1825,1829,1838-1841,1844,1850-1851,1854,1864-1865,1868-1870,1880-1881,1887-1888,1890,1893,1908,1944-1946,1964-1965,1968,1976,1992,2332-2334,2356,2358,2364,2376-2377,2379,2401-2403,2455,2463,2485-2487,2492-2494,2536-2537,2539,2584-2586,2588-2589,2591,2610,2618-2619,2621-2623,2632,2635,2656-2657,2660,2664,2666-2667</spatial>
	</coverage>

	<table id="dr4" onDisk="True" adql="True" primary="name"
			mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description">The RAVE object catalog, data release 4.
		
		Note that columns with names ending in _k originate from the
		stellar parameters pipeline,
		those with names ending in _c come from the chemical pipeline,
		those with name ending in _sparv come from the
		radial velocity pipeline.  Names ending in _n_k indicate
		calibrated values.</meta>

		<index columns="rv"/>
		<index columns="Jmag"/>
		<index columns="snr_k"/>

		<stc>Position ICRS SPHER3 "raj2000" "dej2000" "dist_binney"
		</stc>

		<column name="name"
			type="text"
			ucd="meta.id;meta.main"
			tablehead="Name"
			description="Target designation"
			/>
		<column name="altname"
			type="text"
			ucd="meta.id"
			tablehead="Alt.Name"
			description="RAVE target designation"
			/>

		<FEED source="commoncolumns"/>

		<column name="correlation_coeff"
			type="real"
			ucd="stat.fit.param"
			tablehead="Tonry-Davis"
			description="Tonry &amp; Davis R correlation coefficient"
			/>
		<column name="peak_height"
			ucd="stat.correlation"
			tablehead="Corr.Peak height"
			description="Height of the correlation peak."
			verbLevel="23"
			/>
		<column name="peak_width"
			ucd="stat.correlation"
			tablehead="Corr.Peak width"
			description="Width of the correlation peak."
			verbLevel="23"
			/>
		<column name="skyhrv"
			unit="km/s"
			ucd="spect.dopplerVeloc;obs.field;pos.heliocentric"
			tablehead="HRV(sky)"
			description="Measured heliocentry radial velocity of the sky."
			verbLevel="21"
			/>
		<column name="e_skyhrv"
			unit="km/s"
			ucd="stat.error;spect.dopplerVeloc;obs.field;pos.heliocentric"
			tablehead="Err. HRV(sky)"
			description="Error in the measured heliocentric velocity of the sky."
			verbLevel="21"
			/>
		<column name="tdccsky"
			ucd="stat.fit.param"
			tablehead="Tonry-Davis(sky)"
			description="Tonry &amp; Davis R Sky correlation coefficient."
			verbLevel="25"
			/>
		<column name="correction_rv"
			type="real"
			unit="km/s"
			ucd="arith.zp"
			tablehead="ZP appl."
			description="Zero point correction applied to the radial velocity
				solutions (see 2011AJ....141..187S)."
			verbLevel="19"
			/>
		<column name="zeropoint_flag"
			type="text"
			ucd="meta.code"
			tablehead="ZP Flag"
			description="Quality flag for Zero point correction"
			verbLevel="29"
			note="3"
			/>
		<column name="teff_sparv"
			type="real"
			unit="K"
			ucd="phys.temperature.effective"
			tablehead="Teff(RV)"
			description="Effective temperature as determined by the radial
				velocity pipeline."
			/>
		<column name="logg_sparv"
			type="real"
			ucd="phys.gravity"
			tablehead="logg(RV)"
			description="Log gravity as determined by the radial velocity pipeline."
			/>
		<column name="alpha_sparv"
			type="real"
			ucd="phys.abund.Z"
			tablehead="alpha(RV)"
			description="Metallicity as determined by the radial velocity pipeline."
			/>
		<column name="age"
			unit="log(a)"
			ucd="time.age"
			tablehead="age"
			description="Logarithm of age (from 2014MNRAS.437..351B)"
			/>
		<column name="e_age"
			unit="log(a)"
			ucd="stat.error;time.age"
			tablehead="e_age"
			description="Error in Age (from 2014MNRAS.437..351B)"
			/>
		<column name="mass"
			unit="solMass"
			ucd="phys.mass"
			tablehead="mass"
			description="Mass (from 2014MNRAS.437..351B)"
			/>
		<column name="e_mass"
			unit="solMass"
			ucd="stat.error;phys.mass"
			tablehead="e_mass"
			description="Error Mass (from 2014MNRAS.437..351B)"
			/>

		<meta name="note" tag="3">
			Flag value of the form FGSH, F being for the entire plate, G for the 50
			fibers group to which the fiber belongs. S flags the zero-point
			correction used: C for cubic and S for a constant shift. If H is
			set to * the fiber is close to a 15 fiber gap. For F and G the
			values can be * A, B, C, D, or E, meaning:

			=== ==============================================
			 A  dispersion around correction lower than 1 km/s
			 B  dispersion between 1 and 2 km/s
			 C  dispersion between 2 and 3 km/s
			 D  dispersion larger than 3 km/s
			 E  less than 15 fibers available for the fit
			=== ==============================================
		</meta>

	</table>

	<table id="dr3" onDisk="True" adql="True" mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description" format="rst"><![CDATA[
			The third data release of RAVE contains spectroscopic radial velocities
			for 83072 stars in the Milky-Way southern hemisphere using the 6dF
			instrument at the AAO.

			This data collection has been superceded by RAVE data release 4
			(`table rave.dr </__system__/dc_tables/show/tableinfo/rave.main>`_
			in the data center).

			Columns in the data release that resulted from crossmatching were
			left out.

			For details, see 2011AJ....141..187S.
		]]></meta>

		<stc>
			Position ICRS SPHER3 "raj2000" "dej2000" -1
				VelocityInterval Velocity "pmra" "pmde" "rv"
					Error "e_pmra" "e_pmde" "e_rv"
		</stc>
		<stc>
			Position GALACTIC "glon" "glat"
		</stc>
		<column name="name" type="text"
			ucd="meta.id;meta.main"
			tablehead="Name"
			description="Target designation"
			verbLevel="1" />
		<column name="altname" type="text"
			ucd="meta.id"
			tablehead="Alt. Name"
			description="Target alternative designation"
			verbLevel="25" />
		<column name="raj2000" type="double precision"
			unit="deg" ucd="pos.eq.ra;meta.main"
			tablehead="RA"
			description="Right ascension (J2000.0)"
			verbLevel="1"/>
		<column name="dej2000" type="double precision"
			ucd="pos.eq.dec;meta.main"
			tablehead="Dec" unit="deg"
			description="Declination (J2000.0)"
			verbLevel="1"/>
		<column name="glon"
			unit="deg" ucd="pos.galactic.lon"
			tablehead="l"
			description="Galactic longitude"
			verbLevel="25"/>
		<column name="glat"
			unit="deg" ucd="pos.galactic.lat"
			tablehead="b"
			description="Galactic latitude"
			verbLevel="25"/>
		<column name="rv"
			ucd="spect.dopplerVeloc;pos.heliocentric" unit="km/s"
			tablehead="RV"
			description="Heliocentric radial velocity"
			verbLevel="1"/>
		<column name="e_rv"
			ucd="stat.error;spect.dopplerVeloc;pos.heliocentric" unit="km/s"
			tablehead="Err(RV)"
			description="Error in heliocentric radial velocity"
			verbLevel="5"/>
		<column name="pmra"
			unit="deg/yr" ucd="pos.pm;pos.eq.ra"
			description="Proper motion in RA"
			tablehead="PM(RA)"
			verbLevel="15"/>
		<column name="e_pmra"
			unit="deg/yr" ucd="stat.error;pos.pm;pos.eq.ra"
			description="Error in proper motion in RA"
			tablehead="Err. PM(RA)"
			verbLevel="15"/>
		<column name="pmde"
			unit="deg/yr" ucd="pos.pm;pos.eq.dec"
			description="Proper motion in Declination"
			tablehead="PM(Dec)"
			verbLevel="15"/>
		<column name="e_pmde"
			unit="deg/yr" ucd="stat.error;pos.pm;pos.eq.dec"
			description="Error in proper motion in Declination"
			tablehead="Err. PM(Dec)"
			verbLevel="15"/>
		<column name="pmsrc" type="smallint"
			ucd="meta.ref;pos.pm;pos.eq.dec"
			tablehead="Src (PM)"
			description="Source of proper motion (see note)"
			note="PM" verbLevel="29">
			<values nullLiteral="-1"/>
		</column>
		<column name="imag"
			ucd="phot.mag;em.opt.I" unit="mag"
			description="Input catalog I magnitude"
			tablehead="Mag(I)"
			verbLevel="19"/>
		<column name="obsDate" type="date"
			unit="yr" ucd="time.epoch;obs"
			description="Date of observation"
			tablehead="Obs. date"
			verbLevel="15"/>
		<column name="field" type="text"
			ucd="meta.id;obs.field"
			description="Name of RAVE field"
			tablehead="Field"
			verbLevel="20"/>
		<column name="plate" type="smallint" required="True"
			ucd="meta.id;obs.field"
			description="Plate number used"
			tablehead="Plate"
			verbLevel="22"/>
		<column name="fiber" type="smallint" required="True"
			ucd="meta.id"
			description="Fiber number"
			tablehead="Fiber"
			verbLevel="22"/>
		<column  name="teff" type="integer"
			unit="K" ucd="phys.temperature.effective"
			description="Effective Temperature"
			tablehead="T_eff"
			verbLevel="12">
			<values nullLiteral="-1"/>
		</column>
		<column name="logg"
			unit="" ucd="phys.gravity"
			description="Gravity"
			tablehead="log(g)"
			verbLevel="12"/>
		<column name="met"
			unit="" ucd="phys.abund.Fe"
			description="Metallicity [m/H]"
			tablehead="m/H"
			verbLevel="12"/>
		<column name="alpha"
			unit="" ucd="phys.abund"
			description="alpha enhancement [{alpha}/Fe]"
			tablehead="alpha/Fe"
			verbLevel="22"/>
		<column name="chi2" type="double precision"
			ucd="stat.fit.chi2"
			description="Chi square of continuum fit"
			tablehead="Chi^2"
			verbLevel="19"/>
		<column name="snr2"
			ucd="stat.snr"
			description="DR2 signal to noise ratio"
			tablehead="SNR(DR2)"
			verbLevel="19"/>
		<column name="snr"
			ucd="stat.snr"
			description="Pre-flux calibration signal to noise"
			tablehead="SNR"
			verbLevel="19"/>
		<column name="tdcc"
			ucd="stat.fit.param"
			description="Tonry-Davis R correlation coefficient"
			tablehead="Tonry-Davis"
			verbLevel="19"/>
		<column name="hcp"
			ucd="stat.correlation"
			description="Height of correlation peak"
			tablehead="Corr. Peak height" verbLevel="23"/>
		<column name="wcp"
			unit="km/s" ucd="stat.correlation"
			description="Width of correlation peak"
			tablehead="Corr. Peak width"
			verbLevel="23"/>
		<column name="zeropoint"
			unit="km/s" ucd="arith.zp"
			description="Zero point correction applied"
			tablehead="Zero point" verbLevel="19"/>
		<column name="hrvsky"
			unit="km/s" ucd="spect.dopplerVeloc;obs.field;pos.heliocentric"
			description="Measured heliocentric radial velocity of sky"
			tablehead="HRV(sky)"
			verbLevel="21"/>
		<column name="e_hrvsky"
			unit="km/s" ucd="stat.error"
			description="Error HRV of sky"
			tablehead="Err. HRV(sky)"
			verbLevel="21"/>
		<column name="tdccsky"
			ucd="stat.fit.param"
			description="Sky Tonry-Davis correlation coefficient"
			tablehead="Tonry-Davis(sky)"
			verbLevel="25"/>
		<column name="snrspec"
			ucd="stat.snr"
			description="Spectrum signal to noise ratio"
			tablehead="SNR(spectrum)" verbLevel="20"/>
		<column name="zp1" type="text"
			ucd="meta.code"
			tablehead="ZP flag"
			description="Entire plate zero point correction flag (see note)"
			note="ZP" verbLevel="21"/>
		<column name="qual" type="text"
			ucd="meta.code.qual"
			tablehead="Sp. Qual"
			description="Spectrum quality flag (see note)"
			note="SQ" verbLevel="20"/>
		<column name="maskflag"
			ucd="meta.code.qual"
			tablehead="MASK Flag"
			description="Fraction of spectrum unaffected by continuum problems
			(see note)"
			note="M" verbLevel="20"/>
			
		<meta name="note" tag="PM">
			Source of proper motion

			=== ==============
			 0   no PM
			 1   Tycho-2
			 2   Supercosmos
			 3   PPMX
			 4   GSC1.2x2MASS
			 5   UCAC-2
			 6   USNO-B"
			=== ==============
		</meta>

		<meta name="note" tag="ZP">
			Flag value of the form FGSH, F being for the entire plate, G for the 50
			fibers group to which the fiber belongs. S flags the zero-point
			correction used: C for cubic and S for a constant shift. If H is
			set to * the fiber is close to a 15 fiber gap. For F and G the
			values can be * A, B, C, D, or E, meaning:

			=== =============================================
			 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 fibers available for the fit
			=== =============================================
		</meta>

		<meta name="note" tag="SQ">
			qual identifies possible problems in the spectrum (values can be
			combined) as follows:

			===  ========================================
			 a   asymmetric Ca lines
			 c   cosmic ray pollution
			 e   emission line spectrum
			 n   noise dominated spectrum
			 l   no lines visible
			 w   weak lines
			 g   strong ghost
			 t   bad template fit
			 s   strong residual sky emission
			cc   bad continuum
			 r   red part of the spectrum shows problem
			 b   blue part of the spectrum shows problem
			 p   possible binary/doubled lined
			 x   peculiar object
			===  ========================================
		</meta>

		<meta name="note" tag="M">
			The maskflag column identifies the fraction of the spectrum
			unaffected by continuum problems from the MASK program. Spectra
			with maskflags lower than 0.70 must be used with caution.
		</meta>
	</table>

	<table id="dr2" onDisk="True" adql="True" mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description" format="rst"><![CDATA[
			The second data release of RAVE contains spectroscopic radial velocities
			for 49327 stars in the Milky-Way southern hemisphere using the 6dF
			instrument at the AAO. Stellar parameters are published for a set of 21121
			stars belonging to the second year of observation.

			This data collection has been superceded by RAVE data release 3
			(`table rave.dr </__system__/dc_tables/show/tableinfo/rave.dr3>`_
			in the data center).

			The data published here comprises all original RAVE data.	Columns
			in the data release that resulted from crossmatching were left out.

			For details, see 2008MNRAS.391..793S.
		]]></meta>

		<meta name="title">Data Release 2</meta>

		<stc>
			Position ICRS SPHER3 "raj2000" "dej2000" -1
		</stc>
		<stc>
			Position GALACTIC "glon" "glat"
		</stc>

		<column description="Target designation" name="name" tablehead="Name"
			type="text" ucd="meta.id;meta.main" verbLevel="1"/>
		<column description="Target alternative designation" name="altname"
			tablehead="Alt. Name" type="text" ucd="meta.id" verbLevel="25"/>
		<column name="raj2000" type="double precision" tablehead="RA"
			description="Right ascension (J2000.0)" ucd="pos.eq.ra;meta.main"
			verbLevel="1" unit="deg"/>
		<column name="dej2000" type="double precision" tablehead="Dec"
			description="Declination (J2000.0)" ucd="pos.eq.dec;meta.main"
			verbLevel="1" unit="deg"/>
		<column name="glon" tablehead="l"
			description="Galactic longitude" ucd="pos.galactic.lon"
			verbLevel="25" unit="deg"/>
		<column name="glat" tablehead="b"
			description="Galactic latitude" ucd="pos.galactic.lat"
			verbLevel="25" unit="deg"/>
		<column description="Heliocentric radial velocity" name="rv"
			tablehead="RV" ucd="spect.dopplerVeloc;pos.heliocentric" unit="km/s"
			verbLevel="1"/>
		<column description="HRV error" name="e_rv" tablehead="Err(RV)"
			ucd="stat.error" unit="km/s" verbLevel="5"/>
		<column description="Proper motion in RA" name="pmra" tablehead="PM(RA)"
			ucd="pos.pm;pos.eq.ra" unit="mas/yr" verbLevel="15"/>
		<column description="Error in proper motion in RA" name="e_pmra"
			tablehead="Err. PM(RA)" ucd="stat.error;pos.pm;pos.eq.ra"
			unit="mas/yr" verbLevel="15"/>
		<column description="Proper motion in Declination" name="pmde"
			tablehead="PM(Dec)" ucd="pos.pm;pos.eq.dec" unit="mas/yr"
			verbLevel="15"/>
		<column description="Error in proper motion in Declination"
			name="e_pmde" tablehead="Err. PM(Dec)"
			ucd="stat.error;pos.pm;pos.eq.dec" unit="mas/yr" verbLevel="15"/>
		<column description="Source of proper motion (0 - no PM; 1 - Tycho-2;
			2 - Supercosmos; 3 - STARNET 2.0; 4 - GSC1.2x2MASS; 5 - UCAC-2)"
			name="pmsrc"
			tablehead="Src (PM)" type="smallint" ucd="meta.ref;pos.pm;pos.eq.dec"
			verbLevel="29">
			<values nullLiteral="-1"/>
		</column>
		<column description="Input catalog I magnitude" name="imag"
			tablehead="Mag(I)" ucd="phot.mag;em.opt.I" unit="mag"
			verbLevel="19"/>
		<column description="Date of observation" name="obsDate"
			unit="d" ucd="time.epoch;obs"
			tablehead="Obs. date" type="date"
			verbLevel="15" displayHint="type=humanDate"/>
		<column description="Name of RAVE field" name="field" tablehead="Field"
			type="text" ucd="meta.id;obs.field" verbLevel="20"/>
		<column description="Plate number used" name="Plate" tablehead="Plate"
			type="smallint" ucd="meta.id;instr.param" verbLevel="22" required="True"/>
		<column description="Fiber number" name="fiber" tablehead="Fiber"
			type="smallint" ucd="meta.id" verbLevel="22" required="True"/>
		<column description="Effective Temperature" name="teff"
			tablehead="T_eff" type="integer" ucd="phys.temperature.effective"
			unit="K" verbLevel="12">
			<values nullLiteral="-1"/>
		</column>
		<column description="Gravity" name="logg" tablehead="log(g)"
			ucd="phys.gravity" verbLevel="12"/>
		<column description="Uncalibrated [M/H]" name="m_h_uncal"
			tablehead="M/H uncal." ucd="phys.abund.Fe" verbLevel="22"/>
		<column description="alpha enhancement [{alpha}/Fe]" name="alfa_Fe"
			tablehead="{alpha}/Fe" ucd="phys.abund" verbLevel="22"/>
		<column description="Calibrated [M/H], Sun=1" name="m_h"
			tablehead="[M/H]/Sun cal."
			ucd="phys.abund.Fe" unit="" verbLevel="12"/>
		<column description="chi square" name="chi2" tablehead="Chi^2"
			type="double precision" ucd="stat.fit.chi2" verbLevel="19"/>
		<column description="Corrected signal to noise" name="snr"
			tablehead="SNR" ucd="stat.snr" verbLevel="19"/>
		<column description="Tonry-Davis correlation coefficient" name="tdcc"
			tablehead="Tonry-Davis" ucd="stat.fit.param" verbLevel="19"/>
		<column description="Height of correlation peak" name="hcp"
			tablehead="Corr. Peak height" ucd="stat.correlation" verbLevel="23"/>
		<column description="Width of correlation peak" name="wcp"
			tablehead="Corr. Peak width" ucd="stat.correlation" unit="km/s"
			verbLevel="23"/>
		<column description="Zero point correction applied" name="zeropoint"
			tablehead="Zero point" ucd="arith.zp" unit="km/s" verbLevel="19"/>
		<column description="Measured heliocentric radial velocity of sky"
			name="hrvsky" tablehead="HRV(sky)"
			ucd="spect.dopplerVeloc;obs.field;pos.heliocentric" unit="km/s"
			verbLevel="21"/>
		<column description="Error HRV of sky" name="e_hrvsky"
			tablehead="Err. HRV(sky)" ucd="stat.error" unit="km/s"
			verbLevel="21"/>
		<column description="Sky Tonry-Davis correlation coefficient"
			name="tdccsky" tablehead="Tonry-Davis(sky)" ucd="stat.fit.param"
			verbLevel="25"/>
		<column description="Spectra signal to noise ratio" name="snrspec"
			tablehead="SNR(spectrum)" ucd="stat.snr" verbLevel="20">
		</column>
		<column name="zp1" tablehead="ZP flag" type="char" ucd="meta.code"
			verbLevel="21"
			description="Entire plate zero point correction flag [dispersion around correction &lt;1 (A), 1..2 (B), 2..3 (C), &gt;3 km/s (D); E - less than 15 fibers available.]">
			<values nullLiteral=" "/>
		</column>
		<column description="50 fibers group to which the fiber belongs zero point
			correction flag"
			name="zp2" tablehead="ZP2" type="char" ucd="meta.code" verbLevel="29">
			<values nullLiteral=" "/>
		</column>
		<column name="gapwarning" type="boolean" required="True"
			description="Fiber is close to a 15 fibers gap"
			tablehead="Gap warning" ucd="meta.code" verbLevel="20"/>
		<column tablehead="Sp. Qual" type="text" ucd="meta.code.qual"
			verbLevel="20" name="qual"
			description="Spectra quality flag [a - asymmetric Ca lines; c - cosmic ray pollution; e - emission line spectra; n - noise dominated spectra; l - no lines visible; w - weak lines; g - strong ghost; t - bad template fit; s - strong residual sky emission; cc - bad continuum; r - red part of the spectra shows problem; b - blue part of the spectra shows problem; p - possible binary/doubled lined; x - peculiar object;]"/>
	</table>

	<data id="import_dr2" auto="False">
		<sources pattern="data/rave_dr2.dat"/>

		<columnGrammar>
			<col key="name">	 1- 16 </col>
			<col key="altname">	18- 33 </col>
			<col key="raj2000">	35- 46 </col>
			<col key="dej2000">	48- 59 </col>
			<col key="glon">	61- 69 </col>
			<col key="glat">	71- 79 </col>
			<col key="rv">	81- 87 </col>
			<col key="e_rv">	89- 94</col>
			<col key="pmra">	96-101 </col>
			<col key="e_pmra"> 103-108</col>
			<col key="pmde"> 110-115 </col>
			<col key="e_pmde"> 117-122</col>
			<col key="pmsrc">		 124</col>
			<col key="imag"> 126-130 </col>
			<col key="obsDate"> 132-139 </col>
			<col key="field"> 141-150 </col>
			<col key="Plate">		 152 </col>
			<col key="fiber"> 154-156 </col>
			<col key="teff"> 158-162 </col>
			<col key="logg"> 164-167 </col>
			<col key="m_h_uncal"> 169-173 </col>
			<col key="alfa_Fe"> 175-178 </col>
			<col key="m_h"> 180-184 </col>
			<col key="chi2"> 186-193 </col>
			<col key="snr"> 195-199 </col>
			<col key="tdcc"> 201-205 </col>
			<col key="hcp"> 207-210 </col>
			<col key="wcp"> 212-217 </col>
			<col key="zeropoint"> 219-224 </col>
			<col key="hrvsky"> 226-231 </col>
			<col key="e_hrvsky">233-238</col>
			<col key="tdccsky"> 240-244 </col>
			<col key="snrspec"> 246-250 </col>
			<col key="zp1">		 465 </col>
			<col key="zp2">		 466 </col>
			<col key="gapwarning">		 467 </col>
			<col key="qual"> 469-472 </col>
		</columnGrammar>
		<make table="dr2">
			<rowmaker id="make_main2" idmaps="*">
				<map dest="obsDate">parseDate(@obsDate, "%Y%m%d")</map>
				<map dest="gapwarning">@gapwarning=="*"</map>
				<map dest="pmra">scale(
						parseWithNull(@pmra, parseFloat, nullLiteral="9999.9"),
					DEG_MAS)</map>
				<map dest="pmde">scale(
						parseWithNull(@pmde, parseFloat, nullLiteral="9999.9"),
					DEG_MAS)</map>
				<map dest="e_pmra">scale(
						parseWithNull(@e_pmra, parseFloat, nullLiteral="9999.9"),
					DEG_MAS)</map>
				<map dest="e_pmde">scale(
						parseWithNull(@e_pmde, parseFloat, nullLiteral="9999.9"),
					DEG_MAS)</map>

			</rowmaker>
		</make>
	</data>

	<data id="import_dr3" auto="False">
		<sources pattern="data/RAVE_DR3AB.csv.gz"/>
		<csvGrammar gunzip="True" />
		<make table="dr3">
			<rowmaker id="make_main3">
				<map dest="obsDate">parseDate(@Obsdate, "%Y%m%d")</map>
				<map dest="pmra">scale(parseFloat(@pmRA), DEG_MAS)</map>
				<map dest="pmde">scale(parseFloat(@pmDE), DEG_MAS)</map>
				<map dest="e_pmra">scale(parseFloat(@epmRA), DEG_MAS)</map>
				<map dest="e_pmde">scale(parseFloat(@epmDE), DEG_MAS)</map>

				<simplemaps>
					name:Name,
					altname:RAVEID,
					raj2000:RAdeg,
					dej2000:DEdeg,
					glon:Glon,
					glat:Glat,
					rv:HRV,
					e_rv:eHRV,
					pmsrc:Spm,
					imag:Imag,
					field:FieldName,
					plate:PlateNumber,
					fiber:FiberNumber,
					teff:Teff,
					logg:logg,
					met:Met,
					alpha:alpha,
					chi2:CHISQ,
					snr2:S2N,
					snr:STN,
					tdcc:CorrelationCoeff,
					hcp:PeakHeight,
					wcp:PeakWidth,
					zeropoint:CorrectionRV,
					hrvsky:SkyRV,
					e_hrvsky:SkyeRV,
					tdccsky:SkyCorrelation,
					snrspec:SNRatio,
					zp1:ZeroPointFLAG,
					qual:SpectraFLAG,
					maskflag:MaskFLAG
				</simplemaps>
			</rowmaker>
		</make>
	</data>

	<data id="import_dr4">
		<sources>data/dr4/RAVE_DR4.csv.gz</sources>
		<csvGrammar gunzip="True" topIgnoredLines="1">
			<names>name, altname, raj2000, dej2000, glon, glat, rv, e_rv,
			correlation_coeff,
			peak_height, peak_width, correction_rv, skyhrv, e_skyhrv, tdccsky,
			zeropoint_flag, stn_sparv,
			id_tycho2, ignore, ignore, ignore, ignore, ignore, ignore,
			ignore, ignore, ignore, ignore, ignore, ignore, ignore,
			ignore, ignore, ignore, ignore, ignore, ignore, ignore,
			id_ucac4, ignore, ignore, ignore, ignore, ignore, ignore,
			id_ppmxl, ignore, ignore, ignore, ignore, ignore, ignore,
			obsdate, field_name, plate_number, fiber_number,
			teff_k, e_teff_k, logg_k, e_logg_k, met_k, met_n_k, e_met_k,
			snr_k, algo_conv_k,
			al, al_n, si, si_n, fe, fe_n, ti, ti_n, ni, ni_n, mg, mg_n,
			chisq_c,
			teff_sparv, logg_sparv, alpha_sparv,
			id_2mass, ignore, ignore, Jmag, e_Jmag, Hmag,   e_Hmag, Kmag, e_Kmag,
			id_denis, ignore, ignore, ignore, ignore, ignore, ignore, ignore, ignore,
			id_usnob1, ignore, ignore, ignore, ignore, ignore, ignore, ignore,
			parallax, e_parallax, dist_binney, e_dist,
			distance_modulus, e_distance_modulus,
			log_av, e_log_av, age, e_age, mass, e_mass,
			c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20
			</names>
		</csvGrammar>

		<make table="dr4">
			<rowmaker idmaps="*">
				<LOOP listItems="plate_number fiber_number
						al_n si_n fe_n ti_n ni_n mg_n ">
					<events>
						<var key="\item">parseWithNull(@\item, int, r"\\\N")</var>
					</events>
				</LOOP>
				<LOOP listItems="rv e_rv correlation_coeff peak_height peak_width
						skyhrv e_skyhrv tdccsky
						teff_k e_teff_k logg_k e_logg_k met_k met_n_k e_met_k snr_k
						algo_conv_k al si fe ti ni mg chisq_c teff_sparv logg_sparv
						alpha_sparv parallax e_dist distance_modulus
						e_distance_modulus log_av e_log_av age e_age mass e_mass
						dist_binney parallax e_parallax
						Jmag e_Jmag Hmag e_Hmag Kmag e_Kmag">
					<events>
						<var key="\item">parseWithNull(@\item, float, r"\\\N")</var>
					</events>
				</LOOP>
				<LOOP listItems="name altname zeropoint_flag id_tycho2 id_ucac4
						field_name id_2mass id_denis id_usnob1 id_ppmxl">
					<events>
						<var key="\item">parseWithNull(@\item.strip(), str, r"\\\N")</var>
					</events>
				</LOOP>
				<map key="obsdate">dateTimeToMJD(parseDate(@obsdate, "%Y%m%d"))</map>
				<map key="min_dists">"".join(c or " "
					for c in (@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8, @c9, @c10, @c11,
						@c12, @c13, @c14, @c15, @c16, @c17, @c18, @c19, @c20))
				</map>
			</rowmaker>
		</make>
	</data>

	<data id="import">
		<sources pattern="datadr5/RAVE_DR5.csv.gz"/>
		<csvGrammar preFilter="zcat" topIgnoredLines="1">
			<!-- upstream's column names are a pain.  We ignore them
			and make our own -->
			<names>rave_obs_id, healpix, raveid, raj2000, dej2000,
				glon,glat,rv,e_rv,
				stddev_rv,mad_rv,stn_sparv,snr_k,
				teff_k,teff_n_k,e_teff_k,mad_teff_k,stddev_teff_k,
				logg_k,logg_n_k,e_logg_k,mad_logg_k,stddev_logg_k,
				met_k,met_n_k,e_met_k,mad_met_k,stddev_met_k,chisq_k,
				algo_conv_k,
				teff_ir,e_teff_ir,ir_direct,
				mg,mg_n,al,al_n,si,si_n,ti,ti_n,fe,fe_n,ni,ni_n,
				alpha_c,chisq_c,frac_c,av_schlegel,
				dist_binney,e_dist,log_av,e_log_av,
				parallax,e_parallax,
				distance_modulus,e_distance_modulus,
				fit_flag_binney,fitquality_binney,
				n_gauss_fit,gauss_mean_1,gauss_sigma_1,gauss_frac_1,
				gauss_mean_2,gauss_sigma_2,gauss_frac_2,
				gauss_mean_3,gauss_sigma_3,gauss_frac_3,
				c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,
				rep_flag,cluster_flag,footprint_flag,id_tgas,matchflag_tgas,
				ra_tgas,de_tgas,pmra_tgas,pmra_error_tgas,pmde_tgas,pmde_error_tgas,
				parallax_tgas,parallax_error_tgas,
				phot_g_mean_mag_tgas,phot_g_mean_flux_tgas,
				phot_g_mean_flux_error_tgas,
				id_hipparcos,id_tycho2,dist_tycho2,matchflag_tycho2,
				btmag_tycho2,ebtmag_tycho2,vtmag_tycho2,evtmag_tycho2,
				pmra_tycho2,epmra_tycho2,pmde_tycho2,epmde_tycho2,
				id_ucac4,dist_ucac4,matchflag_ucac4,
				pmra_ucac4,epmra_ucac4,pmde_ucac4,epmde_ucac4,
				id_ppmxl,dist_ppmxl,matchflag_ppmxl,
				pmra_ppmxl,epmra_ppmxl,pmde_ppmxl,epmde_ppmxl,
				id_2mass,dist_2mass,matchflag_2mass,
				Jmag,e_Jmag,Hmag,e_Hmag,
				Kmag,e_Kmag,
				id_allwise,dist_allwise,matchflag_allwise,w1mag_allwise,
				ew1mag_allwise,w2mag_allwise,ew2mag_allwise,
				w3mag_allwise,ew3mag_allwise,w4mag_allwise,ew4mag_allwise,
				cc_flags_allwise,ext_flg_allwise,
				var_flg_allwise,ph_qual_allwise,
				dist_apassdr9,matchflag_apassdr9,bmag_apassdr9,ebmag_apassdr9,
				vmag_apassdr9,evmag_apassdr9,gpmag_apassdr9,egpmag_apassdr9,
				rpmag_apassdr9,erpmag_apassdr9,ipmag_apassdr9,eipmag_apassdr9,
				id_denis,dist_denis,matchflag_denis,imag_denis,eimag_denis,
				jmag_denis,ejmag_denis,kmag_denis,ekmag_denis,
				id_usnob1,dist_usnob1,matchflag_usnob1,b1mag_usnob1,
				r1mag_usnob1,b2mag_usnob1,r2mag_usnob1,imag_usnob1,
				pmra_usnob1,epmra_usnob1,pmde_usnob1,epmde_usnob1,
				obsdate,field_name,fiber_number,plate_number,mjd_obs,
				lst_start,lst_end,utc_start,utc_end</names>
		</csvGrammar>
		
		<make table="main">
			<rowmaker idmaps="*">
				<LOOP listItems="stn_sparv snr_k teff_k teff_n_k e_teff_k mad_teff_k
					stddev_teff_k logg_k logg_n_k e_logg_k mad_logg_k stddev_logg_k met_k
					met_n_k e_met_k mad_met_k stddev_met_k chisq_k algo_conv_k
					mg mg_n al al_n si si_n ti ti_n fe fe_n ni ni_n
					alpha_c chisq_c frac_c av_schlegel dist_binney e_dist log_av e_log_av
					parallax e_parallax distance_modulus e_distance_modulus
					fit_flag_binney fitquality_binney gauss_mean_1
					gauss_sigma_1 gauss_frac_1 gauss_mean_2 gauss_sigma_2 gauss_frac_2
					gauss_mean_3 gauss_sigma_3 gauss_frac_3 stddev_rv mad_rv
					Jmag e_Jmag Hmag e_Hmag Kmag e_Kmag
					">
					<events>
						<var key="\item">parseWithNull(@\item, float, r"NULL")</var>
					</events>
				</LOOP>

				<LOOP listItems="teff_ir e_teff_ir">
					<events>
						<var key="\item">parseWithNull(@\item, float, r"-9")</var>
					</events>
				</LOOP>

				<LOOP listItems="n_gauss_fit id_ppmxl id_tgas">
					<events>
						<var key="\item">parseWithNull(@\item, int, r"NULL")</var>
					</events>
				</LOOP>
				<LOOP listItems="id_2mass id_denis id_usnob1 id_tycho2 id_ucac4">
					<events>
						<var key="\item">parseWithNull(@\item, str, r"NULL")</var>
					</events>
				</LOOP>

				<map dest="obsdate">dateTimeToMJD(parseDate(@obsdate, "%Y%m%d"))</map>
				<map key="min_dists">"".join(c or " "
					for c in (@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8, @c9, @c10, @c11,
						@c12, @c13, @c14, @c15, @c16, @c17, @c18, @c19, @c20))
				</map>

			</rowmaker>
		</make>
	</data>

	<data id="data" auto="false">
		<!-- this is for publishing all rave DRs; add makes as appropriate -->
		<publish/>
		<make table="dr2"/>
		<make table="dr3"/>
		<make table="dr4"/>
		<make table="main"/>
	</data>

	<service id="cone" allowed="form,scs.xml">
		<meta name="shortName">rave_scs</meta>
		<meta name="title">RAVE DR5 Cone Search</meta>
		<publish render="form" sets="local,ivo_managed"/>
		<publish render="scs.xml" sets="ivo_managed"/>

		<scsCore id="conecore" queriedTable="main">
			<FEED source="//scs#coreDescs"/>
			<condDesc buildFrom="rv"/>
			<condDesc buildFrom="Jmag"/>
			<condDesc buildFrom="snr_k"/>
		</scsCore>

		<outputTable verbLevel="20"/>

		<meta name="testQuery.ra">324.94</meta>
		<meta name="testQuery.dec">-35.76</meta>
		<meta name="testQuery.sr">0.5</meta>
	</service>

	<regSuite title="RAVE cone search regression">
			<regTest title="RAVE cone search delivers plausible data">
				<url RA="9.172416" DEC="-40.74506"
					SR="0.002" VERB="3">cone/scs.xml</url>
				<code>
					row = self.getFirstVOTableRow(rejectExtras=False)
					self.assertEqual(row["id_denis"], 'J003641.3-404441')
					self.assertAlmostEqual(row["rv"], 16.364999771118164)
					self.assertEqual(row["obsdate"], 52887.0)
					self.assertEqual(row["id_ppmxl"], 1454951088173346604)
					self.assertEqual(row["min_dists"], 'nnnnnnnnnnnnnnnnnnnn')
					self.assertEqual(row["ti"], None)
				</code>
			</regTest>
	</regSuite>
</resource>
