Skip to content

Commit

Permalink
Change function for loading explicit area of burn to work...
Browse files Browse the repository at this point in the history
... with 64bit integers. If we store AOB as m-2, then we need
64bit integers to accomadoate the values.
  • Loading branch information
tobeycarman committed Jul 13, 2021
1 parent 2d924c7 commit e80f583
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/WildFire.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class WildFire {
std::vector<int> exp_burn_mask;
std::vector<int> exp_jday_of_burn;
std::vector<int> exp_fire_severity;
std::vector<int> exp_area_of_burn;
std::vector<int64_t> exp_area_of_burn;



Expand Down
9 changes: 8 additions & 1 deletion src/TEMUtilityFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,16 @@ namespace temutil {
std::vector<DTYPE> data2;

BOOST_LOG_SEV(glg, debug) << "Grab the data from the netCDF file...";
if (the_type == NC_INT64 || NC_INT) {
if (the_type == NC_INT) {
int dataI[timeD_len];
temutil::nc( nc_get_vara_int(ncid, timeseries_var, start, count, &dataI[0]) );
unsigned dataArraySize = sizeof(dataI) / sizeof(DTYPE);
data2.insert(data2.end(), &dataI[0], &dataI[dataArraySize]);
} else if (the_type == NC_INT64) {
int64_t dataI64[timeD_len];
temutil::nc( nc_get_vara(ncid, timeseries_var, start, count, &dataI64[0]) );
unsigned dataArraySize = sizeof(dataI64) / sizeof(DTYPE);
data2.insert(data2.end(), &dataI64[0], &dataI64[dataArraySize]);
} else if (the_type == NC_FLOAT) {
float dataF[timeD_len];
temutil::nc( nc_get_vara_float(ncid, timeseries_var, start, count, &dataF[0]) );
Expand Down Expand Up @@ -1103,6 +1108,8 @@ namespace temutil {

template std::vector<int> get_timeseries<int>(const std::string &filename,
const std::string &var, const int y, const int x);
template std::vector<int64_t> get_timeseries<int64_t>(const std::string &filename,
const std::string &var, const int y, const int x);
template std::vector<float> get_timeseries<float>(const std::string &filename,
const std::string &var, const int y, const int x);

Expand Down
2 changes: 1 addition & 1 deletion src/WildFire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ WildFire::WildFire(const std::string& fri_fname,
this->exp_burn_mask = temutil::get_timeseries<int>(exp_fname, "exp_burn_mask", y, x);
this->exp_fire_severity = temutil::get_timeseries<int>(exp_fname, "exp_fire_severity", y, x);
this->exp_jday_of_burn = temutil::get_timeseries<int>(exp_fname, "exp_jday_of_burn", y, x);
this->exp_area_of_burn = temutil::get_timeseries<int>(exp_fname, "exp_area_of_burn", y, x);
this->exp_area_of_burn = temutil::get_timeseries<int64_t>(exp_fname, "exp_area_of_burn", y, x);
}//End critical(exp_fir)

this->slope = cell_slope;
Expand Down

0 comments on commit e80f583

Please sign in to comment.