20 #include "pism/icemodel/IceModel.hh"
22 #include "pism/util/pism_options.hh"
23 #include "pism/util/pism_utilities.hh"
31 const std::set<std::string> &input) {
32 std::set<std::string> result = input;
34 if (result.find(
"ismip6") != result.end()) {
35 result.erase(
"ismip6");
49 auto times =
m_config->get_string(
"output.timeseries.times");
50 bool times_set = not times.empty();
54 "you need to specity both -ts_file and -ts_times"
55 " to save scalar diagnostic time-series.");
65 e.
add_context(
"parsing the -ts_times argument %s", times.c_str());
70 m_log->message(2,
" times requested: %s\n", times.c_str());
81 bool append =
m_config->get_flag(
"output.timeseries.append");
88 epsilon =
m_config->get_number(
"time_stepping.resolution"),
92 if (t + epsilon < m_ts_times->front()) {
110 if ((not
m_config->get_flag(
"time_stepping.hit_ts_times")) or
115 double eps =
m_config->get_number(
"time_stepping.resolution");
118 "reporting (-ts_times)");
std::string get_string(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
A class for storing and accessing PISM configuration flags and parameters.
unsigned int dimension_length(const std::string &name) const
Get the length of a dimension.
std::vector< double > read_dimension(const std::string &name) const
Get dimension data (a coordinate variable).
High-level PISM I/O class.
VariableMetadata run_stats() const
std::map< std::string, TSDiagnostic::Ptr > m_ts_diagnostics
Requested scalar diagnostics.
const Config::Ptr m_config
Configuration flags and parameters.
const Time::Ptr m_time
Time manager.
std::shared_ptr< std::vector< double > > m_ts_times
requested times for scalar time-series
const Logger::Ptr m_log
Logger.
MaxTimestep ts_max_timestep(double my_t)
Computes the maximum time-step we can take and still hit all -ts_times.
void flush_timeseries()
Flush scalar time-series.
std::string m_ts_filename
file to write scalar time-series to
std::set< std::string > m_ts_vars
virtual void write_metadata(const File &file, MappingTreatment mapping_flag, HistoryTreatment history_flag) const
Write time-independent metadata to a file.
void init_timeseries()
Initializes the code writing scalar time-series.
const std::shared_ptr< Grid > m_grid
Computational grid.
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
void add_context(const std::string &message)
Add a message providing some context. This way we can (sort of) get a stack trace even though C++ exc...
#define PISM_ERROR_LOCATION
@ PISM_READWRITE_MOVE
create a file for writing, move foo.nc to foo.nc~ if present
@ PISM_READWRITE
open an existing file for reading and writing
MaxTimestep reporting_max_timestep(const std::vector< double > ×, double t, double eps, const std::string &description)
std::string set_join(const std::set< std::string > &input, const std::string &separator)
std::set< std::string > set_split(const std::string &input, char separator)
Transform a separator-separated list (a string) into a set of strings.
static std::set< std::string > process_ts_shortcuts(const Config &config, const std::set< std::string > &input)
void write_run_stats(const File &file, const pism::VariableMetadata &stats)
double vector_max(const std::vector< double > &input)