ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
PollenNectarDevelopmentData Class Reference

A class to manage a range of pollen and nectar development curves based on indexed rates. More...

#include <PollenNectar.h>

Public Member Functions

 PollenNectarDevelopmentData (string a_toleinputfile="default", string a_tovinputfile="default")
 
 ~PollenNectarDevelopmentData ()
 
void RecalculatePollenNectarCurvesForYear (void)
 Recalculate the pollen and nectar curves for a year for the habitat species. This function only be called once per year (the first day in a year). More...
 
void ReadFlowerNumberCrop (void)
 Function to read the flower number for crops. More...
 
PollenNectarDevelopmentCurveSettovGetPollenNectarCurve (TTypesOfVegetation a_tov_ref)
 
int tovGetPollenNectarCurveRef (TTypesOfVegetation a_tov_ref)
 
bool tovGetPollenNectarCurveSowingFlag (TTypesOfVegetation a_tov_ref)
 
PollenNectarDevelopmentCurveSetGetPollenNectarCurve (int a_ref)
 
void updateHabitatFlowerResource (void)
 The function to update the development of flower resource for all the habitat speccies. More...
 
PollenNectarData supplyPollenHabitatSpeciesCurrentDay (int a_curve_num)
 Supply the current pollen for the given species. More...
 
PollenNectarData supplyNectarHabitatSpeciesCurrentDay (int a_curve_num)
 Supply the current nectar for the given species. More...
 
PollenNectarData supplyPollenHabitatSpeciesGivenDay (int a_curve_num, int a_given_day)
 Supply the pollen for the given species for the given day after today. More...
 
PollenNectarData supplyNectarHabitatSpeciesGivenDay (int a_curve_num, int a_given_day)
 Supply the current nectar for the given species for the given day after today. More...
 

Protected Attributes

Eigen::ArrayXd m_year_temp = Eigen::ArrayXd::Zero(365)
 This is used to store one year temperature data. More...
 
std::map< int, PollenNectarDevelopmentCurveSetm_ResourceCurves
 This is the main data set, it contains the resource curves for each species. More...
 
std::map< int, std::vector< PollenNectarData > > m_pollen_habitat_species
 This is the dictionary to store the pollen for every habitat species in a year. More...
 
std::map< int, std::vector< PollenNectarData > > m_nectar_habitat_species
 This is the dictionary to store the nectar for every habitat species in a year. More...
 
vector< int > m_tov_PollenCurveTable
 This is a look-up table, it contains for each tov the corresponding curve number to use. More...
 
vector< bool > m_tov_PollenCurveTable_sowing_flag
 This is a look-up table for the the crops to indicate it starts to accumulate degree days from sowing time. More...
 
int m_num_species_habitat
 This is used to store the number of species for habitat. More...
 
std::map< int, double > m_flower_number_crop
 The array to store the flower numbers for crop species. More...
 

Detailed Description

A class to manage a range of pollen and nectar development curves based on indexed rates.

Constructor & Destructor Documentation

◆ PollenNectarDevelopmentData()

PollenNectarDevelopmentData::PollenNectarDevelopmentData ( string  a_toleinputfile = "default",
string  a_tovinputfile = "default" 
)

Reads in the number of pollen and nectar curves.

