Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Format: <servicecode>-<sitename>-<variablename>.<extension>
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="timeSeriesFormat"></param>
        /// <returns></returns>
        public static string GenerateFileName(SeriesMetadata meta, TimeSeriesFormat timeSeriesFormat = TimeSeriesFormat.CSV)
        {
            string fileName = string.Format("{0}-{1}-{2}", meta.ServCode.SanitizeForFilename(), meta.SiteName.SanitizeForFilename(), meta.VariableName.SanitizeForFilename());
            string extension = String.Empty;

            if (TimeSeriesFormat.WaterOneFlow == timeSeriesFormat)
            {
                extension = ".xml";
            }
            else if (TimeSeriesFormat.CSV == timeSeriesFormat)
            {
                //NOTE: Microsoft Excel restricts file path + name + extension to 218 characters max.  Truncate file name if indicated...

                extension = ".csv";

                while (218 < (fileName.Length + extension.Length))
                {
                    fileName = fileName.Substring(0, (fileName.Length - 1));
                }
            }

            return string.Format("{0}{1}", fileName, extension);
        }
 public async Task<Tuple<Stream, IList<ServerSideHydroDesktop.ObjectModel.Series>>> SeriesAndStreamOfSeriesID(SeriesMetadata meta)
 {
     WaterOneFlowClient client = new WaterOneFlowClient(meta.ServURL);
     return await client.GetValuesAndRawStreamAsync(
             meta.SiteCode,
             meta.VarCode,
             meta.StartDate,
             DateTime.UtcNow,
             Convert.ToInt32(10000));
 }