Пример #1
0
 public void Load(string startFilterDate, string endFilterDate)
 {
     try
     {
         ResolveFullCsvName();
         Debug.Log("Load  " + fullcsvname);
         sdf         = new SimpleDf();
         sdf.comment = clr;
         sdf.CheckConsistency("Before Load");
         sdf.preferedType["Id"]          = SdfColType.dflong;
         sdf.preferedType["Timestamp"]   = SdfColType.dfdatetime;
         sdf.preferedFormat["Timestamp"] = "yyyy-MM-dd HH:mm:ss.fff";
         sdf.preferedType["time"]        = SdfColType.dfdatetime;
         sdf.preferedFormat["time"]      = "yyyy/MM/dd HH:mm:ss.fff";
         sdf.preferedSubstitute["time"]  = ("+00", "");
         sdf.ReadCsv(fullcsvname, quiet: false);
         Debug.Log($"Read {sdf.InfoStr()}");
         Debug.Log($"Cols: {sdf.InfoClassStr()}");
         Debug.Log($"Copying {sdf.InfoStr()}");
         var test = false;
         if (test)
         {
             testsdf(sdf, startFilterDate, endFilterDate);
         }
         var tcolname = "Timestamp";
         isdozertrack = true;
         if (sdf.ColumnExists("time"))
         {
             tcolname     = "time";
             isdozertrack = false;
         }
         sdf.KeepColumns(new string[] { "Id", "Timestamp", "x", "y", "time", "X", "Y" });
         sdf = SimpleDf.SortOnColumn(sdf, tcolname);
         if (isdozertrack)
         {
             var blst = sdf.GetBoolFilter("Timestamp", startFilterDate, endFilterDate);
             sdf = SimpleDf.Subset(sdf, "df", blst);
         }
         else
         {
             sdf.RenameColumn("X", "x");
             sdf.RenameColumn("Y", "y");
         }
         sdf.FloatTimeFromDateString(tcolname, "Elaptime");
         sdf.preferedFormat["Elaptime"] = "f2";
         test = true;
         if (test)
         {
             sdf.WriteCsv("transformed_df.csv");
         }
         var nrow = sdf.Nrow();
         if (nrow == 0)
         {
             Debug.LogWarning("No rows in df " + fullcsvname);
             sdf = null;
         }
     }
     catch (Exception ex)
     {
         Debug.LogError("Exception in DozerTracks.Load:" + ex.ToString());
     }
 }