<resource schema="fornax">
	<meta name="title">Deep Mosaic of the Fornax cluster core</meta>
	<meta name="description">
		This is a deep optical mosaic of the Fornax cluster’s core,
		covering 1.6 square degrees. The data were acquired with ESO/MPG 2.2m/WFI,
		using a transparent filter that nearly equals the no-filter throughput
		and thus provides a high signal-to-noise ratio. Based on an approximate
		conversion to V-band magnitudes, the unbinned and binned mosaics
		(0.24 and 0.71 arcsec/pixel) reach a median depth of 26.6
		and 27.8 mag/sq.arcsec, respectively.
	</meta>
	<meta name="creationDate">2015-09-22T12:42:00</meta>
	<meta name="schema-rank">100</meta>

	<meta name="subject">galaxy-clusters</meta>

	<meta name="creator">Lisker, T.; Wittmann, C.; Pasquali, A.;
		Hilker, M.; Grebel, E.K.; Venhola, A.</meta>
	<meta name="facility">ESO La Silla</meta>
	<meta name="instrument">ESO/MPG 2.2m</meta>

	<meta name="source">Lisker, T., and the Fornax Deep Survey with VST, private
		communication</meta>
	<meta name="doi">10.21938/v3tmOOzxQ3cZx4apXSQWJQ</meta>
	<meta name="contentLevel">Research</meta>
	<meta name="type">Archive</meta>

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

	<FEED source="//procs#license-cc-by" what="the Fornax VST Survey"/>

	<table id="data" onDisk="True" mixin="//siap#pgs">
		<meta name="_associatedDatalinkService">
			<meta name="serviceId">dl</meta>
			<meta name="idColumn">did</meta>
		</meta>

		<mixin
			facilityName="'ESO La Silla'"
			collectionName="'Fornax cluster center mosaic'"
			targetClass="'ClG'"
			targetName="'Fornax Cluster Core'"
			calibLevel="3">//obscore#publishSIAP</mixin>
		<column name="did" type="text"
			ucd="meta.id"
			tablehead="PubDID"
			description="Globally unique IVOA publisher DID for this dataset."
			verbLevel="15"/>
		<column name="datalink_url" type="text"
			ucd="meta.ref.url"
			tablehead="Datalink"
			description="URL to a datalink document for this mosaic
				(ancillary files, cutouts)"
			displayHint="type=url"
			verbLevel="15">
			<property name="targetType"
				>application/x-votable+xml;content=datalink</property>
			<property name="targetTitle">Datalink</property>
		</column>
	</table>

	<coverage>
		<updater spaceTable="data" timeTable="data"/>
		<temporal>55031.5 55031.5</temporal>
		<spatial>5/8633 6/34511,34522,34531,34537,34540-34541,34544,34546</spatial>
		<spectral>2.483e-19 4.966e-19</spectral>
	</coverage>

	<data id="import">
		<sources pattern="data/*.fits"/>

		<fitsProdGrammar>
			<rowfilter procDef="//products#define">
				<bind name="table">"\schema.data"</bind>
			</rowfilter>
		</fitsProdGrammar>

		<make table="data">
			<rowmaker>
				<apply procDef="//siap#computePGS"/>
				<apply procDef="//siap#setMeta">
					<bind key="dateObs">computeMean(
						parseDate(@DATE_ST), parseDate(@DATE_END))</bind>
					<bind key="instrument">"ESO/MPG 2.2m"</bind>
					<bind key="pixflags">"F"</bind>
					<bind key="title">"Fornax Core mosaic"</bind>
				</apply>
				<map key="datalink_url"
					>\dlMetaURI{dl}</map>
				<map key="did">\standardPubDID</map>
			</rowmaker>
		</make>
	</data>

	<service id="dl" allowed="dlmeta,dlget,static">
		<meta name="title">Fornax Core Datalink</meta>
		<property key="staticData">data</property>
		<datalinkCore>
			<metaMaker semantics="#this">
				<code>
					descriptor.suppressAutoLinks = True
					fName = descriptor.accref.split("/")[-1]
					yield descriptor.makeLinkFromFile("data/"+fName,
						description="Full mosaic (large!)",
						contentQualifier="#image")
				</code>
			</metaMaker>
			<metaMaker semantics="#weight">
				<code>
					fName = descriptor.accref.split("/")[-1]
					yield descriptor.makeLinkFromFile("data/"+fName.replace(".fits",
						"_weight.fits.gz"),
						description="Weight map for this image.",
						contentQualifier="#image")
				</code>
			</metaMaker>
			<metaMaker semantics="#preview">
				<code>
					yield descriptor.makeLinkFromFile("data/preview.jpeg",
						description="A preview of the entire mosaic.",
						service=self.parent)
				</code>
			</metaMaker>

			<metaMaker semantics="#coderived">
				<code>
					if "_binned" in descriptor.accref:
						otherDesc = ("Unbinned (higher-res, lower-SNR)"
							" version of this data set.")
						otherID = descriptor.pubDID.replace("_binned.fits",
							".fits")
					else:
						otherDesc = ("Binned (lower-res, higher-SNR)"
							" version of this data set.")
						otherID = descriptor.pubDID.replace(".fits",
							"_binned.fits")

					yield descriptor.makeLink(
						self.parent.getURL("dlmeta")+"?ID="+urllib.parse.quote(otherID),
						description=otherDesc,
						contentQualifier="#image")
				</code>
			</metaMaker>


			<descriptorGenerator procDef="//soda#fits_genDesc"/>
			<FEED source="//soda#fits_standardDLFuncs"/>
		</datalinkCore>
	</service>

	<service id="hips" allowed="hips">
		<meta name="title">Fornax Cluster Core in HiPS</meta>
		<meta name="description">A HiPS generated from the high-resolution
			image.</meta>
		<property name="staticData">hips</property>
		<nullCore/>
	</service>

	<service id="c" allowed="form,siap.xml">
		<publish render="form" sets="ivo_managed,local"/>
		<publish render="siap.xml" sets="ivo_managed"/>
		<publish render="hips" sets="ivo_managed" service="hips"/>
		<meta>
			date: 2023-11-08
			date.role: ExportRequested
		</meta>
		<meta name="shortName">fornax cutout</meta>

		<meta name="sia.type">Cutout</meta>
		<meta name="testQuery.pos.ra">54.8</meta>
		<meta name="testQuery.pos.dec">-35</meta>
		<meta name="testQuery.size.ra">0.01</meta>
		<meta name="testQuery.size.dec">0.01</meta>

		<siapCutoutCore queriedTable="data">
			<condDesc original="//siap#protoInput"/>
			<condDesc original="//siap#humanInput" required="True">
				<inputKey original="//siap#base_POS" name="hPOS"
					description="ICRS Position, RA,DEC, or Simbad object
						(e.g., 234.234,-32.45)">
					<property name="notForRenderer">siap.xml</property>
					<property name="defaultForForm">NGC 1399</property>
				</inputKey>
				<inputKey original="//siap#base_SIZE" name="hSIZE">
					<property name="notForRenderer">siap.xml</property>
					<values default="0.2"/>
				</inputKey>
			</condDesc>
			<condDesc silent="True">
				<inputKey name="cutoutSize" unit="deg"
					tablehead="Cutout size"
					description="Size of the cutout image [degrees]">0.1</inputKey>
			</condDesc>
		</siapCutoutCore>
	</service>

	<regSuite title="Fornax regression">
		<regTest title="Fornax datalink metadata ok" tags="bigserver">
			<url
				ID="ivo://org.gavo.dc/~?fornax/data/FornaxCore_ESO2p2WFI_Lisker2015.fits"
				>dl/dlmeta</url>
			<code>
				self.assertHasStrings("A preview of the entire mosaic.",
					"lower-res, higher-SNR", "55.847", "-36.07", "55.829",
					"1.048", "19215")
			</code>
		</regTest>

		<regTest title="Fornax datalink cutout ok" tags="bigserver">
			<url
				ID="ivo://org.gavo.dc/~?fornax/data/FornaxCore_ESO2p2WFI_Lisker2015.fits"
					POLYGON="54.001 -35.001 54 -35.001 54 -35"
				>dl/dlget</url>
			<code>
				self.assertHasStrings(
					"NAXIS1  =                   13",
					"NAXIS2  =                   16",
					b"\\xbd\\x9a\\x83\\xdc\\xbd\\x58\\xc1\\x16")
			</code>
		</regTest>
	</regSuite>

	<regSuite title="DaCHS regression">
		<regTest title="HiPS base URL returns Aladin lite HTML">
			<url httpHonorRedirects="True">hips/hips</url>
			<code>
				self.assertHeader("content-type", "text/html")
				self.assertHasStrings(
					'id="aladin-lite-div"',
					" 2.263°^2")
			</code>
		</regTest>

		<regTest title="HiPS properties properly returned">
			<url>hips/hips/properties</url>
			<code>
				self.assertHeader("content-type", "text/plain")
				self.assertHasStrings(
					'hips_service_url     = http://dc.g-vo.org/fornax/q/hips/hips',
					"VST Survey is licensed under the `Creative",
					"s_pixel_scale        = 6.609E-5")
			</code>
		</regTest>

	</regSuite>
</resource>
