WSL/SLF GitLab Repository

Commit 61ee41a9 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Trying to make the documentation more user-friendly. The smet2agr script has...

Trying to make the documentation more user-friendly. The smet2agr script has been modernized (changing the syntax of a regular expression).
parent 06cf560f
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.6 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="no"/>
<detaileddescription title=""/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
......@@ -688,10 +688,10 @@ bool HSSweGenerator::generate(const size_t& /*param*/, MeteoData& /*md*/)
//run through a Cst=0 data generator afterward
bool HSSweGenerator::generate(const size_t& param, std::vector<MeteoData>& vecMeteo)
{
if(param!=MeteoData::HNW)
if (param!=MeteoData::HNW)
throw InvalidArgumentException("Trying to use "+algo+" generator on " + MeteoData::getParameterName(param) + " but it can only be applied to HNW!!", AT);
if(vecMeteo.empty()) return true;
if (vecMeteo.empty()) return true;
//Find first point that is not IOUtils::nodata
size_t last_good = IOUtils::npos;
......@@ -706,7 +706,7 @@ bool HSSweGenerator::generate(const size_t& param, std::vector<MeteoData>& vecMe
return false;
bool all_filled = (last_good>0)? false : true;
for(size_t ii=last_good+1; ii<vecMeteo.size(); ii++) {
for (size_t ii=last_good+1; ii<vecMeteo.size(); ii++) {
const double HS_curr = vecMeteo[ii](MeteoData::HS);
if(HS_curr==IOUtils::nodata) continue;
......@@ -714,7 +714,7 @@ bool HSSweGenerator::generate(const size_t& param, std::vector<MeteoData>& vecMe
const double HS_prev = vecMeteo[last_good](MeteoData::HS);
const double HS_delta = HS_curr - HS_prev;
if(HS_delta>0.) {
if (HS_delta>0.) {
const double rho = newSnowDensity(vecMeteo[ii]);
const double precip = HS_delta * rho; //in kg/m2 or mm
ProcHNWDistribute::SmartDistributeHNW(precip, start_idx, ii, param, vecMeteo);
......@@ -737,7 +737,7 @@ double HSSweGenerator::newSnowDensity(const MeteoData& md) const
const double beta01=3.28, beta1=0.03, beta02=-0.36, beta2=-0.75, beta3=0.3;
double arg = beta01 + beta1*ta + beta2*asin(sqrt(rh)) + beta3*log10(vw);
if(ta>=-14.)
if (ta>=-14.)
arg += beta02; // += beta2*ta;
return min( max(30., pow(10., arg)), 250. ); //limit the density to the [30, 250] kg/m3 range
......
......@@ -214,6 +214,10 @@ class NoneAlgorithm : public InterpolationAlgorithm {
* Fill the grid with the average of the inputs for this parameter.
* Optionally, it is also possible to provide the constant that should be used if no measurements
* are avaiblable.
* @code
* HNW::algorithms = CST
* HNW::cst = 0.
* @endcode
*/
class ConstAlgorithm : public InterpolationAlgorithm {
public:
......
......@@ -45,20 +45,7 @@ namespace mio {
*/
/**
* @mainpage Welcome to MeteoIO
* @section intro_sec Introduction
* This library aims at making data access easy and safe for numerical simulations in environmental sciences requiring general meteorological data. It's main design goals are:
* - providing data format/protocol independent data access
* - providing safe and robust I/O
* - making I/O code as unobtrusive and simple as possible for the user
* - providing ready to use data to the user, which means transparent caching, filtering, resampling, spatial interpolation.
* - enabling unattended use from an IO point of view
* - offering high modularity so that individual elements of the library can easily be replaced/expanded/added
* - by its modularity, help interdisciplinary development, each module being targeted at a specific developer profile
*
* This library is available under LPGL version 3 or above, see <a href="http://www.gnu.org/licenses/lgpl.txt">www.gnu.org</a>.
*
* @section table_of_content Table of content
* @mainpage Table of content
* -# External Links
* -# <A HREF="https://models.slf.ch/p/meteoio/">MeteoIO's home page</A>
* -# <A HREF="https://models.slf.ch/p/meteoio/page/Getting-started/">Installation, compilation</A>
......@@ -84,6 +71,15 @@ namespace mio {
* -# How to \subpage dev_processing "write a processing element"
* -# How to \subpage dev_DataGenerator "Write a data generator"
* -# How to \subpage dev_2Dinterpol "write a spatial interpolation algorithm"
*
* <center><hr></center>
* <p><center><i><small>
* This library aims at making data access easy and safe for numerical simulations in environmental sciences requiring general meteorological data. A full
* description of its design goals and its architecture can be found in <br>
* M. Bavay and T. Egger, <a href="http://www.geosci-model-dev.net/7/3135/2014/gmd-7-3135-2014.pdf"><i>"MeteoIO 2.4. 2: a preprocessing library for meteorological data."</i></a>, Geoscientific Model Development, <b>7.6</b>, 2014, pp 3135-3151.
* <br>
* This library is available under LPGL version 3 or above, see <a href="http://www.gnu.org/licenses/lgpl.txt">www.gnu.org</a>.
* </small></i></center></p>
*/
/**
......
......@@ -33,15 +33,15 @@ ResamplingAlgorithms* ResamplingAlgorithmsFactory::getAlgorithm(const std::strin
{
const std::string algoname(IOUtils::strToUpper(i_algoname));
if (algoname == "NONE" || algoname == "NO"){
if (algoname == "NONE" || algoname == "NO") {
return new NoResampling(algoname, parname, dflt_window_size, vecArgs);
} else if (algoname == "LINEAR"){
} else if (algoname == "LINEAR") {
return new LinearResampling(algoname, parname, dflt_window_size, vecArgs);
} else if (algoname == "NEAREST"){
} else if (algoname == "NEAREST") {
return new NearestNeighbour(algoname, parname, dflt_window_size, vecArgs);
} else if (algoname == "ACCUMULATE"){
} else if (algoname == "ACCUMULATE") {
return new Accumulate(algoname, parname, dflt_window_size, vecArgs);
} else if (algoname == "DAILY_SOLAR"){
} else if (algoname == "DAILY_SOLAR") {
return new Daily_solar(algoname, parname, dflt_window_size, vecArgs);
} else {
throw IOException("The resampling algorithm '"+algoname+"' is not implemented" , AT);
......@@ -53,7 +53,7 @@ double ResamplingAlgorithms::partialAccumulateAtLeft(const std::vector<MeteoData
const size_t& pos, const Date& curr_date)
{
const size_t end = pos+1;
if(end>=vecM.size()) return IOUtils::nodata; //reaching the end of the input vector
if (end>=vecM.size()) return IOUtils::nodata; //reaching the end of the input vector
const double valend = vecM[end](paramindex);
if (valend == IOUtils::nodata) return IOUtils::nodata;
......@@ -103,7 +103,7 @@ void ResamplingAlgorithms::getNearestValidPts(const size_t& pos, const size_t& p
const Date dateStart = resampling_date - window_size;
for (size_t ii=pos; ii-- >0; ) {
if (vecM[ii].date < dateStart) break;
if (vecM[ii](paramindex) != IOUtils::nodata){
if (vecM[ii](paramindex) != IOUtils::nodata) {
indexP1 = ii;
break;
}
......@@ -149,7 +149,7 @@ double ResamplingAlgorithms::linearInterpolation(const double& x1, const double&
NoResampling::NoResampling(const std::string& i_algoname, const std::string& i_parname, const double& dflt_window_size, const std::vector<std::string>& vecArgs)
: ResamplingAlgorithms(i_algoname, i_parname, dflt_window_size, vecArgs)
{
if(!vecArgs.empty()) //incorrect arguments, throw an exception
if (!vecArgs.empty()) //incorrect arguments, throw an exception
throw InvalidArgumentException("Wrong number of arguments for \""+i_parname+"::"+i_algoname+"\"", AT);
}
......@@ -181,18 +181,18 @@ NearestNeighbour::NearestNeighbour(const std::string& i_algoname, const std::str
: ResamplingAlgorithms(i_algoname, i_parname, dflt_window_size, vecArgs), extrapolate(false)
{
const size_t nr_args = vecArgs.size();
if(nr_args==0) return;
if(nr_args==1) {
if(vecArgs[0]=="extrapolate")
if (nr_args==0) return;
if (nr_args==1) {
if (vecArgs[0]=="extrapolate")
extrapolate=true;
else {
IOUtils::convertString(window_size, vecArgs[0]);
window_size /= 86400.; //user uses seconds, internally julian day is used
}
} else if(nr_args==2) {
} else if (nr_args==2) {
IOUtils::convertString(window_size, vecArgs[0]);
window_size /= 86400.; //user uses seconds, internally julian day is used
if(vecArgs[1]=="extrapolate")
if (vecArgs[1]=="extrapolate")
extrapolate=true;
else
throw InvalidArgumentException("Invalid argument \""+vecArgs[1]+"\" for \""+i_parname+"::"+i_algoname+"\"", AT);
......@@ -240,17 +240,17 @@ void NearestNeighbour::resample(const size_t& index, const ResamplingPosition& p
const double val1 = vecM[indexP1](paramindex);
const double val2 = vecM[indexP2](paramindex);
if (IOUtils::checkEpsilonEquality(diff1.getJulian(true), diff2.getJulian(true), 0.1/1440.)){ //within 6 seconds
if (IOUtils::checkEpsilonEquality(diff1.getJulian(true), diff2.getJulian(true), 0.1/1440.)) { //within 6 seconds
md(paramindex) = Interpol1D::weightedMean(val1, val2, 0.5);
} else if (diff1 < diff2){
} else if (diff1 < diff2) {
md(paramindex) = val1;
} else if (diff1 > diff2){
} else if (diff1 > diff2) {
md(paramindex) = val2;
}
} else if (extrapolate) {
if(foundP1 && !foundP2){ //nearest neighbour on found after index 'index'
if (foundP1 && !foundP2) { //nearest neighbour on found after index 'index'
md(paramindex) = vecM[indexP1](paramindex);
} else if (!foundP1 && foundP2){ //nearest neighbour on found before index 'index'
} else if (!foundP1 && foundP2) { //nearest neighbour on found before index 'index'
md(paramindex) = vecM[indexP2](paramindex);
} else { // no nearest neighbour with a value different from IOUtils::nodata
return;
......@@ -262,18 +262,18 @@ LinearResampling::LinearResampling(const std::string& i_algoname, const std::str
: ResamplingAlgorithms(i_algoname, i_parname, dflt_window_size, vecArgs), extrapolate(false)
{
const size_t nr_args = vecArgs.size();
if(nr_args==0) return;
if(nr_args==1) {
if(vecArgs[0]=="extrapolate")
if (nr_args==0) return;
if (nr_args==1) {
if (vecArgs[0]=="extrapolate")
extrapolate=true;
else {
IOUtils::convertString(window_size, vecArgs[0]);
window_size /= 86400.; //user uses seconds, internally julian day is used
}
} else if(nr_args==2) {
} else if (nr_args==2) {
IOUtils::convertString(window_size, vecArgs[0]);
window_size /= 86400.; //user uses seconds, internally julian day is used
if(vecArgs[1]=="extrapolate")
if (vecArgs[1]=="extrapolate")
extrapolate=true;
else
throw InvalidArgumentException("Invalid argument \""+vecArgs[1]+"\" for \""+i_parname+"::"+i_algoname+"\"", AT);
......@@ -322,16 +322,16 @@ void LinearResampling::resample(const size_t& index, const ResamplingPosition& p
return;
//At this point we either have a valid indexP1 or indexP2 and we can at least try to extrapolate
if (!foundP1 && foundP2){ //only nodata values found before index, try looking after indexP2
for (size_t ii=indexP2+1; ii<vecM.size(); ii++){
if (vecM[ii](paramindex) != IOUtils::nodata){
if (!foundP1 && foundP2) { //only nodata values found before index, try looking after indexP2
for (size_t ii=indexP2+1; ii<vecM.size(); ii++) {
if (vecM[ii](paramindex) != IOUtils::nodata) {
indexP1 = ii;
foundP1 = true;
break;
}
}
} else if (foundP1 && !foundP2){ //only nodata found after index, try looking before indexP1
for (size_t ii=indexP1; (ii--) > 0; ){
} else if (foundP1 && !foundP2) { //only nodata found after index, try looking before indexP1
for (size_t ii=indexP1; (ii--) > 0; ){
if (vecM[ii](paramindex) != IOUtils::nodata){
indexP2=ii;
foundP2 = true;
......@@ -358,28 +358,29 @@ Accumulate::Accumulate(const std::string& i_algoname, const std::string& i_parna
accumulate_period(IOUtils::nodata), strict(false)
{
const size_t nr_args = vecArgs.size();
if(nr_args<1 || nr_args>2)
if (nr_args<1 || nr_args>2)
throw InvalidArgumentException("Please at least provide accumulation period (in seconds) for \""+i_parname+"::"+i_algoname+"\"", AT);
bool period_read = false;
for(size_t ii=0; ii<nr_args; ii++) {
if(IOUtils::isNumeric(vecArgs[ii])) {
if(period_read==true)
for (size_t ii=0; ii<nr_args; ii++) {
if (IOUtils::isNumeric(vecArgs[ii])) {
if (period_read==true)
throw InvalidArgumentException("Two arguments "+i_algoname+" resampling has been deprecated! Please use the \"HNW_Distribute\" Processing Element instead!", AT);
IOUtils::convertString(accumulate_period, vecArgs[ii]);
accumulate_period /= 86400.; //user uses seconds, internally julian day is used
if(accumulate_period<=0.) {
if (accumulate_period<=0.) {
std::ostringstream ss;
ss << "Invalid accumulation period (" << accumulate_period << ") for \"" << i_parname << "::" << i_algoname << "\"";
throw InvalidArgumentException(ss.str(), AT);
}
period_read = true;
} else if (vecArgs[ii]=="strict" && !strict) {
if(strict) //do not set strict more than once!
if (strict) //do not set strict more than once!
throw InvalidArgumentException("Do not provide \"strict\" more than once for \""+i_parname+"::"+i_algoname+"\"", AT);
strict = true;
} else throw InvalidArgumentException("Invalid argument \""+vecArgs[ii]+"\" for \""+i_parname+"::"+i_algoname+"\"", AT);
} else
throw InvalidArgumentException("Invalid argument \""+vecArgs[ii]+"\" for \""+i_parname+"::"+i_algoname+"\"", AT);
}
}
......@@ -397,7 +398,7 @@ size_t Accumulate::findStartOfPeriod(const std::vector<MeteoData>& vecM, const s
size_t start_idx = IOUtils::npos;
for (size_t idx=index; idx--> 0; ) {
const Date curr_date = vecM[idx].date;
if(curr_date <= dateStart) {
if (curr_date <= dateStart) {
start_idx = idx;
break;
}
......@@ -412,7 +413,7 @@ double Accumulate::easySampling(const std::vector<MeteoData>& vecM, const size_t
const double start_val = partialAccumulateAtLeft(vecM, paramindex, start_idx, dateStart);
const double end_val = partialAccumulateAtLeft(vecM, paramindex, start_idx, resampling_date);
if(start_val!=IOUtils::nodata && end_val!=IOUtils::nodata)
if (start_val!=IOUtils::nodata && end_val!=IOUtils::nodata)
sum = end_val - start_val;
return sum;
......@@ -423,25 +424,25 @@ double Accumulate::complexSampling(const std::vector<MeteoData>& vecM, const siz
double sum = IOUtils::nodata;
//resample begining point, in the [start_idx ; start_idx+1] interval
const double start_value = partialAccumulateAtRight(vecM, paramindex, start_idx, dateStart);
if(start_value!=IOUtils::nodata)
if (start_value!=IOUtils::nodata)
sum=start_value;
else if(strict) return IOUtils::nodata;
else if (strict) return IOUtils::nodata;
//sum all whole periods AFTER the begining point, in the [start_idx+2 ; index-1] interval
for(size_t idx=(start_idx+2); idx<index; idx++) {
for (size_t idx=(start_idx+2); idx<index; idx++) {
const double curr_value = vecM[idx](paramindex);
if(curr_value!=IOUtils::nodata) {
if(sum!=IOUtils::nodata) sum += curr_value;
if (curr_value!=IOUtils::nodata) {
if (sum!=IOUtils::nodata) sum += curr_value;
else sum = curr_value;
} else if(strict) return IOUtils::nodata;
} else if (strict) return IOUtils::nodata;
}
//resample end point, in the [index-1 ; index] interval
const double end_val = partialAccumulateAtLeft(vecM, paramindex, index-1, resampling_date);
if(end_val!=IOUtils::nodata) {
if(sum!=IOUtils::nodata) sum += end_val;
if (end_val!=IOUtils::nodata) {
if (sum!=IOUtils::nodata) sum += end_val;
else sum = end_val;
} else if(strict) return IOUtils::nodata;
} else if (strict) return IOUtils::nodata;
return sum;
}
......@@ -452,7 +453,7 @@ void Accumulate::resample(const size_t& index, const ResamplingPosition& positio
{
if (index >= vecM.size())
throw IOException("The index of the element to be resampled is out of bounds", AT);
if(position==ResamplingAlgorithms::begin || position==ResamplingAlgorithms::end)
if (position==ResamplingAlgorithms::begin || position==ResamplingAlgorithms::end)
return;
md(paramindex) = IOUtils::nodata;
......@@ -466,7 +467,7 @@ void Accumulate::resample(const size_t& index, const ResamplingPosition& positio
return;
}
if((index - start_idx) <= 1) {//easy upsampling when start & stop are in the same input time step
if ((index - start_idx) <= 1) {//easy upsampling when start & stop are in the same input time step
//upsampling (for example, generate 15min values from hourly data)
const double sum = easySampling(vecM, paramindex, index, start_idx, dateStart, resampling_date);
md(paramindex) = sum; //if resampling was unsuccesful, sum==IOUtils::nodata
......@@ -488,7 +489,7 @@ Daily_solar::Daily_solar(const std::string& i_algoname, const std::string& i_par
: ResamplingAlgorithms(i_algoname, i_parname, dflt_window_size, vecArgs), radiation(), station_index(), dateStart(), dateEnd(), loss_factor()
{
const size_t nr_args = vecArgs.size();
if(nr_args>0) {
if (nr_args>0) {
throw InvalidArgumentException("Too many arguments for \""+i_parname+"::"+i_algoname+"\"", AT);
}
}
......@@ -509,7 +510,7 @@ size_t Daily_solar::getNearestValidPt(const std::vector<MeteoData>& vecM, const
//look for daily sum before the current point
for (size_t ii=pos; ii-- >0; ) {
if (vecM[ii].date < dateStart[stat_idx]) break;
if (vecM[ii](paramindex) != IOUtils::nodata){
if (vecM[ii](paramindex) != IOUtils::nodata) {
indexP1 = ii;
break;
}
......@@ -554,7 +555,7 @@ double Daily_solar::compRadiation(const double& lat, const double& lon, const do
SunObject sun(lat, lon, alt);
double sum = 0.;
size_t index=0;
for(Date date(dateStart[stat_idx]); date<dateEnd[stat_idx]; date += 1./double(samples_per_day)) {
for (Date date(dateStart[stat_idx]); date<dateEnd[stat_idx]; date += 1./double(samples_per_day)) {
//compute potential solar radiation at this time step
sun.setDate(date.getJulian(), date.getTimeZone());
sun.calculateRadiation(TA, RH, P, albedo);
......@@ -586,8 +587,8 @@ double Daily_solar::getSolarInterpol(const Date& resampling_date, const size_t&
size_t Daily_solar::getStationIndex(const std::string& key)
{
const size_t nr_stations = station_index.size();
for(size_t ii=0; ii<nr_stations; ++ii) {
if(station_index[ii]==key)
for (size_t ii=0; ii<nr_stations; ++ii) {
if (station_index[ii]==key)
return ii;
}
......@@ -606,7 +607,7 @@ void Daily_solar::setDayStartAndEnd(const Date& resampling_date, const size_t& s
{
dateStart[stat_idx] = resampling_date;
dateStart[stat_idx].rnd(24*3600, Date::DOWN);
if(dateStart[stat_idx]==resampling_date) //if resampling_date=midnight GMT, the rounding lands on the exact same date
if (dateStart[stat_idx]==resampling_date) //if resampling_date=midnight GMT, the rounding lands on the exact same date
dateStart[stat_idx] -= 1.;
dateEnd[stat_idx] = resampling_date;
......@@ -619,23 +620,23 @@ void Daily_solar::resample(const size_t& index, const ResamplingPosition& /*posi
if (index >= vecM.size())
throw IOException("The index of the element to be resampled is out of bounds", AT);
if(paramindex!=MeteoData::ISWR && paramindex!=MeteoData::RSWR)
if (paramindex!=MeteoData::ISWR && paramindex!=MeteoData::RSWR)
throw IOException("This method only applies to short wave radiation! (either ISWR or RSWR)", AT);
const double lat = md.meta.position.getLat();
const double lon = md.meta.position.getLon();
const double alt = md.meta.position.getAltitude();
if(lat==IOUtils::nodata || lon==IOUtils::nodata || alt==IOUtils::nodata) return;
if (lat==IOUtils::nodata || lon==IOUtils::nodata || alt==IOUtils::nodata) return;
const double HS = md(MeteoData::HS);
//get station index
const size_t stat_idx = getStationIndex(md.meta.stationID);
//has the radiation already been calculated for this day and station?
if(md.date<dateStart[stat_idx] || md.date>=dateEnd[stat_idx]) {
if (md.date<dateStart[stat_idx] || md.date>=dateEnd[stat_idx]) {
setDayStartAndEnd(md.date, stat_idx);
const size_t indexP = getNearestValidPt(vecM, paramindex, stat_idx, index);
if(indexP==IOUtils::npos) { //no daily sum found for the current day
if (indexP==IOUtils::npos) { //no daily sum found for the current day
loss_factor[stat_idx] = IOUtils::nodata;
return;