41 #define snprintf _snprintf
53void prn_msg(
const char *fileAndPath,
const int theLine,
const char *msg_type,
const mio::Date& date_in,
const char *format, ...)
54__attribute__ ((format (printf, 5, 6)));
56void prn_msg(
const char *fileAndPath,
const int theLine,
const char *msg_type,
const mio::Date& date_in,
const char *format, ...);
59bool booleanTime(
const double& JulianDate,
double days_between,
60 const double& start,
const double& calculation_step_length);
63 const std::string& stationID,
const unsigned int& nSlopes,
64 const std::vector<std::string>& vecExtensions);
69void typeToCode(
int *F1,
int *F2,
int *F3,
int type);
71double unitConversion(
const double val,
char* unitIn,
char* unitOut);
75size_t findUpperNode(
const double& z,
const std::vector<NodeData>& Ndata,
const size_t& nN);
81double logisticFunction(
const double input,
const double threshold,
const double width);
83void cumulate(
double& accu,
const double value);
87double getPerpSensorPosition(
const bool& useSoilLayers,
const double& z_vert,
const double& hs_ref,
const double& Ground,
const double& SlopeAngle);
97#define M_TO_CM( l ) ( (l) * 100. )
98#define M_TO_MM( l ) ( (l) * 1000. )
99#define CM_TO_M( l ) ( (l) / 100. )
100#define MM_TO_M( l ) ( (l) / 1000. )
101#define MM_TO_CM( l ) ( (l) / 10. )
103#define D_TO_H( t ) ( (t) * 24. )
104#define D_TO_M( t ) ( (t) * 1440. )
105#define D_TO_S( t ) ( (t) * 86400. )
106#define H_TO_D( t ) ( (t) / 24.0 )
107#define H_TO_M( t ) ( (t) * 60. )
108#define H_TO_S( t ) ( (t) * 3600. )
109#define M_TO_D( t ) ( (t) / 1440. )
110#define M_TO_H( t ) ( (t) / 60. )
111#define M_TO_S( t ) ( (t) * 60. )
112#define S_TO_D( t ) ( (t) / 86400. )
113#define S_TO_H( t ) ( (t) / 3600. )
114#define S_TO_M( t ) ( (t) / 60. )
void deflateInflate(const CurrentMeteo &Mdata, SnowStation &Xdata, double &dhs_corr, double &mass_corr, const bool &prn_check)
Deflates or inflates the snowpack for warning service purposes.
Definition: Utils.cc:483
double logisticFunction(const double input, const double threshold, const double width)
Logistic function.
Definition: Utils.cc:581
void cumulate(double &accu, const double value)
Cumulate if and only if value is defined.
Definition: Utils.cc:594
void deleteOldOutputFiles(const std::string &outdir, const std::string &experiment, const std::string &stationID, const unsigned int &nSlopes, const std::vector< std::string > &vecExtensions)
Delete old output files (*.sno, *.ini) from outdir.
Definition: Utils.cc:168
void averageFluxTimeSeries(const size_t &n_steps, const bool &useCanopyModel, SurfaceFluxes &Sdata, SnowStation &Xdata)
Averages energy fluxes.
Definition: Utils.cc:277
void typeToCode(int *F1, int *F2, int *F3, int type)
Decompose type in its constituents At present decomposition into Swiss numerical code TODO Adapt to ...
Definition: Utils.cc:298
size_t findUpperNode(const double &z, const std::vector< NodeData > &Ndata, const size_t &nN)
Returns number of lowest node above a given position z perpendicular to slope (m) .
Definition: Utils.cc:233
double getPerpSensorPosition(const bool &useSoilLayers, const double &z_vert, const double &hs_ref, const double &Ground, const double &SlopeAngle)
Returns sensor position perpendicular to slope (m). Negative vertical height indicates depth from eit...
Definition: Utils.cc:258
bool booleanTime(const double &JulianDate, double days_between, const double &start, const double &calculation_step_length)
Determines whether a certain time has been reached (e.g. to dump output) The function returns TRUE wh...
Definition: Utils.cc:138
void prn_msg(const char *fileAndPath, const int theLine, const char *msg_type, const mio::Date &date_in, const char *format,...)
Print a message to screen (see p.351-352[,469] in C: The Complete Reference) If date_in is Date(),...
Definition: Utils.cc:60
double unitConversion(const double val, char *unitIn, char *unitOut)
Performs simple unit conversion (supports temperature, prefixes and exponents)
Definition: Utils.cc:315
double forcedErosion(const double hs, SnowStation &Xdata)
Forced erosion of a missed event.
Definition: Utils.cc:448
bool massBalanceCheck(const SnowStation &Xdata, const SurfaceFluxes &Sdata, double &tot_mass_in)
Performs mass balance check either before or after a calculation time step.
Definition: Utils.cc:398
void checkOldOutputFiles(const mio::Date &i_date, const std::string &stationID)
CurrentMeteo is the class of interpolated meteo data for the current calculation time step It contai...
Definition: DataClasses.h:83
Definition: DataClasses.h:604
Definition: DataClasses.h:733
Return the library version.
Definition: Utils.cc:33
std::string getLibVersion()
Definition: Utils.cc:34