99 {
102  // This forms an empty entry for no pollen or nectar tov types or for the case when pollen and nectar are not used
105  m_ResourceCurves.insert({0, curveset});
106  // make space in the lookup table for all tov types
109 
110  // set the lookup table for crop, by default they don't have pollen or nectar
111  for (int i = 0; i < int(tov_Undefined); i++){
112  m_tov_PollenCurveTable[i] = 0;
113  m_tov_PollenCurveTable_sowing_flag[i] = true; //by default, all the crops start to accumulate degree days from the sowing time in a year
114  }
115 
116  //load the pollen and nectar data
118  {
119  ifstream infile1, infile2;
120  std::string filename;
121  // First the habitat file
122  if (strcmp(a_inputfile.c_str(), "default") == 0)
123  filename = l_map_nectarpollen.value();
124  else
125  filename = a_inputfile.c_str();
126  std::cout << "Reading Habitats Nectar Pollen File " << filename << "\n";
127  infile1.open(filename, ios::in);
128  //check if there is an input file
129  if (!infile1.is_open()) {
130  g_msg->Warn("PollenNectarDevelopmentData::PollenNectarDevelopmentData Cannot open the file", filename);
131  exit(1);
132  }
133 
134  // Now the tov file
135  if (strcmp(a_tovinputfile.c_str(), "default") == 0)
136  filename = l_map_tov_nectarpollen.value();
137  else
138  filename = a_tovinputfile.c_str();
139  std::cout << "Reading TOV Nectar Pollen File " << filename << "\n";
140  infile2.open(filename, ios::in);
141  //check if there is an input file
142  if (!infile2.is_open()) {
143  g_msg->Warn("PollenNectarDevelopmentData::PollenNectarDevelopmentData Cannot open the file", filename);
144  exit(1);
145  }
146 
147  //okay, load the habitat species data
148  int no_curves;
149  int tov, curvenum, realtov, nopoints;
150  double threshold, up_threshold, nectar_amount, sugar_amount, pollen_amount, honeybee_pollen, osmia_pollen, bumblebee_pollen, start_add, end_add, min_flower_length, max_flower_length, mean_flower_length, std_flower_length, value;
151  // First the habitat file
152  infile1 >> no_curves; // read the number of data curves needed
153  m_num_species_habitat = no_curves;
154  // Now read the curves themselves
155  for (int i = 0; i < no_curves; i++)
156  {
158  curveset.m_flag_not_enough_data = false;
159  infile1 >> curvenum >> threshold >> up_threshold >> nectar_amount >> sugar_amount >> pollen_amount >> honeybee_pollen >> osmia_pollen >> bumblebee_pollen >> start_add >> end_add >> min_flower_length >> max_flower_length >> mean_flower_length >> std_flower_length;
160 
161  //missing data
162  if(start_add <= -1 || end_add <= -1 || (nectar_amount == -1 && sugar_amount == -1 && pollen_amount == -1)){
163  curveset.m_flag_not_enough_data = true;
164  }
165 
166  curveset.m_curve_number = curvenum;
168  curveset.m_MaxDDeg = up_threshold;
169  curveset.m_MinFlowerLength = min_flower_length;
170  curveset.m_MaxFlowerLength = max_flower_length;
171  curveset.m_MeanFlowerLength = mean_flower_length;
172  curveset.m_StdFlowerLength = std_flower_length;
173  curveset.m_starting_DD_flowering = start_add;
174  curveset.m_ending_DD_flowering = end_add;
175  curveset.m_pollen_quality = honeybee_pollen;
176  curveset.m_total_nectar_whole_flowering = nectar_amount > 0 ? nectar_amount : 0.0;
177  curveset.m_total_sugar_whole_flowering = sugar_amount > 0 ? sugar_amount : 0.0;
178  curveset.m_total_pollen_whole_flowering = pollen_amount > 0 ? pollen_amount : 0.0;
182  //if(nectar_amount<sugar_amount){
183  // cout<<"Warning: nectar amount is less than sugar amount for curve "<<curvenum<<endl;
184  //}
185  //set the curve not be used
186  if(start_add == -1 || end_add == -1){
187  curveset.m_flag_not_enough_data = true;
188  }
189  //when running osmia, we use the osmia pollen quality
190  if(g_Species == TOP_Osmia){
191  curveset.m_pollen_quality = osmia_pollen;
192  }
193  //when running bumblebee, we use the bumblebee pollen quality
194  if(g_Species == TOP_Bombus){
195  curveset.m_pollen_quality = bumblebee_pollen;
196  }
197  m_ResourceCurves.insert({curvenum, curveset});
198  m_pollen_habitat_species.insert({curvenum, std::vector<PollenNectarData>(365)});
199  m_nectar_habitat_species.insert({curvenum,std::vector<PollenNectarData>(365)});
200  }
201  infile1.close();
202 
203 
204 
205  // Now the tov file
206  int mapping_num, sowing_start_dd_flag;
207  infile2 >> mapping_num;
208  infile2 >> no_curves; // read the number of pairs needed
209  std::map<int, int> temp_tov_sowing_flag;
210  for (int i=0; i< mapping_num; i++ )
211  {
212  infile2 >> tov >> curvenum >> sowing_start_dd_flag;
213  // convert from the reference number to tov type
214  realtov = g_letype->TranslateVegTypes(tov);
215  // store the reference in the pollen nectar lookup table
216  m_tov_PollenCurveTable[realtov] = curvenum;
217  if(sowing_start_dd_flag < 0){
218  m_tov_PollenCurveTable_sowing_flag[realtov] = false;
219  temp_tov_sowing_flag.insert({curvenum, false});
220  }
221  else{
222  temp_tov_sowing_flag.insert({curvenum, true});
223  }
224  }
225 
226  // Now read the curves themselves
227  for (int i = 0; i < no_curves; i++)
228  {
230  curveset.m_flag_not_enough_data = false;
231  infile2 >> curvenum >> threshold >> up_threshold >> nectar_amount >> sugar_amount >> pollen_amount >> honeybee_pollen >> osmia_pollen >> bumblebee_pollen >> start_add >> end_add >> min_flower_length >> max_flower_length >> mean_flower_length >> std_flower_length;
232 
233  //missing data
234  if(start_add <= -1 || end_add <= -1){
235  curveset.m_flag_not_enough_data = true;
236  }
237  curveset.m_curve_number = curvenum;
238  curveset.m_DDthreshold = threshold;//-cfg_GeneralColdWeatherAdjustFlower.value(); //avoid very late for starting of flowering
239  if(temp_tov_sowing_flag[curvenum] == false){
240  curveset.m_DDthreshold = threshold-cfg_GeneralColdWeatherAdjustFlower.value(); //avoid very late for starting of flowering only for the crops which start to accumulate degree days from the beginning time in a year and have a very late flowering period
241  }
242  curveset.m_MaxDDeg = up_threshold;
243  curveset.m_MinFlowerLength = min_flower_length;
244  curveset.m_MaxFlowerLength = max_flower_length;
245  curveset.m_MeanFlowerLength = mean_flower_length;
246  curveset.m_StdFlowerLength = std_flower_length;
247  curveset.m_starting_DD_flowering = start_add;
248  curveset.m_ending_DD_flowering = end_add;
249  curveset.m_pollen_quality = honeybee_pollen;
250  curveset.m_total_nectar_whole_flowering = (nectar_amount > 0 ? nectar_amount : 0.0)*(m_flower_number_crop[curvenum] > 0 ? m_flower_number_crop[curvenum] : 0);
251  curveset.m_total_sugar_whole_flowering = (sugar_amount > 0 ? sugar_amount : 0.0)*(m_flower_number_crop[curvenum] > 0 ? m_flower_number_crop[curvenum] : 0);
252  curveset.m_total_pollen_whole_flowering = (pollen_amount > 0 ? pollen_amount : 0.0)*(m_flower_number_crop[curvenum] > 0 ? m_flower_number_crop[curvenum] : 0);
256  //set the curve not be used
257  if(start_add == -1 || end_add == -1 || (nectar_amount == -1 && sugar_amount == -1 && pollen_amount == -1)){
258  curveset.m_flag_not_enough_data = true;
259  }
260  //when running osmia, we use the osmia pollen quality
261  if(g_Species == TOP_Osmia){
262  curveset.m_pollen_quality = osmia_pollen;
263  }
264  //when running bumblebee, we use the bumblebee pollen quality
265  if(g_Species == TOP_Bombus){
266  curveset.m_pollen_quality = bumblebee_pollen;
267  }
268  m_ResourceCurves.insert({curvenum, curveset});
269  }
270  infile2.close();
271  }
272 }

