21#include <meteoio/MeteoIO.h>
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Weffc++"
31#include <snowpack/plugins/pugixml/pugixml.hpp>
32#pragma GCC diagnostic pop
49 virtual bool snowCoverExists(
const std::string& i_snowfile,
const std::string& stationID)
const;
51 virtual void readSnowCover(
const std::string& i_snowfile,
const std::string& stationID,
58 const ProcessDat& Hdata,
const double wind_trans24);
62 virtual bool writeHazardData(
const std::string& stationID,
const std::vector<ProcessDat>& Hdata,
63 const std::vector<ProcessInd>& Hdata_ind,
const size_t& num);
66 void cleanup() throw();
69 void setBasicHeader(const
SnowStation& Xdata, const std::
string& fields, smet::SMETWriter& smet_writer) const;
70 void setSnoSmetHeader(const
SnowStation& Xdata, const
SN_SNOWSOIL_DATA& SSdata, const mio::Date& date, smet::SMETWriter& smet_writer) const;
71 void setFormatting(const
size_t& nr_solutes, std::vector<
int>& vec_width, std::vector<
int>& vec_precision) const;
72 std::
string getFilenamePrefix(const std::
string& fnam, const std::
string& path, const
bool addexp=true) const;
75 bool read_snocaaml(const std::
string& snofilename, const std::
string& stationID,
SN_SNOWSOIL_DATA& SSdata);
76 void openIn_CAAML(const std::
string& in_snowfile);
77 mio::Date xmlGetDate();
78 mio::StationData xmlGetStationData(const std::
string& stationID);
82 LayerData xmlGetLayer(pugi::xml_node nodeLayer, std::
string& grainFormCode);
84 void getAndSetProfile(const std::
string path, const std::
string name,const
bool directionTopDown,
85 const
bool isRangeMeasurement,std::vector<
LayerData>& Layers);
86 bool xmlGetProfile(const std::
string path, const std::
string name, std::vector<
double>& zVec, std::vector<
double>& valVec);
87 void estimateValidFormationTimesIfNotSetYet(std::vector<
LayerData> &Layers, const mio::Date);
88 void checkAllDataForConsistencyAndSetMissingValues(
SN_SNOWSOIL_DATA& SSdata );
92 void writeSnowFile(const std::
string& snofilename, const mio::Date& date, const
SnowStation& Xdata);
93 void writeCustomSnowSoil(pugi::xml_node& node, const
SnowStation& Xdata);
94 void writeLayers(pugi::xml_node& node, const
SnowStation& Xdata);
95 void writeCustomLayerData(pugi::xml_node& node, const
ElementData& Edata, const
NodeData& Ndata);
96 void writeProfiles(pugi::xml_node& node, const
SnowStation& Xdata);
97 void writeStationData(pugi::xml_node& root, const
SnowStation& Xdata);
99 double lwc_codeToVal(const
char* code);
100 std::
string lwc_valToCode(const
double val);
101 double hardness_codeToVal(
char* code);
102 std::
string hardness_valToCode(const
double code);
103 void grainShape_codeToVal(const std::
string& code,
double &sp,
double &dd,
unsigned short int &mk);
104 std::
string grainShape_valToAbbrev(const
unsigned int var);
105 std::
string grainShape_valToAbbrev_old(const
double* var);
108 double xmlReadValueFromPath(const std::
string& xpath, const std::
string& property, const
double& dflt);
109 int xmlReadValueFromPath(const std::
string& xpath, const std::
string& property, const
int& dflt);
110 void xmlWriteElement(pugi::xml_node& node, const
char* name, const
char* content, const
char* att_name, const
char* att_val);
111 bool xmlDoesPathExist(const std::
string& path);
112 bool xmlReadValueFromNode(const pugi::xml_node node, const std::
string propertyName,
double& variableToSet,
113 const std::
string unitOut = "",const std::
string unitMeasured = "", const
double factor=1.0);
114 std::
string xmlReadAttributeFromPath (const std::
string& path, const std::
string& attributeName);
117 std::
string i_snowpath, o_snowpath, experiment;
118 double i_max_element_thickness;
119 bool caaml_writeout_as_readin, haz_write;
122 pugi::xml_document inDoc;
123 pugi::xml_encoding inEncoding;
126 static const
char *xml_ns_caaml, *xml_ns_abrev_caaml;
127 static const
char *xml_ns_gml, *xml_ns_abrev_gml;
128 static const
char *xml_ns_xsi, *xml_ns_abrev_xsi;
129 static const
char *xml_ns_slf, *xml_ns_abrev_slf;
130 static const
char *xml_ns_snp, *xml_ns_abrev_snp;
131 static const std::
string TimeData_xpath, StationMetaData_xpath, SnowData_xpath;
133 char layerDepthTopStr[10], layerThicknessStr[10], layerValStr[10], valueStr[10];
134 double hoarDensitySurf;
135 std::vector<std::
string> grainForms;
Reading snow profile data in CAAML format. Reads in CAAML snow profile data, the CAA-IACS internation...
Definition: CaaMLIO.h:43
virtual bool snowCoverExists(const std::string &i_snowfile, const std::string &stationID) const
This routine checks if the specified snow cover data exists.
Definition: CaaMLIO.cc:494
virtual void writeProfile(const mio::Date &date, const SnowStation &Xdata)
Definition: CaaMLIO.cc:1387
virtual void readSnowCover(const std::string &i_snowfile, const std::string &stationID, SN_SNOWSOIL_DATA &SSdata, ZwischenData &Zdata, const bool &read_salinity)
This routine reads the status of the snow cover at program start.
Definition: CaaMLIO.cc:513
virtual void writeTimeSeries(const SnowStation &Xdata, const SurfaceFluxes &Sdata, const CurrentMeteo &Mdata, const ProcessDat &Hdata, const double wind_trans24)
Definition: CaaMLIO.cc:1381
virtual bool writeHazardData(const std::string &stationID, const std::vector< ProcessDat > &Hdata, const std::vector< ProcessInd > &Hdata_ind, const size_t &num)
Definition: CaaMLIO.cc:1392
CaaMLIO(const SnowpackConfig &i_cfg, const RunInfo &run_info)
Definition: CaaMLIO.cc:420
virtual void writeSnowCover(const mio::Date &date, const SnowStation &Xdata, const ZwischenData &Zdata, const bool &forbackup=false)
This routine writes the status of the snow cover at program termination and at specified backup times...
Definition: CaaMLIO.cc:1049
CurrentMeteo is the class of interpolated meteo data for the current calculation time step It contai...
Definition: DataClasses.h:83
ELEMENT DATA used as a pointer in the SnowStation structure NOTE on M below: this is the mass of an e...
Definition: DataClasses.h:285
Parameters of the different layers of the snowpack.
Definition: DataClasses.h:186
NODAL DATA used as a pointer in the SnowStation structure.
Definition: DataClasses.h:393
class to collect the information about the current simulation (version, date)
Definition: DataClasses.h:849
SN_SNOWSOIL_DATA includes all important station parameters as well as LayerData.
Definition: DataClasses.h:230
Definition: DataClasses.h:604
Definition: SnowpackConfig.h:28
Definition: SnowpackIOInterface.h:27
Definition: DataClasses.h:733
ZwischenData contains "memory" information mainly for operational use It is used to prepare some para...
Definition: DataClasses.h:65
Structure of double values for output to SDB.
Definition: Hazard.h:37