eceinput.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file eceinput.h
  3. /// \brief Input module copied from demoinput.h for EC-Earth data (ecev3). Paul Miller
  4. ///
  5. /// \author Joe Siltberg
  6. /// $Date: 2018-02-02 18:01:35 +0100 (ven, 02 fév 2018) $
  7. ///
  8. ///////////////////////////////////////////////////////////////////////////////////////
  9. #ifndef LPJ_GUESS_ECEINPUT_H
  10. #define LPJ_GUESS_ECEINPUT_H
  11. #include "guess.h"
  12. #include "inputmodule.h"
  13. #include <vector>
  14. #include "gutil.h"
  15. #include "externalinput.h"
  16. /// An input module for EC-Earth
  17. /** This input module will read and provide LULCC, crop and management info for EC-Earth runs
  18. *
  19. * \see InputModule for more documentation about writing input modules.
  20. */
  21. class EceInput : public InputModule {
  22. public:
  23. /// Constructor
  24. /** Declares the instruction file parameters used by the input module.
  25. */
  26. EceInput();
  27. /// Destructor, cleans up used resources
  28. ~EceInput();
  29. /// Reads in gridlist and initialises the input module
  30. /** Gets called after the instruction file has been read */
  31. void init();
  32. /// See base class for documentation about this function's responsibilities
  33. bool getgridcell(Gridcell& gridcell);
  34. /// See base class for documentation about this function's responsibilities
  35. bool getclimate(Gridcell& gridcell);
  36. /// See base class for documentation about this function's responsibilities
  37. void getlandcover(Gridcell& gridcell);
  38. /// Obtains land management data for one day
  39. void getmanagement(Gridcell& gridcell) {management_input.getmanagement(gridcell, landcover_input);}
  40. private:
  41. /// Type for storing grid cell longitude, latitude and description text
  42. struct Coord {
  43. int id;
  44. float lon;
  45. float lat;
  46. // xtring descrip;
  47. };
  48. /// Land cover input module
  49. LandcoverInput landcover_input;
  50. /// Management input module
  51. ManagementInput management_input;
  52. /// Help function to readenv, reads in 12 monthly values from a text file
  53. bool read_from_file(Coord coord, xtring fname, const char* format,
  54. double monthly[12], bool soil = false);
  55. /// Reads in environmental data for a location
  56. bool readenv(Coord coord, long& seed);
  57. /// number of simulation years to run after spinup
  58. int nyear;
  59. /// A list of Coord objects containing coordinates of the grid cells to simulate
  60. ListArray_id<Coord> gridlist;
  61. /// Flag for getgridcell(). True indicates that the first gridcell has not been read yet by getgridcell()
  62. bool first_call;
  63. // Timers for keeping track of progress through the simulation
  64. Timer tprogress,tmute;
  65. static const int MUTESEC=20; // minimum number of sec to wait between progress messages
  66. /*
  67. // ecev3 - not needed
  68. // Daily temperature, precipitation and sunshine for one year
  69. double dtemp[Date::MAX_YEAR_LENGTH];
  70. double dprec[Date::MAX_YEAR_LENGTH];
  71. double dsun[Date::MAX_YEAR_LENGTH];
  72. // bvoc
  73. // Daily diurnal temperature range for one year
  74. double ddtr[Date::MAX_YEAR_LENGTH];
  75. /// atmospheric CO2 concentration (ppmv) (read from ins file)
  76. double co2;
  77. /// atmospheric nitrogen deposition (kgN/yr/ha) (read from ins file)
  78. double ndep;
  79. */
  80. };
  81. #endif // LPJ_GUESS_ECEINPUT_H