References cfg_FlowerPollenNectarScaler, cfg_GeneralColdWeatherAdjustFlower, cfg_pollen_nectar_on, g_letype, g_msg, g_Species, l_map_nectarpollen, l_map_tov_nectarpollen, PollenNectarDevelopmentCurveSet::m_curve_number, PollenNectarDevelopmentCurveSet::m_DDthreshold, PollenNectarDevelopmentCurveSet::m_ending_DD_flowering, PollenNectarDevelopmentCurveSet::m_flag_not_enough_data, m_flower_number_crop, PollenNectarDevelopmentCurveSet::m_MaxDDeg, PollenNectarDevelopmentCurveSet::m_MaxFlowerLength, PollenNectarDevelopmentCurveSet::m_MeanFlowerLength, PollenNectarDevelopmentCurveSet::m_MinFlowerLength, m_nectar_habitat_species, m_num_species_habitat, m_pollen_habitat_species, PollenNectarDevelopmentCurveSet::m_pollen_quality, m_ResourceCurves, PollenNectarDevelopmentCurveSet::m_starting_DD_flowering, PollenNectarDevelopmentCurveSet::m_StdFlowerLength, PollenNectarDevelopmentCurveSet::m_total_nectar_whole_flowering, PollenNectarDevelopmentCurveSet::m_total_pollen_whole_flowering, PollenNectarDevelopmentCurveSet::m_total_sugar_whole_flowering, m_tov_PollenCurveTable, m_tov_PollenCurveTable_sowing_flag, ReadFlowerNumberCrop(), TOP_Bombus, TOP_Osmia, tov_Undefined, LE_TypeClass::TranslateVegTypes(), CfgFloat::value(), CfgBool::value(), CfgStr::value(), and MapErrorMsg::Warn().

