<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:fews="http://www.wldelft.nl/fews/archive"
		targetNamespace="http://www.wldelft.nl/fews/archive" elementFormDefault="qualified"
		attributeFormDefault="unqualified" version="1.0">
	<include schemaLocation="archive_sharedTypes.xsd"/>
	<element name="externalStorage" type="fews:ExternalStorageComplexType"/>
	<complexType name="ExternalStorageComplexType">
		<sequence>
			<element name="externalCFCompliantNetCDFStorage" type="fews:ExternalCFCompliantNetCDFStorageComplexType" maxOccurs="unbounded">
				<annotation>
					<documentation>Since 2019.02. A folder with CF compliant Netcdf files. These files are part of the archve but are not necessarily exported by a FEWS system</documentation>
				</annotation>
			</element>
			<element name="simulatedForecastingNetcdfStorage" type="fews:SimulatedForecastingNetcdfStorageComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Since 2022.01. A folder which contains netcdf files with simulated forecasting data. The files will coupled to an existing forecast by using the task run id.
					</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="SimulatedForecastingNetcdfStorageComplexType">
		<sequence>
			<element name="dataFolder" type="fews:fileStringType">
				<annotation>
					<documentation>The folder which contains the CF compliant netCDF files</documentation>
				</annotation>
			</element>
			<element name="dataFolderFilter" type="fews:DataFolderFilterConstraintsComplexType" minOccurs="0"/>
			<element name="fileNameFilter" type="fews:FileNameFilterConstraintsComplexType" minOccurs="0"/>
			<element name="matchingAttributeId" type="string" maxOccurs="unbounded"/>
		</sequence>
		<attribute name="id" type="fews:idStringType" use="required"/>
	</complexType>
	<complexType name="ExternalCFCompliantNetCDFStorageComplexType">
		<sequence>
			<choice>
				<element name="dataFolder" type="fews:fileStringType">
					<annotation>
						<documentation>The folder which contains the CF compliant netCDF files</documentation>
					</annotation>
				</element>
				<group ref="fews:ThreddsCatalogueGroup"/>
			</choice>
			<element name="layerLocationPrefix" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>If a sigma-layer or z-layer is found for each layer a location id will be generated by using this prefix.</documentation>
				</annotation>
			</element>
			<element name="attribute" type="fews:AttributeComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>This attribute will be added to the elastic search meta data records and can be used for searching in the archive</documentation>
				</annotation>
			</element>
			<element name="timeSeriesType" type="fews:netcdfStorageTimeSeriesType">
				<annotation>
					<documentation>The time series type of the data in this data folder</documentation>
				</annotation>
			</element>
			<element name="forecastTimeDateTimePattern" type="fews:nonEmptyStringType" minOccurs="0">
				<annotation>
					<documentation>The pattern which will be used to determine the forecast time of the file. If a forecast reference time is available in the netcdf file then the value from the
						netcdf file will be used.
					</documentation>
				</annotation>
			</element>
			<element name="dataFolderFilter" type="fews:DataFolderFilterConstraintsComplexType" minOccurs="0"/>
			<element name="fileNameFilter" type="fews:FileNameFilterConstraintsComplexType" minOccurs="0"/>
			<element name="maxAllowedUniqueAttributeValues" type="positiveInteger" minOccurs="0" default="10">
				<annotation>
					<documentation>If for a certain attribute there are more unique values available then the configured amount then the attribute will not be used when the unique attribute values are
						requested per location or parameter.
					</documentation>
				</annotation>
			</element>
			<element name="alwaysExcludedAttributeId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>The id of an attribute which should always be ignored by the harvester.</documentation>
				</annotation>
			</element>
			<element name="alwaysIncludedAttributeId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>The id of an attribute which should always be used by the harvester.</documentation>
				</annotation>
			</element>
			<element name="attributeMapping" type="fews:AttributeMappingComplexType">
				<annotation>
					<documentation>Mapping of fews time series identifiers to netcdf attributes.</documentation>
				</annotation>
			</element>
			<element name="locationAliases" type="fews:LocationAliasesComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>variables which contain aliases for the station ids</documentation>
				</annotation>
			</element>
			<element name="observedDataWithForecastTimeFileNamePattern" type="fews:nonEmptyStringType" minOccurs="0" maxOccurs="unbounded"></element>
		</sequence>
		<attribute name="id" type="fews:idStringType" use="required"/>
		<attribute name="enabled" type="fews:booleanStringType" use="optional"/>
	</complexType>
	<complexType name="AttributeMappingComplexType">
		<sequence>
			<element name="moduleInstanceId" type="fews:idStringType">
				<annotation>
					<documentation>The netcdf attribute which provides the value for the module instance id</documentation>
				</annotation>
			</element>
			<element name="timeStepId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>The netcdf attribute which provides the value for the time step. If this option is not configured a non-equidistant time step will be used.</documentation>
				</annotation>
			</element>
			<element name="qualifiersId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>The netcdf attribute which provides the value for the module instance id. If this option is not configured no qualifiers will be used.</documentation>
				</annotation>
			</element>
			<element name="gridId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>The netcdf attribute which provides the value for grid id. It is also possible to hard code the grid id by using the gridId element.</documentation>
				</annotation>
			</element>
			<element name="ensembleId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>The netcdf attribute which provides the value for the ensemble id. It is also possible to hard code the ensemble id by using the ensemble id element.</documentation>
				</annotation>
			</element>
			<element name="areaId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>The netcdf attribute which provides the value for the area id</documentation>
				</annotation>
			</element>
			<element name="sourceId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>The netcdf attribute which provides the value for the source id</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="LocationAliasesComplexType">
		<sequence>
			<element name="ncVariable" type="fews:idStringType">
				<annotation>
					<documentation>Name of the variable in the NetCdf file.</documentation>
				</annotation>
			</element>
			<element name="locationGroupIdentifier" type="fews:idStringType">
				<annotation>
					<documentation>Identifier which can be used to identify the group of locations which are generated from this variable.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>		
	<group name="ThreddsCatalogueGroup">
		<sequence>
			<element name="thredsCatalogueURL" type="anyURI">
				<annotation>
					<documentation>Since 2020.02 The root URL of a THREDDS catalogue</documentation>
				</annotation>
			</element>
			<element name="threddsFileServerURL" type="anyURI">
				<annotation>
					<documentation>Since 2020.02 The file server URL of a THREDDS catalogue</documentation>
				</annotation>
			</element>
		</sequence>
	</group>
</schema>
