Esempio n. 1
0
        ///
        /// <param name="pi">List of FEWS TimeSeries</param>
        /// <param name="rootPath">Root path where dfs0 files will be placed to. </param>
        /// <param name="startTime">Start time to be written to dfs0</param>
        /// <param name="endTime">End time to be written to dfs0</param>
        /// <param name="relativePath">Full file path relative to rootPath. If empty file
        /// name generated based on PI content.</param>
        /// <param name="ensembleId">Ensemble Id identifying what TS write to file.
        /// </param>
        /// <param name="ensembleMemberId">Identification of ensemble to be
        /// exported</param>
        /// <param name="prefix">Prefix added to the TS location</param>
        /// <param name="parameterType">DFS0 Parameter type. Available values instantaneous,
        /// accumulated, meanstepbackward, meanstepforward, stepaccumulated, Default -
        /// instantaneous, </param>
        public bool WriteDfs0File(PI pi, string rootPath, DateTime startTime, DateTime endTime, string relativePath = "", string ensembleId = "", string ensembleMemberId = "", string prefix = "", string parameterType = "")
        {
            var fileNames = new Dictionary <string, IList <TsIdentification> >();

            if (!string.IsNullOrEmpty(relativePath))
            {
                fileNames.Add(Path.Combine(rootPath, relativePath), new List <TsIdentification>());
            }

            foreach (var ts in pi.TimeSeries)
            {
                var    array    = ts.LocationId.Split('|');
                var    location = ts.LocationId;
                string fullName = Path.Combine(rootPath, relativePath);
                if (array.Length > 1)
                {
                    fullName      = Path.Combine(rootPath, array[0]);
                    ts.LocationId = array[1];
                }
                else
                {
                    if (!string.IsNullOrEmpty(relativePath))
                    {
                        fullName = Path.Combine(rootPath, relativePath);
                    }
                }
                var tsIdentification = new TsIdentification(ts);
                if (!string.IsNullOrEmpty(prefix))
                {
                    tsIdentification.LocationId = $"{prefix}_{tsIdentification.LocationId}";
                }
                if (!fileNames.ContainsKey(fullName))
                {
                    fileNames.Add(fullName, new List <TsIdentification>());
                }
                fileNames[fullName].Add(tsIdentification);
            }

            foreach (var file in fileNames)
            {
                _WriteOneFile(file.Key, pi, file.Value, startTime, endTime, parameterType);
            }
            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// Get list of TS based on TsIdentification
 /// </summary>
 /// <param name="identification">TsIdentification used for selection</param>
 public IList <TimeSeries> GetTS(TsIdentification identification)
 {
     return(GetTS(identification.LocationId, identification.ParmId, identification.TsType, identification.EnsembleId, identification.EnsembleMemberId, -1));
 }