public SeriesData(int seriesId, SeriesMetadata myMeta, IList<DataValue> dataValues, Variable variable, List<Source> sources, List<Method> methods, List<QualityControlLevel> qualityControlLevels) : this() { myMetadata = myMeta; SeriesID = seriesId; HasConfirmedTimeStamp = true; TimeStampMessage = string.Empty; myVariable = variable; values = dataValues.ToList(); ontology = new List<OntologyItem>(); tags = new List<HydroTag>(); if (null != sources) { mySources = sources; } if (null != methods) { myMethods = methods; } if (null != qualityControlLevels) { myQualityControlLevels = qualityControlLevels; } }
/// <summary> /// Creates a new data series associated with the specific site, variable, /// method, quality control level and source. This series will contain zero /// data values after creation. /// </summary> /// <param name="site">the observation site (location of measurement)</param> /// <param name="variable">the observed variable</param> /// <param name="method">the observation method</param> /// <param name="qualControl">the quality control level of observed values</param> /// <param name="source">the source of the data values for this series</param> public SeriesMetadata(Site site, Variable variable, Method method, QualityControlLevel qualControl, Source source) { ValueCount = 0; Site = site; Variable = variable; Method = method; QualityControlLevel = qualControl; Source = source; }
/// <summary> /// Creates a new data series associated with the specific site, variable, /// method, quality control level and source. This series will contain zero /// data values after creation. /// </summary> /// <param name="site">the observation site (location of measurement)</param> /// <param name="variable">the observed variable</param> /// <param name="method">the observation method</param> /// <param name="qualControl">the quality control level of observed values</param> /// <param name="source">the source of the data values for this series</param> public Series(Site site, Variable variable, Method method, QualityControlLevel qualControl, Source source) : this() { Site = site; Variable = variable; Method = method; QualityControlLevel = qualControl; Source = source; }
/// <summary> /// Reads information about variable /// </summary> protected override Variable ReadVariable(XmlReader r) { Variable varInfo = new Variable(); Unit timeUnit = Unit.Unknown; Unit valueUnit = Unit.Unknown; varInfo.Speciation = "Not Applicable"; varInfo.DataType = "Unknown"; varInfo.GeneralCategory = "Unknown"; varInfo.SampleMedium = "Unknown"; varInfo.ValueType = "Unknown"; while (r.Read()) { string nodeName = r.Name.ToLower(); if (r.NodeType == XmlNodeType.Element) { if (XmlContext.AdvanceReaderPastEmptyElement(r)) { //Empty element - advance and continue... continue; } if (nodeName.IndexOf("variablecode") >= 0) { string prefix = r.GetAttribute("vocabulary"); if (string.IsNullOrEmpty(prefix)) { prefix = r.GetAttribute("network"); } //BCC - 08-Aug-2016 - Retrieve variableID attribute value string variableID = r.GetAttribute("variableID"); long result = 0; if (long.TryParse(variableID, out result)) { varInfo.Id = result; } r.Read(); string variableCode = r.Value; if (!String.IsNullOrEmpty(prefix)) { variableCode = prefix + ":" + variableCode; } varInfo.Code = variableCode; } else if (nodeName == "variablename") { r.Read(); varInfo.Name = r.Value; } else if (nodeName.IndexOf("valuetype") >= 0) { r.Read(); varInfo.ValueType = r.Value; } else if (nodeName.IndexOf("datatype") >= 0) { r.Read(); varInfo.DataType = r.Value; } else if (nodeName == "generalcategory") { r.Read(); varInfo.GeneralCategory = r.Value; } else if (nodeName == "samplemedium") { r.Read(); varInfo.SampleMedium = r.Value; } else if (nodeName == "speciation") { r.Read(); varInfo.Speciation = r.Value; } else if (nodeName == "units") { string abrev = r.GetAttribute("unitsAbbreviation"); if (String.IsNullOrEmpty(abrev)) { abrev = "unknown"; } string unitType = r.GetAttribute("unitsType"); if (String.IsNullOrEmpty(unitType)) { unitType = "unknown"; } r.Read(); string unitName = r.Value; if (String.IsNullOrEmpty(unitName)) { unitName = "unknown"; } valueUnit.Abbreviation = abrev; valueUnit.UnitsType = unitType; valueUnit.Name = unitName; } else if (nodeName == "nodatavalue") { r.Read(); varInfo.NoDataValue = Convert.ToDouble(r.Value, CultureInfo.InvariantCulture); } else if (nodeName == "timesupport") { string isRegular = r.GetAttribute("isRegular"); if (!String.IsNullOrEmpty(isRegular)) { varInfo.IsRegular = Convert.ToBoolean(isRegular); } } else if (nodeName == "unitname") { r.Read(); timeUnit.Name = r.Value; } else if (nodeName == "unitdescription") { r.Read(); timeUnit.Name = r.Value; } else if (nodeName == "unittype") { r.Read(); timeUnit.UnitsType = r.Value; } else if (nodeName == "unitabbreviation") { r.Read(); timeUnit.Abbreviation = r.Value; } else if (nodeName == "timeinterval") { r.Read(); varInfo.TimeSupport = Convert.ToSingle(r.Value); } } else if (r.NodeType == XmlNodeType.EndElement && nodeName == "variable") { varInfo.TimeUnit = timeUnit; varInfo.VariableUnit = valueUnit; return varInfo; } } return varInfo; }