<?xml version="1.0" encoding="utf-8"?>

<!-- angular resolution: 2009NuPhS.190...20B -->

<resource schema="auger">

	<!--
	!	===========================
	!	Description of the Data Set
	!	===========================
	!-->

	<meta name="title">Pierre Auger Observatory public data</meta>
	<meta name="creationDate">2013-03-22T14:04:52Z</meta>
	<meta name="schema-rank">1000</meta>
	<meta name="description" format="plain">This dataset comprises
		the public data observed by the Pierre Auger cosmic ray observatory,
		which is  1% of its total data. It contains
		28493 events between 0.1 and 49.7 EeV collected between 2004
		and 2013.</meta>
	<meta name="copyright">This data set has been provided by the Pierre
		Auger Collaboration. It is also available at
		http://auger.colostate.edu/ED/_data.php?dos=1.</meta>
	<meta name="creator">The Pierre Auger Collaboration</meta>

	<meta name="isContinuedBy" ivoId="ivo://org.gavo.dc/auger/q2/pub"
		>Auger public data, version 3</meta>
	<meta name="subject">cosmological-neutrinos</meta>
	<meta name="subject">particle-astrophysics</meta>

	<meta name="_longdoc" format="rst"><![CDATA[
		This data set contains 28493 high-energy cosmic ray events recorded
		by the Pierre Auger Telescope (Mendoza/Argentina) recorded since
		2004. The number of events in this sample corresponds to 1% of the
		total number of events.
		
		Details about this data set are documented at
		http://www.auger.org/education/GAP2012_137.pdf.

		Included are the event ID, the number of stations which participated
		in the event, the right ascension and the declination of the
		incident cosmic rays in degrees, the reconstructed energy of the
		event, the Modified Julian Day (MJD), and the galactic longitude
		and latitude.
		
		All public Auger events can also be browsed via a web interface at
		http://auger.colostate.edu/ED/.
	]]></meta>
	<meta name="content.type">Catalog</meta>

	<!--
	!	================
	!	Table Definition
	!	================
	!-->

	<table id="main" onDisk="True" adql="True">
		<meta name="description">
			Detection parameters of cosmic ray source candidates recorded
			by the Pierre Auger Telescope. This table can be queried on the
			web at http://dc.g-vo.org/auger/q/cone/form .
		</meta>

		<stc>
			Position GALACTIC "galLon" "galLat"
		</stc>
		<stc>
			Position ICRS "raj2000" "dej2000"
		</stc>

		<column name="eventId" type="text"
			required="True"
			ucd="meta.id;meta.main"
			tablehead="Event ID"
			description="Auger event number"
			verbLevel="1"/>
		<column name="raj2000"
			required="True"
			ucd="pos.eq.ra;meta.main"
			unit="deg"
			tablehead="RA"
			description="Incoming cosmic ray direction, RA"
			verbLevel="1"/>
		<column name="dej2000"
			required="True"
			ucd="pos.eq.dec;meta.main"
			unit="deg"
			tablehead="Dec"
			description="Incoming cosmic ray direction, Declination"
			verbLevel="1"/>
		<column name="nStat"
			required="True"
			type="smallint"
			ucd="meta.number;obs"
			tablehead="No. of Stations"
			description="Number of stations participating in an event"
			verbLevel="15"/>
		<column name="crE"
			required="True"
			ucd="phys.energy"
			unit="EeV"
			tablehead="CR Energy"
			description="Reconstructed energy of the cosmic ray particle"
			verbLevel="10"/>
		<column name="mjd"
			required="True"
			ucd="time.epoch;obs"
			tablehead="MJD"
			description="Observation time, Modified Julian Day"
			verbLevel="10"/>
		<column name="galLon"
			required="True"
			type="double precision"
			ucd="pos.galactic.lon"
			unit="deg"
			tablehead="Gal. Lon."
			description="Galactic longitude"/>
		<column name="galLat"
			required="True"
			type="double precision"
			ucd="pos.galactic.lat"
			unit="deg"
			tablehead="Gal. Lat."
			description="Galactic latitude"/>
	</table>

	<coverage>
		<updater sourceTable="main" mocOrder="4"/>
		<temporal>53005.6 56366.4</temporal>
		<spatial>0/8-11 1/16,18,20,22,24-26,28-30 2/32,48,68-70,84-86,92,124 3/0-2,4,8,64-66,69-70,72,74,132,136,196-198,200,202,284-286,304-306,308-309,312,348,372,378,432-434,436,440-441,500,502 4/13-15,20-22,24,28,30,37-41,48-49,129,268-269,271-273,275,284,292-294,304,532,534,536,538,541,548-550,552-554,556,560,640,796-797,804-805,807,812,816,832,896,1148-1150,1228-1230,1240,1242,1252-1254,1256-1257,1259,1264-1265,1396-1398,1400-1402,1404-1406,1492-1494,1496-1497,1500-1502,1504-1506,1509-1511,1516-1517,1520,1740,1742-1743,1748,1750,1752-1753,1756,1768,1771-1772,2005-2006,2012,2016-2018,2021-2025,2027-2029,2032</spatial>
	</coverage>

	<!--
	!	==============================
	!	Input Parsing and Data Mapping
	!	==============================
	!-->

	<data id="import_content">
		<sources pattern="data/auger_2013_public.txt"/>
		<reGrammar>
			<topIgnoredLines>19</topIgnoredLines>
			<names>eventId, nStat, zenAuger, aziAuger, crE, unixtime,
				galLon, galLat</names>
		</reGrammar>

		<make table="main">
			<rowmaker idmaps="*">
				<map dest="mjd">dateTimeToMJD(
					datetime.datetime.utcfromtimestamp(float(@unixtime)))</map>
				<apply id="galLonRepresent">
					<code><![CDATA[
						galLon = float(vars["galLon"])
						if galLon < 0:
							galLon = 360 + galLon
					]]></code>
				</apply>
				<apply>
					<setup>
						<code>
							gal2ICRS = stc.getSimple2Converter(
								stc.parseSTCS("Position GALACTIC"),
								stc.parseSTCS("Position ICRS"))
						</code>
					</setup>
					<code>
						@raj2000, @dej2000 = gal2ICRS(float(@galLon), float(@galLat))
					</code>
				</apply>
			</rowmaker>
		</make>
	</data>


	<!--
	!	===============
	!	Publishing Data
	!	===============
	!-->


	<service id="cone" allowed="form,scs.xml">
		<meta name="shortName">auger_scs</meta>
		<meta name="testQuery">
			<meta name="ra">197</meta>
			<meta name="dec">-29</meta>
			<meta name="sr">1</meta>
		</meta>
		<publish render="form" sets="local,ivo_managed"/>
		<publish render="scs.xml" sets="ivo_managed"/>
		<scsCore queriedTable="main">
			<FEED source="//scs#coreDescs"/>
			<condDesc buildFrom="mjd"/>
		</scsCore>
	</service>

	<regSuite title="Auger 2013">
		<regTest title="Auger 2013 SCS works">
			<url RA="197" DEC="-29" SR=".25">cone/scs.xml</url>
			<code>
				row = self.getFirstVOTableRow()
				self.assertEqual(row["eventId"], '11642700')
				self.assertAlmostEqual(row["dej2000"], -28.771667)
			</code>
		</regTest>
	</regSuite>
</resource>