◆ ~PollenNectarDevelopmentData()

PollenNectarDevelopmentData::~PollenNectarDevelopmentData ( )
275 {
276  m_ResourceCurves.clear();
277  m_tov_PollenCurveTable.clear();
278 }

References m_ResourceCurves, and m_tov_PollenCurveTable.

Member Function Documentation

◆ GetPollenNectarCurve()

PollenNectarDevelopmentCurveSet* PollenNectarDevelopmentData::GetPollenNectarCurve ( int  a_ref)
inline
230  {
231  return &m_ResourceCurves[a_ref];
232  }

References m_ResourceCurves.

Referenced by tovGetPollenNectarCurve().

◆ ReadFlowerNumberCrop()

void PollenNectarDevelopmentData::ReadFlowerNumberCrop ( void  )

Function to read the flower number for crops.

72  {
73  std::cout << "Reading Crop Flower Number File " << l_flower_number_crops.value() << "\n";
74  ifstream infile_crop_number;
75  infile_crop_number.open(l_flower_number_crops.value(), ios::in);
76  //check if there is an input file
77  if (!infile_crop_number.is_open()) {
78  g_msg->Warn("PollenNectarDevelopmentData::ReadFlowerNumberCrop() Cannot open the file", l_flower_number_crops.value());
79  exit(1);
80  }
81 
82 
83  int crop_number;
84  infile_crop_number >> crop_number;
85 
86  int tov_curve_ref;
87  double flower_num;
88  double rubbish;
89  string species_name; // this is droped, not stored
90  string flower_unit_type;
91  for(int i=0; i<crop_number; i++){
92  infile_crop_number >> species_name >> flower_unit_type >> rubbish >> tov_curve_ref >> flower_num >> rubbish >> rubbish >> rubbish >> rubbish >> rubbish >> rubbish >> rubbish >> rubbish >> rubbish >> rubbish;
93  m_flower_number_crop.insert({tov_curve_ref, flower_num});
94  }
95  infile_crop_number.close();
96 }

References g_msg, l_flower_number_crops, m_flower_number_crop, CfgStr::value(), and MapErrorMsg::Warn().

Referenced by PollenNectarDevelopmentData().

◆ RecalculatePollenNectarCurvesForYear()

void PollenNectarDevelopmentData::RecalculatePollenNectarCurvesForYear ( void  )

Recalculate the pollen and nectar curves for a year for the habitat species. This function only be called once per year (the first day in a year).

396  {
397  //for get a year's temperature data
398  for(int i=0; i<365; i++){
400  }
401 
402 
403  //calculate the flowering period for each species which uses the first day as the starting day for accumulating degree days
404  Eigen::ArrayXd temp_dd = Eigen::ArrayXd::Zero(365);
405  for (auto& [key, value] : m_ResourceCurves){
406  //only do it for the species which starts to accumulate degree days from the first day in a year
407  //not do this for crops
408  if(key > 10000) continue;
409  //skip default curve
410  if(key != 0 && !(value.m_flag_not_enough_data)){
411  //if(key == 255)
412  // int test = 0;
413  temp_dd = m_year_temp;
414  double max_temp = value.GetMaxDDeg();
415  temp_dd = (temp_dd > max_temp).select(max_temp, temp_dd);
416  temp_dd -= value.GetThreshold();
417  temp_dd = (temp_dd < 0).select(0, temp_dd);
418 
419  //get the flowering period
420  double temp_starting_dd = value.GetStartingDDFlowering();
421  double temp_ending_dd = value.GetEndingDDFlowering();
422  double temp_add = 0.0;
423  int temp_starting_day = 0;
424  for(int i=0; i<365; i++){
425  temp_add += temp_dd(i);
426  temp_starting_day = i;
427  if(temp_add >= temp_starting_dd){
428  break;
429  }
430  }
431  //cout <<"curve number" << key << "temp_starting_day " << temp_starting_day << endl;
432  value.SetStartingDayFlowering(temp_starting_day);
433  for(int i=temp_starting_day+1; i<365; i++){
434  temp_add += temp_dd(i);
435  if(m_year_temp(i)<0 && i > 270){
436  temp_add += m_year_temp(i)*m_year_temp(i);
437  }
438  temp_starting_day = i;
439  if(temp_add >= temp_ending_dd){
440  break;
441  }
442  }
443  value.SetEndingDayFlowering(temp_starting_day);
444  //cout <<"curve number" << key << "temp_ending_day " << temp_starting_day << endl;
445  //now update the resource now
446  value.UpdateFlowerResource();
447  }
448  }
449 
450  //now update the habitat resource for one year
452 }

