コード例 #1
0
        public static void Write(string dssFileName, Watershed watershed)
        {
            bool saveAsFloat = true;

            float[] ensembleMember = null;
            int     count          = 0;

            using (var w = new DssWriter(dssFileName, DssReader.MethodID.MESS_METHOD_GLOBAL_ID, DssReader.LevelID.MESS_LEVEL_CRITICAL))
            {
                foreach (Location loc in watershed.Locations)
                {
                    if (count % 100 == 0)
                    {
                        Console.Write(".");
                    }
                    int memberCounter = 0;

                    foreach (Forecast f in loc.Forecasts)
                    {
                        int size = f.Ensemble.GetLength(0);
                        for (int i = 0; i < size; i++)
                        {
                            f.EnsembleMember(i, ref ensembleMember);

                            memberCounter++;
                            ///   A/B/FLOW//1 Hour/<FPART></FPART>
                            //// c:  ensemble.p
                            var t = f.IssueDate;
                            //  /RUSSIANNAPA/APCC1/FLOW/01SEP2019/1HOUR/C:000002|T:0212019/
                            string F = "C:" + memberCounter.ToString().PadLeft(6, '0') + "|T:" +
                                       t.DayOfYear.ToString().PadLeft(3, '0') + t.Year.ToString();

                            var path = "/" + watershed.Name.ToString() + "/" + loc.Name + "/Flow//1Hour/" + F + "/";
                            Hec.Dss.TimeSeries timeseries = new Hec.Dss.TimeSeries
                            {
                                Values        = Array.ConvertAll(ensembleMember, item => (double)item),
                                Units         = "",
                                DataType      = "INST-VAL",
                                Path          = new DssPath(path),
                                StartDateTime = f.TimeStamps[0]
                            };
                            w.Write(timeseries, saveAsFloat);
                            count++;
                        }
                    }
                }
            }
        }
コード例 #2
0
 private static bool NextForecast(List <Hec.Dss.TimeSeries> seriesList, Hec.Dss.TimeSeries ts)
 {
     return(seriesList.Count > 0 && seriesList[0].StartDateTime != ts.StartDateTime);
 }
コード例 #3
0
 internal static int SecondsInInterval(TimeSeries ts)
 {
     return(SecondsInInterval(ts.Path));
 }