diff --git a/Cell2Fire/Cell2Fire.cpp b/Cell2Fire/Cell2Fire.cpp index 907907c9..3627b78f 100644 --- a/Cell2Fire/Cell2Fire.cpp +++ b/Cell2Fire/Cell2Fire.cpp @@ -2403,20 +2403,6 @@ Cell2Fire::Step(std::default_random_engine generator, int ep) this->sim += 1; } - if ((this->sim > args.TotalSims) && (args.WeatherOpt != "rows")) - { - this->counter_wt += 1; - if (this->counter_wt <= 1) - { - // Weather History Folder - std::string filename = "WeatherHistory.csv"; - CSVWriter WtHistoryFolder("", ""); - this->historyFolder = this->args.OutFolder + "WeatherHistory" + separator(); - WtHistoryFolder.MakeDir(this->historyFolder); - CSVWriter WtFile(this->historyFolder + filename); - WtFile.printWeather(WeatherHistory); - } - } // Print current status if (!this->done && this->args.verbose) { diff --git a/Cell2Fire/Cell2Fire.h b/Cell2Fire/Cell2Fire.h index 660e009d..11ebd532 100644 --- a/Cell2Fire/Cell2Fire.h +++ b/Cell2Fire/Cell2Fire.h @@ -85,6 +85,7 @@ class Cell2Fire string crownFlameLengthFolder; string historyFolder; string ignitionsFolder; + string weathersFolder; // Vectors std::vector fire_period; diff --git a/Cell2Fire/WriteCSV.cpp b/Cell2Fire/WriteCSV.cpp index 4535c7d8..9452bb65 100644 --- a/Cell2Fire/WriteCSV.cpp +++ b/Cell2Fire/WriteCSV.cpp @@ -254,37 +254,39 @@ CSVWriter::printASCIIInt( } void -CSVWriter::printWeather(std::vector weatherHistory) +CSVWriter::printIgnitions(std::unordered_map ignitionsHistory) { - std::ofstream ofs(this->fileName, std::ofstream::out); + std::ofstream ofs(fileName, std::ofstream::out); int i; - for (i = 0; i < weatherHistory.size(); i++) + // Print column titles + ofs << "sim,point\n"; + + // Iterate through the map and print key-value pairs + for (i = 1; i < ignitionsHistory.size() + 1; i++) { - ofs << weatherHistory[i] << "\n"; + ofs << i << "," << ignitionsHistory[i] << "\n"; + // ofs << i << "," << ignitionsHistory[i-1] << "\n"; } + // Close file ofs.close(); } void -CSVWriter::printIgnitions(std::unordered_map ignitionsHistory) +CSVWriter::printWeathers(std::unordered_map weathersHistory) { std::ofstream ofs(fileName, std::ofstream::out); int i; // Print column titles - ofs << "sim,point\n"; + ofs << "sim,weatherfile\n"; // Iterate through the map and print key-value pairs - for (i = 1; i < ignitionsHistory.size() + 1; i++) + for (i = 1; i < weathersHistory.size() + 1; i++) { - ofs << i << "," << ignitionsHistory[i] << "\n"; - // ofs << i << "," << ignitionsHistory[i-1] << "\n"; + ofs << i << "," << weathersHistory[i] << "\n"; } - - // Close file - ofs.close(); } void diff --git a/Cell2Fire/WriteCSV.h b/Cell2Fire/WriteCSV.h index ea20f493..f11bf4d0 100644 --- a/Cell2Fire/WriteCSV.h +++ b/Cell2Fire/WriteCSV.h @@ -42,7 +42,7 @@ class CSVWriter void printASCIIInt(int rows, int cols, double xllcorner, double yllcorner, int cellside, std::vector statusCells); void asciiHeader(int rows, int cols, double xllcorner, double yllcorner, int cellside); - void printWeather(std::vector weatherHistory); + void printWeathers(std::unordered_map weathersHistory); void printIgnitions(std::unordered_map ignitionsHistory); void printCSV_V2(int rows, int cols, std::vector statusCells); // Function to create a directory diff --git a/test/target_results.zip b/test/target_results.zip index 00ed82b5..528c4d8f 100644 Binary files a/test/target_results.zip and b/test/target_results.zip differ