References g_weather, Weather::GetTempAfterDays(), m_ResourceCurves, m_year_temp, and updateHabitatFlowerResource().

Referenced by Landscape::Tick().

◆ supplyNectarHabitatSpeciesCurrentDay()

PollenNectarData PollenNectarDevelopmentData::supplyNectarHabitatSpeciesCurrentDay ( int  a_curve_num)

Supply the current nectar for the given species.

338  {
339  if(m_ResourceCurves[a_curve_num].m_flag_not_enough_data){
340  return PollenNectarData(0.0, 0.0);
341  }
342  return m_nectar_habitat_species[a_curve_num][g_date->DayInYear()];
343 }

References Calendar::DayInYear(), g_date, m_nectar_habitat_species, and m_ResourceCurves.

Referenced by Landscape::CalHaibitatFlowerResource().

◆ supplyNectarHabitatSpeciesGivenDay()

PollenNectarData PollenNectarDevelopmentData::supplyNectarHabitatSpeciesGivenDay ( int  a_curve_num,
int  a_given_day 
)

Supply the current nectar for the given species for the given day after today.

354  {
355  if(m_ResourceCurves[a_curve_num].m_flag_not_enough_data){
356  return PollenNectarData(0.0, 0.0);
357  }
358  int temp_day = g_date->DayInYear()+a_given_day;
359  if(temp_day>=364) temp_day = 364;
360  return m_nectar_habitat_species[a_curve_num][temp_day];
361 }

References Calendar::DayInYear(), g_date, m_nectar_habitat_species, and m_ResourceCurves.

Referenced by Landscape::CalHaibitatFlowerResource().

◆ supplyPollenHabitatSpeciesCurrentDay()

PollenNectarData PollenNectarDevelopmentData::supplyPollenHabitatSpeciesCurrentDay ( int  a_curve_num)

Supply the current pollen for the given species.

331  {
332  if(m_ResourceCurves[a_curve_num].m_flag_not_enough_data){
333  return PollenNectarData(0.0, 0.0);
334  }
335  return m_pollen_habitat_species[a_curve_num][g_date->DayInYear()];
336 }

References Calendar::DayInYear(), g_date, m_pollen_habitat_species, and m_ResourceCurves.

Referenced by Landscape::CalHaibitatFlowerResource().

◆ supplyPollenHabitatSpeciesGivenDay()

PollenNectarData PollenNectarDevelopmentData::supplyPollenHabitatSpeciesGivenDay ( int  a_curve_num,
int  a_given_day 
)

Supply the pollen for the given species for the given day after today.

345  {
346  if(m_ResourceCurves[a_curve_num].m_flag_not_enough_data){
347  return PollenNectarData(0.0, 0.0);
348  }
349  int temp_day = g_date->DayInYear()+a_given_day;
350  if(temp_day>=364) temp_day = 364;
351  return m_pollen_habitat_species[a_curve_num][temp_day];
352 }

References Calendar::DayInYear(), g_date, m_pollen_habitat_species, and m_ResourceCurves.

Referenced by Landscape::CalHaibitatFlowerResource().

◆ tovGetPollenNectarCurve()

PollenNectarDevelopmentCurveSet* PollenNectarDevelopmentData::tovGetPollenNectarCurve ( TTypesOfVegetation  a_tov_ref)
inline

