Esempio n. 1
0
 public void Test311ODC()
 {
     try
     {
         int[]             zones          = new[] { 0, 1, 2, 3, 4, 5, 6 };
         SparseArray <int> referenceArray = new SparseArray <int>(new SparseIndexing()
         {
             Indexes = new[]
             {
                 new SparseSet()
                 {
                     Start = 0, Stop = 6
                 }
             }
         });
         float[][][] allData = new float[1][][];
         var         data    = CreateData(zones.Length);
         Create311File(zones, data, "Test.311");
         allData[0] = data;
         var writer = new OdMatrixWriter <int>(referenceArray, 1, 1);
         writer.LoadEmme2("Test.311", 0);
         writer.Save("Test.odc", false);
         var odcFloatData = ConvertData(allData, zones.Length, 1, 1);
         ValidateData(zones, odcFloatData, "Test.odc");
     }
     finally
     {
         File.Delete("Test.311");
         File.Delete("Test.odc");
     }
 }
 private void LoadTimes(OdMatrixWriter <IZone> writer, string fileName, int i)
 {
     if (Path.GetExtension(fileName) == ".311")
     {
         writer.LoadEmme2(FailIfNotExist(fileName), i, (int)AutoDataTypes.TravelTime);
     }
     else
     {
         writer.LoadCsvTimes(FailIfNotExist(fileName), HeaderBoolean, i, (int)AutoDataTypes.TravelTime);
     }
 }
Esempio n. 3
0
        public void TestMultiTimeTypes311ODC()
        {
            int times = 3, types = 2;

            float[][][] allData = new float[times * types][][];
            try
            {
                int[]             zones          = new[] { 0, 1, 2, 3, 4, 5, 6 };
                SparseArray <int> referenceArray = new SparseArray <int>(new SparseIndexing()
                {
                    Indexes = new[]
                    {
                        new SparseSet()
                        {
                            Start = 0, Stop = 6
                        }
                    }
                });

                for (int i = 0; i < allData.Length; i++)
                {
                    var data = CreateData(zones.Length);
                    Create311File(zones, data, "Test" + i + ".311");
                    allData[i] = data;
                }
                var writer = new OdMatrixWriter <int>(referenceArray, times, types);
                for (int i = 0; i < types; i++)
                {
                    for (int j = 0; j < times; j++)
                    {
                        writer.LoadEmme2("Test" + (i * times + j) + ".311", i, j);
                    }
                }
                writer.Save("Test.odc", false);
                var odcFloatData = ConvertData(allData, zones.Length, times, types);
                ValidateData(zones, odcFloatData, "Test.odc");
            }
            finally
            {
                for (int i = 0; i < allData.Length; i++)
                {
                    File.Delete("Test" + i + ".311");
                }
                File.Delete("Test.odc");
            }
        }