|
18 | 18 | */
|
19 | 19 |
|
20 | 20 | #include "MRIOTable.h"
|
21 |
| -#include <ncDim.h> |
22 |
| -#include <ncFile.h> |
23 |
| -#include <ncVar.h> |
24 | 21 | #include <algorithm>
|
25 | 22 | #include <cmath>
|
26 | 23 | #include <cstdlib>
|
27 | 24 | #include <iomanip>
|
28 | 25 | #include <iostream>
|
29 |
| -#include <netcdf> |
30 | 26 | #include <sstream>
|
31 | 27 | #include <stdexcept>
|
| 28 | +#ifdef LIBMRIO_NETCDF |
| 29 | +#include <ncDim.h> |
| 30 | +#include <ncFile.h> |
| 31 | +#include <ncVar.h> |
| 32 | +#include <netcdf> |
| 33 | +#endif |
32 | 34 | #include "MRIOIndexSet.h"
|
33 | 35 | #include "csv-parser.h"
|
34 | 36 |
|
@@ -254,6 +256,7 @@ void Table<T, I>::write_to_mrio(std::ostream& outstream) const {
|
254 | 256 | }
|
255 | 257 | }
|
256 | 258 |
|
| 259 | +#ifdef LIBMRIO_NETCDF |
257 | 260 | template<typename T, typename I>
|
258 | 261 | void Table<T, I>::read_from_netcdf(const std::string& filename, const T& threshold) {
|
259 | 262 | netCDF::NcFile file(filename, netCDF::NcFile::read);
|
@@ -335,7 +338,9 @@ void Table<T, I>::read_from_netcdf(const std::string& filename, const T& thresho
|
335 | 338 | }
|
336 | 339 | index_set_.rebuild_indices();
|
337 | 340 | }
|
| 341 | +#endif |
338 | 342 |
|
| 343 | +#ifdef LIBMRIO_NETCDF |
339 | 344 | template<typename T, typename I>
|
340 | 345 | void Table<T, I>::write_to_netcdf(const std::string& filename) const {
|
341 | 346 | debug_out();
|
@@ -389,6 +394,7 @@ void Table<T, I>::write_to_netcdf(const std::string& filename) const {
|
389 | 394 | flows_var.setFill<T>(true, std::numeric_limits<T>::quiet_NaN());
|
390 | 395 | flows_var.putVar(&data[0]);
|
391 | 396 | }
|
| 397 | +#endif |
392 | 398 |
|
393 | 399 | template<typename T, typename I>
|
394 | 400 | void Table<T, I>::insert_sector_offset_x_y(const SuperSector<I>* i, const I& i_regions_count, const I& subsectors_count) {
|
@@ -546,9 +552,9 @@ void Table<T, I>::debug_out() const {
|
546 | 552 | std::cout << std::setprecision(3) << std::fixed;
|
547 | 553 | for (const auto& y : index_set_.total_indices) {
|
548 | 554 | std::cout << index_set_.at(y.sector, y.region) << " " << y.sector->name << " " << (!y.sector->parent() ? " " : y.sector->parent()->name) << " "
|
549 |
| - << (y.sector->parent() ? *y.sector->parent() : *y.sector) << " " << (*y.sector) << " " << y.sector->level_index() << " " << y.region->name << " " |
550 |
| - << (!y.region->parent() ? " " : y.region->parent()->name) << " " << (y.region->parent() ? *y.region->parent() : *y.region) << " " |
551 |
| - << (*y.region) << " " << y.region->level_index() << " | "; |
| 555 | + << (y.sector->parent() ? *y.sector->parent() : *y.sector) << " " << (*y.sector) << " " << y.sector->level_index() << " " << y.region->name |
| 556 | + << " " << (!y.region->parent() ? " " : y.region->parent()->name) << " " << (y.region->parent() ? *y.region->parent() : *y.region) << " " |
| 557 | + << (*y.region) << " " << y.region->level_index() << " | "; |
552 | 558 | for (const auto& x : index_set_.total_indices) {
|
553 | 559 | if (data[x.index * index_set_.size() + y.index] <= 0) {
|
554 | 560 | std::cout << " . ";
|
|
0 commit comments