Uses the tov ref num to find the relevant curve set and return it as a pointer.

205  {
209  int refnum = m_tov_PollenCurveTable[a_tov_ref];
210  return GetPollenNectarCurve(refnum);
211  }

References GetPollenNectarCurve(), and m_tov_PollenCurveTable.

Referenced by LE::SetPollenNectarType().

◆ tovGetPollenNectarCurveRef()

int PollenNectarDevelopmentData::tovGetPollenNectarCurveRef ( TTypesOfVegetation  a_tov_ref)
inline

Uses the tov ref num to find the relevant curve set and return it as a pointer.

214  {
218  return m_tov_PollenCurveTable[a_tov_ref];
219  }

References m_tov_PollenCurveTable.

Referenced by LE::SetPollenNectarType().

◆ tovGetPollenNectarCurveSowingFlag()

bool PollenNectarDevelopmentData::tovGetPollenNectarCurveSowingFlag ( TTypesOfVegetation  a_tov_ref)
inline

Uses the tov ref num to find the relevant curve set and return it as a pointer.

222  {
226  return m_tov_PollenCurveTable_sowing_flag[a_tov_ref];
227  }

References m_tov_PollenCurveTable_sowing_flag.

Referenced by LE::CalculateFlowerResourceForCropSow(), and VegElement::DoDevelopment().

◆ updateHabitatFlowerResource()

void PollenNectarDevelopmentData::updateHabitatFlowerResource ( void  )

The function to update the development of flower resource for all the habitat speccies.

364  {
365  //pollen
366  PollenNectarData temp;
367  for (auto& [key, value] : m_pollen_habitat_species){
368  if(m_ResourceCurves[key].m_flag_not_enough_data){
369  continue;
370  }
371  for(int i=0; i<365; i++){
372  temp.m_quantity = m_ResourceCurves[key].getPollen(i);
373  temp.m_quality = m_ResourceCurves[key].getPollenQuality(i);
374  value[i] = temp;
375  }
376  }
377 
378  //nectar
379  for (auto& [key, value] : m_nectar_habitat_species){
380  if(m_ResourceCurves[key].m_flag_not_enough_data){
381  continue;
382  }
383  for(int i=0; i<365; i++){
384  temp.m_quantity = m_ResourceCurves[key].getNectar(i);
385  temp.m_quality = m_ResourceCurves[key].getSugar(i);
386  //if(key == 495)
387  // cout<<i<<"test"<<temp.m_quality<<endl;
388  //if(temp.m_quality > temp.m_quantity){
389  // cout<<"Warning: nectar quality is more than nectar quantity for curve "<<key<<endl;
390  //}
391  value[i] = temp;
392  }
393  }
394 }

References m_nectar_habitat_species, m_pollen_habitat_species, PollenNectarData::m_quality, PollenNectarData::m_quantity, and m_ResourceCurves.

Referenced by RecalculatePollenNectarCurvesForYear().

Member Data Documentation

◆ m_flower_number_crop

std::map<int, double> PollenNectarDevelopmentData::m_flower_number_crop
protected

The array to store the flower numbers for crop species.

Referenced by PollenNectarDevelopmentData(), and ReadFlowerNumberCrop().

◆ m_nectar_habitat_species

std::map<int, std::vector<PollenNectarData> > PollenNectarDevelopmentData::m_nectar_habitat_species
protected

This is the dictionary to store the nectar for every habitat species in a year.

Referenced by PollenNectarDevelopmentData(), supplyNectarHabitatSpeciesCurrentDay(), supplyNectarHabitatSpeciesGivenDay(), and updateHabitatFlowerResource().

◆ m_num_species_habitat

int PollenNectarDevelopmentData::m_num_species_habitat
protected

This is used to store the number of species for habitat.

Referenced by PollenNectarDevelopmentData().

◆ m_pollen_habitat_species

std::map<int, std::vector<PollenNectarData> > PollenNectarDevelopmentData::m_pollen_habitat_species
protected

This is the dictionary to store the pollen for every habitat species in a year.

Referenced by PollenNectarDevelopmentData(), supplyPollenHabitatSpeciesCurrentDay(), supplyPollenHabitatSpeciesGivenDay(), and updateHabitatFlowerResource().

◆ m_ResourceCurves

◆ m_tov_PollenCurveTable

