WSL/SLF GitLab Repository
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
meteoio
Commits
1d25491e
Commit
1d25491e
authored
Jun 21, 2012
by
Mathias Bavay
Browse files
Re-definition of the == operator for MeteoData, some code clean up in IOUtils and StationData
parent
8e49698d
Changes
4
Hide whitespace changes
Inline
Side-by-side
meteoio/IOUtils.cc
View file @
1d25491e
...
...
@@ -163,10 +163,10 @@ void IOUtils::trim(std::string& str)
const
size_t
endpos
=
str
.
find_last_not_of
(
whitespaces
);
// Find the first character position from reverse af
// if all spaces or empty return an empty string
if
((
std
::
string
::
npos
==
startpos
)
||
(
std
::
string
::
npos
==
endpos
))
{
str
=
""
;
}
else
{
if
(
startpos
!=
std
::
string
::
npos
&&
endpos
!=
std
::
string
::
npos
)
{
str
=
str
.
substr
(
startpos
,
endpos
-
startpos
+
1
);
}
else
{
str
=
""
;
}
}
...
...
meteoio/MeteoData.cc
View file @
1d25491e
...
...
@@ -71,6 +71,7 @@ const std::string& MeteoGrids::getParameterName(const size_t& parindex)
/************************************************************
* static section *
************************************************************/
const
double
MeteoData
::
epsilon
=
1e-6
;
const
size_t
MeteoData
::
nrOfParameters
=
MeteoData
::
lastparam
-
MeteoData
::
firstparam
+
1
;
map
<
size_t
,
string
>
MeteoData
::
static_meteoparamname
;
std
::
vector
<
std
::
string
>
MeteoData
::
s_default_paramname
;
...
...
@@ -217,7 +218,6 @@ bool MeteoData::operator==(const MeteoData& in) const
return
false
;
for
(
size_t
ii
=
0
;
ii
<
nrOfAllParameters
;
ii
++
)
{
const
double
epsilon
=
(
fabs
(
data
[
ii
])
<
fabs
(
in
.
data
[
ii
])
?
fabs
(
in
.
data
[
ii
])
:
fabs
(
data
[
ii
]))
*
std
::
numeric_limits
<
double
>::
epsilon
();
if
(
!
IOUtils
::
checkEpsilonEquality
(
data
[
ii
],
in
.
data
[
ii
],
epsilon
)
)
return
false
;
}
...
...
meteoio/MeteoData.h
View file @
1d25491e
...
...
@@ -183,6 +183,7 @@ class MeteoData {
static
std
::
vector
<
std
::
string
>
s_default_paramname
;
static
const
bool
__init
;
///<helper variable to enable the init of static collection data
static
bool
initStaticData
();
///<initialize the static map meteoparamname
static
double
epsilon
;
///<for comparing fields
//private data members, please keep the order consistent with declaration lists and logic!
bool
resampled
;
///<set this to true if MeteoData is result of resampling
...
...
meteoio/StationData.cc
View file @
1d25491e
...
...
@@ -58,8 +58,10 @@ void StationData::setSlope(const double& in_slope_angle, const double& in_azimut
//Comparison operator
bool
StationData
::
operator
==
(
const
StationData
&
in
)
const
{
return
(
(
position
==
in
.
position
)
&&
(
stationID
==
in
.
stationID
)
&&
(
slope
==
in
.
slope
)
&&
(
azi
==
in
.
azi
)
);
// && (stationName == in.stationName));
return
(
(
position
==
in
.
position
)
&&
(
stationID
==
in
.
stationID
)
&&
(
slope
==
in
.
slope
)
&&
(
azi
==
in
.
azi
)
);
// && (stationName == in.stationName));
}
bool
StationData
::
operator
!=
(
const
StationData
&
in
)
const
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment