private void LoadJobOccupationDistribution() { JobOccupationRates = SparseTriIndex <float> .CreateSimilarArray(Root.ZoneSystem.ZoneArray, EmploymentStatus, OccupationCategories); var occupationIndexes = OccupationCategories.ValidIndexies().ToArray(); using (CommentedCsvReader reader = new CommentedCsvReader(JobOccupationRateFile.GetFileName(Root.InputBaseDirectory))) { while (reader.NextLine()) { if (reader.NumberOfCurrentCells >= 5) { reader.Get(out int pd, 0); reader.Get(out int employmentStatus, 1); reader.Get(out float professional, 2); reader.Get(out float general, 3); reader.Get(out float sales, 4); reader.Get(out float manufacturing, 5); foreach (var zone in PDZoneMap[pd]) { JobOccupationRates[zone, employmentStatus, occupationIndexes[0]] = 0; JobOccupationRates[zone, employmentStatus, occupationIndexes[1]] = professional; JobOccupationRates[zone, employmentStatus, occupationIndexes[2]] = general; JobOccupationRates[zone, employmentStatus, occupationIndexes[3]] = sales; JobOccupationRates[zone, employmentStatus, occupationIndexes[4]] = manufacturing; } } } } }
private void LoadJobOccupationDistribution() { JobOccupationRates = SparseTriIndex <float> .CreateSimilarArray(Root.ZoneSystem.ZoneArray, EmploymentStatus, OccupationCategories); var employmentIndexes = EmploymentStatus.ValidIndexies().ToArray(); var occupationIndexes = OccupationCategories.ValidIndexies().ToArray(); using (CsvReader reader = new CsvReader(GetFullPath(JobOccupationRateFile))) { int pd; int employmentStatus; float professional; float general; float sales; float manufacturing; if (JobOccupationRateFileHeader) { reader.LoadLine(); } while (!reader.EndOfFile) { var length = reader.LoadLine(); if (length >= 5) { reader.Get(out pd, 0); reader.Get(out employmentStatus, 1); reader.Get(out professional, 2); reader.Get(out general, 3); reader.Get(out sales, 4); reader.Get(out manufacturing, 5); List <int> zones; if (PDZoneMap.TryGetValue(pd, out zones)) { foreach (var zone in zones) { this.JobOccupationRates[zone, employmentStatus, occupationIndexes[0]] = 0; this.JobOccupationRates[zone, employmentStatus, occupationIndexes[1]] = professional; this.JobOccupationRates[zone, employmentStatus, occupationIndexes[2]] = general; this.JobOccupationRates[zone, employmentStatus, occupationIndexes[3]] = sales; this.JobOccupationRates[zone, employmentStatus, occupationIndexes[4]] = manufacturing; } } } } } }