<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema 
            xmlns:nwis="http://water.usgs.gov/XML/4.8"
            
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            id="Rating-2.0.a"
            elementFormDefault="qualified">

	<xsd:include schemaLocation="../shared/DateTimeWithDatum.xsd"/>
	<xsd:include schemaLocation="../shared/DataAgingCode.xsd"/>
	<xsd:include schemaLocation="../shared/RecordHistory.xsd"/>
	<xsd:include schemaLocation="Point.xsd"/>
	<xsd:include schemaLocation="../shared/IEEE754FloatValue.xsd"/>

	<xsd:element name="Offset">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>Defines a translation to be applied to an independent value before a table lookup/interpolation is performed.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="BreakpointValue" type="IEEE754FloatValueType" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The translation will be applied to all independent value less than this value.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="OffsetValue" type="IEEE754FloatValueType">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The value to be applied to the independent value.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="StandardEquation">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>A standard equation of the form: y = a(x+b)**c + d  where y = the dependent variable, x = the independent variable, a = multiplier, b = 1st additive, c = power, and d = 2nd additive.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="MultiplierValue" type="IEEE754FloatValueType" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The standard equation multiplier value (a).</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="FirstAdditiveValue" type="IEEE754FloatValueType" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The standard equation first additive value (b).</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="PowerValue" type="IEEE754FloatValueType" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The standard equation power value (c).</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="SecondAdditiveValue" type="IEEE754FloatValueType" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The standard equation second additive value (d).</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="PolynomialEquationTerm">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>One term of a polynomial equation.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="InterceptValue" type="IEEE754FloatValueType">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The axix intercept value for a polynimial equation term.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="MultiplierValue" type="IEEE754FloatValueType">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The multiplier value for a polynimial equation term.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="PowerValue" type="IEEE754FloatValueType">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The power value for a polynimial equation term.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="PolynomialEquation">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>A transformation which consist of a polynomial equation of the form; y = a + b1(x**c1) + b2(x**c2) + ... + bn(x**cn) where y = the dependent variable, x = the independent variable, a = intercept, b = multiplier, and c = power for terms 1 to n.One term of a polynomial equation.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="PolynomialEquationTerm" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Table">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>A Table defines a transformation to be applied to an independent variable to produce a dependent variable.  A Table contains an optional list of offsets and a list of point-pairs ( x, y ) used in the transformation. x refers to the independent variable and y refers to the dependent variable. The dependent variable is computed by first applying any defined Offsets to the independent variable and then determining a value using interpolation between enclosing point-pairs.One term of a polynomial equation.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="InterpolationCode" default="Linear">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The code that defines the type of interpolation to perform.</Definition>
						</xsd:documentation>
					</xsd:annotation>
					<xsd:simpleType>
						<xsd:restriction base="xsd:NMTOKEN">
							<xsd:enumeration value="Linear"/>
							<xsd:enumeration value="Logarithmic"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element ref="Offset" minOccurs="0" maxOccurs="3"/>
				<xsd:element ref="Point" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Transformation">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>A Transformation defines the information needed to transform the independent variable to the dependent variable.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:choice>
				<xsd:element ref="StandardEquation"/>
				<xsd:element ref="PolynomialEquation"/>
				<xsd:element ref="Table"/>
			</xsd:choice>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="RatingPeriod">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>A period of time, defined by a starting date and time and an ending date and time, where the rating is in effect. </Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="StartDateTime" type="DateTimeWithDatum">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The starting date and time that the rating is in effect.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="EndDateTime" type="DateTimeWithDatum">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The ending date and time the rating is in effect.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element ref="DataAgingCode"/>
				<xsd:element name="RemarksText" type="xsd:string" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>Textual remarks about the rating period.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
                                <xsd:element name="History" type="RecordHistoryType" minOccurs="0"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Shift">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>Defines an adjustment performed to the independent value before rating lookup.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="StartDateTime" type="DateTimeWithDatum">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The starting date and time that the shift is in effect.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="EndDateTime" type="DateTimeWithDatum" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The ending date and time the shift is in effect.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element ref="DataAgingCode"/>
				<xsd:element ref="Point" minOccurs="1" maxOccurs="3"/>
				<xsd:element name="RemarksText" type="xsd:string" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>Textual remarks describing the reason for the shift.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="History" type="RecordHistoryType" minOccurs="0"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="Rating">
		<xsd:annotation>
			<xsd:documentation>
				<Definition>A rating defines a relationship between two types of data. It is the instructions for transforming an independent variable to a dependent variable.</Definition>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="RatingNumber" type="xsd:string">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The rating identification number.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="RatingCode" type="xsd:string">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The code that identifys the use of the rating.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="TransportCode" type="xsd:string" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>The code that identifys the type of unit values transport and is only used for conversion of input ratings.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element ref="DataAgingCode"/>
				<xsd:element ref="Transformation" minOccurs="0"/>
				<xsd:element ref="RatingPeriod" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element name="RemarksText" type="xsd:string" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>
							<Definition>Textual remarks about the rating.</Definition>
						</xsd:documentation>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="History" type="RecordHistoryType" minOccurs="0"/>
				<xsd:element ref="Shift" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>