vector<int> PollenNectarDevelopmentData::m_tov_PollenCurveTable
protected

This is a look-up table, it contains for each tov the corresponding curve number to use.

Referenced by PollenNectarDevelopmentData(), tovGetPollenNectarCurve(), tovGetPollenNectarCurveRef(), and ~PollenNectarDevelopmentData().

◆ m_tov_PollenCurveTable_sowing_flag

vector<bool> PollenNectarDevelopmentData::m_tov_PollenCurveTable_sowing_flag
protected

This is a look-up table for the the crops to indicate it starts to accumulate degree days from sowing time.

Referenced by PollenNectarDevelopmentData(), and tovGetPollenNectarCurveSowingFlag().

◆ m_year_temp

Eigen::ArrayXd PollenNectarDevelopmentData::m_year_temp = Eigen::ArrayXd::Zero(365)
protected

This is used to store one year temperature data.

Referenced by RecalculatePollenNectarCurvesForYear().


The documentation for this class was generated from the following files:
PollenNectarDevelopmentData::m_tov_PollenCurveTable_sowing_flag
vector< bool > m_tov_PollenCurveTable_sowing_flag
This is a look-up table for the the crops to indicate it starts to accumulate degree days from sowing...
Definition: PollenNectar.h:188
PollenNectarDevelopmentData::m_num_species_habitat
int m_num_species_habitat
This is used to store the number of species for habitat.
Definition: PollenNectar.h:190
PollenNectarDevelopmentCurveSet::m_ending_DD_flowering
double m_ending_DD_flowering
The ending degree days for ending flowering period.
Definition: PollenNectar.h:69
PollenNectarDevelopmentCurveSet::m_MinFlowerLength
double m_MinFlowerLength
The minimum flowering length.
Definition: PollenNectar.h:59
PollenNectarDevelopmentCurveSet::m_starting_DD_flowering
double m_starting_DD_flowering
The starting degree days for starting flowering period.
Definition: PollenNectar.h:67
TOP_Bombus
Definition: PopulationManager.h:73
CfgStr::value
char * value() const
Definition: Configurator.h:182
PollenNectarDevelopmentCurveSet::m_MeanFlowerLength
double m_MeanFlowerLength
The mean flowering length.
Definition: PollenNectar.h:63
TOP_Osmia
Definition: PopulationManager.h:69
PollenNectarDevelopmentCurveSet::m_MaxFlowerLength
double m_MaxFlowerLength
The maximum flowering length.
Definition: PollenNectar.h:61
PollenNectarDevelopmentData::m_tov_PollenCurveTable
vector< int > m_tov_PollenCurveTable
This is a look-up table, it contains for each tov the corresponding curve number to use.
Definition: PollenNectar.h:186
PollenNectarDevelopmentCurveSet::m_MaxDDeg
double m_MaxDDeg
The maximum temperature that one day can accumulate.
Definition: PollenNectar.h:57
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
PollenNectarDevelopmentCurveSet
This class justs holds the set of resource curves related to a specific plant community or crop....
Definition: PollenNectar.h:44
CfgFloat::value
double value() const
Definition: Configurator.h:142
PollenNectarDevelopmentCurveSet::m_curve_number
int m_curve_number
The reference number for the curve.
Definition: PollenNectar.h:53
l_map_nectarpollen
static CfgStr l_map_nectarpollen("MAP_NECTARPOLLEN_FILE", CFG_CUSTOM, "species_production_curves.csv")
PollenNectarDevelopmentCurveSet::m_total_sugar_whole_flowering
double m_total_sugar_whole_flowering
The total amount of sugar in the whole flowering period –mg.
Definition: PollenNectar.h:73
PollenNectarDevelopmentData::GetPollenNectarCurve
PollenNectarDevelopmentCurveSet * GetPollenNectarCurve(int a_ref)
Definition: PollenNectar.h:229
PollenNectarDevelopmentData::m_flower_number_crop
std::map< int, double > m_flower_number_crop
The array to store the flower numbers for crop species.
Definition: PollenNectar.h:192
cfg_GeneralColdWeatherAdjustFlower
CfgFloat cfg_GeneralColdWeatherAdjustFlower("GENERAL_COLD_WEATHER_ADJUST_FLOWER", CFG_CUSTOM, 3)
Adjust of the base development for colder weather in colder areas, for flower development in natural ...
PollenNectarData::m_quantity
double m_quantity
Definition: PollenNectar.h:167
CfgBool::value
bool value() const
Definition: Configurator.h:164
PollenNectarDevelopmentCurveSet::m_total_pollen_whole_flowering
double m_total_pollen_whole_flowering
The total amount of pollen in the whole flowering period –mg.
Definition: PollenNectar.h:75
PollenNectarDevelopmentData::m_pollen_habitat_species
std::map< int, std::vector< PollenNectarData > > m_pollen_habitat_species
This is the dictionary to store the pollen for every habitat species in a year.
Definition: PollenNectar.h:182
PollenNectarDevelopmentCurveSet::m_flag_not_enough_data
bool m_flag_not_enough_data
Flag to show not enough data is available, so this curve can't be used.
Definition: PollenNectar.h:51
PollenNectarDevelopmentData::m_year_temp
Eigen::ArrayXd m_year_temp
This is used to store one year temperature data.
Definition: PollenNectar.h:178
l_map_tov_nectarpollen
static CfgStr l_map_tov_nectarpollen("MAP_TOV_NECTARPOLLEN_FILE", CFG_CUSTOM, "tovALMaSSNectarPollenInput.txt")
l_flower_number_crops
static CfgStr l_flower_number_crops("FLOWER_NUMBER_CROPS_FILE", CFG_CUSTOM, "crop_stacks.csv")
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
PollenNectarDevelopmentData::m_nectar_habitat_species
std::map< int, std::vector< PollenNectarData > > m_nectar_habitat_species
This is the dictionary to store the nectar for every habitat species in a year.
Definition: PollenNectar.h:184
tov_Undefined
Definition: LandscapeFarmingEnums.h:610
LE_TypeClass::TranslateVegTypes
TTypesOfVegetation TranslateVegTypes(int VegReference)
Definition: Elements.cpp:3724
cfg_pollen_nectar_on
CfgBool cfg_pollen_nectar_on
Flag to determine whether nectar and pollen models are used - should be set to true for pollinator mo...
g_Species
TTypesOfPopulation g_Species
Definition: PopulationManager.cpp:101
PollenNectarDevelopmentCurveSet::m_total_nectar_whole_flowering
double m_total_nectar_whole_flowering
The total amount of nectar in the whole flowering period –mg.
Definition: PollenNectar.h:71
PollenNectarData
A data class to store nectar or pollen data.
Definition: PollenNectar.h:163
g_weather
class Weather * g_weather
Definition: Weather.cpp:49
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
PollenNectarDevelopmentData::updateHabitatFlowerResource
void updateHabitatFlowerResource(void)
The function to update the development of flower resource for all the habitat speccies.
Definition: PollenNectar.cpp:364
cfg_FlowerPollenNectarScaler
CfgFloat cfg_FlowerPollenNectarScaler
The scalear to reduce flower resource, default 1 which means no reduction.
Definition: PollenNectar.cpp:53
PollenNectarDevelopmentCurveSet::m_StdFlowerLength
double m_StdFlowerLength
The standard value of flower length.
Definition: PollenNectar.h:65
PollenNectarData::m_quality
double m_quality
Definition: PollenNectar.h:168
Calendar::DayInYear
int DayInYear(void)
Definition: Calendar.h:58
PollenNectarDevelopmentCurveSet::m_pollen_quality
double m_pollen_quality
The pollen quality when there is pollen, this also depends the species, by default it uses the apis v...
Definition: PollenNectar.h:77
Weather::GetTempAfterDays
double GetTempAfterDays(int days)
Get the temperature at the given number of days which is the number of days after today.
Definition: Weather.h:484
g_letype
class LE_TypeClass * g_letype
Definition: Elements.cpp:806
PollenNectarDevelopmentData::ReadFlowerNumberCrop
void ReadFlowerNumberCrop(void)
Function to read the flower number for crops.
Definition: PollenNectar.cpp:72
PollenNectarDevelopmentCurveSet::m_DDthreshold
double m_DDthreshold
The threshold temperature to calculate day degrees.
Definition: PollenNectar.h:55
PollenNectarDevelopmentData::m_ResourceCurves
std::map< int, PollenNectarDevelopmentCurveSet > m_ResourceCurves
This is the main data set, it contains the resource curves for each species.
Definition: PollenNectar.h:180