WSL/SLF GitLab Repository

StationData.h 3.84 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/***********************************************************************************/
/*  Copyright 2009 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
/***********************************************************************************/
/* This file is part of MeteoIO.
    MeteoIO is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    MeteoIO is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with MeteoIO.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STATIONDATA_H__
#define __STATIONDATA_H__

#include <meteoio/Coords.h>
#include <meteoio/IOUtils.h>

#include <string>
#include <sstream>
#include <iomanip>
27
#include <vector>
28
29
30
31
32
33
34

namespace mio {

/**
 * @class StationData
 * @brief A class to represent meteo stations with attributes like longitude, latitude, etc.
 *
35
 * @ingroup data_str
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 * @author Thomas Egger
 * @date   2008-11-29
 */

#ifdef _POPC_
class StationData :POPBase {
	public:
		void Serialize(POPBuffer &buf, bool pack);
#else
class StationData {
#endif
	public:
		//Constructors
		/**
		* @brief The default constructor initializing every double attribute to nodata and strings to  ""
		*/
		StationData(void);

		/**
		* @brief A constructor that takes three to six arguments
		* @param _position Position of the station
57
58
		* @param _id Station's id (short identification)
		* @param _name Full name of the station (default "")
59
		*/
60
		StationData(const Coords& _position, const std::string& _id="", const std::string& _name="");
61
62

		//Specific getter functions
63
		std::string getStationID() const;
64
		std::string getStationName() const;
65
		Coords getPosition() const;
66
67
68
69
70
71
72
73
74
75
76
77

		/**
		* @brief Get local slope angle
		* @return angle of the local slope (in degrees, between 0 and 90 degrees)
		*/
		double getSlopeAngle() const;

		/**
		* @brief Get local slope azimuth
		* @return azimuth of the local slope expressed as a bearing (0 is North, in degrees, clockwise)
		*/
		double getAzimuth() const;
78
		
79
		/**
80
		* @brief General setter function
81
		* @param _position Position of the station
82
83
		* @param _id Station's id (short identification)
		* @param _name Name of the station (default "")
84
		*/
85
		void setStationData(const Coords& _position, const std::string& _id="", const std::string& _name="");
86

87
88
89
90
91
92
93
		/**
		* @brief Slope information setter
		* @param in_slope_angle angle of the local slope (in degrees, between 0 and 90 degrees)
		* @param in_azimuth azimuth of the local slope expressed as a bearing (0 is North, in degrees, clockwise)
		*/
		void setStationSlope(const double& in_slope_angle, const double& in_azimuth);

94
95
96
97
98
99
100
101
102
103
104
105
106
		friend std::ostream& operator<<(std::ostream& os, const StationData& station);

		//Comparison operators
		/**
		* @brief Equality %operator
		* check all parameters but the station name
		* @return true or false
		*/
		bool operator==(const StationData&) const;
		bool operator!=(const StationData&) const; ///<Operator that tests for inequality

	public:
		Coords position;
107
108
		std::string stationID; ///<ID of the Station, typically a short string
		std::string stationName; ///<Name of the Station, detailled description
109
110
111
112

	private:
		double slope; ///<Local slope at the station, in degrees, between 0 and 90 degrees
		double azi; ///<Azimuth at the local slope at the station, in degrees, 0 at north, compass orientation
113
114
115
		//for Snowpack and other (1D) applications: add slope, aspect, horizon, etc
};

116
typedef std::vector<StationData> STATION_TIMESERIE;
117
118
119
120

} //end namespace

#endif