Elaboradar 0.1
Caricamento in corso...
Ricerca in corso...
Nessun risultato
site.cpp
Vai alla documentazione di questo file.
1
6#include "site.h"
7#include <radarelab/utils.h>
8#include <radarelab/vpr_par.h>
9#include <stdexcept>
10#include <cstring>
11
12#define SPC_LAT 44.6547
13#define SPC_LON 11.6236
14
15#define GAT_LAT 44.7914
16#define GAT_LON 10.4992
17
18using namespace std;
19using namespace radarelab;
20
21namespace {
28vector<double> make_elev_array(const int* data, unsigned count)
29{
30 vector<double> res;
31 res.reserve(count);
32 for (unsigned i = 0; i < count; ++i)
33 res.push_back(data[i] * 360. / 4096.);
34 return res;
35}
36}
37
38namespace elaboradar {
40{
41}
42
46struct SiteGAT : public Site
47{
48 SiteGAT()
49 {
50 name = "GAT";
51 radarSite.lat_r=GAT_LAT;
52 radarSite.lon_r=GAT_LON;
53 radarSite.height_r = 35.;
54 radarSite.antennaTowerHeight=25.;
55 radarSite.source="RAD:IYai,PLC:itgat,NOD:itgat ";
56
57 vpr_iaz_min=IAZ_MIN_GAT;
58 vpr_iaz_max=IAZ_MAX_GAT;
59 }
60
61 virtual const char* get_dem_file_name() const
62 {
63 return getenv_default("FILE_DEM_GAT", "../../PP+BLOC/dati/dem_Gatta.txt");
64 }
65
66 virtual const char* get_first_level_file_name(unsigned month) const
67 {
68 if (1 <= month && month <= 3)
69 return (datipath+"/FIRST_LEVEL_GAT_2006_INV").c_str();
70 else if (4 <= month && month <= 9)
71 //return "../dati/FIRST_LEVEL_GAT_2006_PRI-EST";
72 return (datipath+"FIRST_LEVEL_GAT_2006_PRI-EST").c_str();
73 else
74 //return "../dati/FIRST_LEVEL_GAT_2006_AUT";
75 return (datipath+"FIRST_LEVEL_GAT_2006_AUT").c_str();
76 }
77
78 virtual std::vector<double> get_elev_array(bool medium=false) const
79 {
80 if (medium)
81 {
82 static const int elev_data[]={6,16,26,37,47,57,80,109,148,205,284, 300, 305, 310, 315 };
83 return make_elev_array(elev_data, sizeof(elev_data) / sizeof(int));
84 } else {
85 static const int elev_data[]={6,16,26,37,47,57,80,109,148,205,284, 300, 305, 310, 315 };
86 return make_elev_array(elev_data, sizeof(elev_data) / sizeof(int));
87 }
88 }
89
90 virtual unsigned char get_bin_wind_magic_number(time_t when) const
91 {
92 return 135;
93 }
94} site_gat;
95
96
97
101struct SiteSPC : public Site
102{
103 SiteSPC()
104 {
105 name = "SPC";
106 radarSite.lat_r=SPC_LAT;
107 radarSite.lon_r=SPC_LON;
108 radarSite.height_r = 11.;
109 radarSite.antennaTowerHeight=20.;
110 radarSite.source="WMO:16144,RAD:IY46,PLC:itspc,NOD:itspc ";
111 vpr_iaz_min=IAZ_MIN_SPC;
112 vpr_iaz_max=IAZ_MAX_SPC;
113
114//WMO:16144,RAD:IY46,PLC:itspc,NOD:itspc
115 }
116
117 virtual const char* get_dem_file_name() const
118 {
119 return getenv_default("FILE_DEM_SPC", "../../PP+BLOC/dati/dem_SanPi.txt");
120 }
121
122 virtual const char* get_first_level_file_name(unsigned month) const
123 {
124 if (1 <= month && month <= 3)
125 //return "../dati/FIRST_LEVEL_SPC_2006_INV";
126 return (datipath+"FIRST_LEVEL_SPC_2006_INV").c_str();
127 else if (4 <= month && month <= 9)
128 //return "../dati/FIRST_LEVEL_SPC_2006_PRI-EST";
129 return (datipath+"FIRST_LEVEL_SPC_2006_PRI-EST").c_str();
130 else
131 //return "../dati/FIRST_LEVEL_SPC_2006_AUT";
132 return (datipath+"FIRST_LEVEL_SPC_2006_AUT").c_str();
133 }
134
135 virtual std::vector<double> get_elev_array(bool medium=false) const
136 {
137 if (medium)
138 {
139 static const int elev_data[]={6,16,26,36,47,57,80,108,148,205,284,300,305,310,315};
140 return make_elev_array(elev_data, sizeof(elev_data) / sizeof(int));
141 } else {
142 static const int elev_data[]={6,16,26,36,47,57,80,108,148,205,284,300,305,310,315};
143 return make_elev_array(elev_data, sizeof(elev_data) / sizeof(int));
144 }
145 }
146
147 virtual unsigned char get_bin_wind_magic_number(time_t when) const
148 {
149 // After DBP2_250920131130_BOLOGNA
150 if (when >= 1380108600)
151 return 135;
152 else
153 return 131;
154 }
155} site_spc;
156
157
158
159 const Site& Site::get(const char* name)
160{
161 if (strcmp(name, "GAT") == 0){
162 return site_gat;
163 }
164 else if (strcmp(name, "SPC") == 0){
165 return site_spc;
166 }
167 else
168 {
169 string errmsg(name);
170 throw domain_error(errmsg + " is not a valid radar site name");
171 }
172}
173
174}
name space generale del programma
Definition: assets.h:28
const char * getenv_default(const char *envname, const char *default_value)
A wrapper of getenv, that returns 'default_value' if the given environment name is not defined.
Definition: utils.cpp:137
String functions.
Definition: cart.cpp:4
definisce struttura Site Contiene le informazioni di base che caratterizzano il sito radar
virtual const char * get_first_level_file_name(unsigned month) const
Return first_elev file name.
Definition: site.cpp:66
virtual const char * get_dem_file_name() const
Return dem file name.
Definition: site.cpp:61
virtual std::vector< double > get_elev_array(bool medium=false) const
return the elev array used
Definition: site.cpp:78
virtual unsigned char get_bin_wind_magic_number(time_t when) const
Return the magic number for wind to be used in clean procedure.
Definition: site.cpp:90
struttura Site custom per GAT
Definition: site.cpp:47
virtual std::vector< double > get_elev_array(bool medium=false) const
return the elev array used
Definition: site.cpp:135
virtual const char * get_first_level_file_name(unsigned month) const
Return first_elev file name.
Definition: site.cpp:122
virtual const char * get_dem_file_name() const
Return dem file name.
Definition: site.cpp:117
virtual unsigned char get_bin_wind_magic_number(time_t when) const
Return the magic number for wind to be used in clean procedure.
Definition: site.cpp:147
struttura Site custom per SPC
Definition: site.cpp:102
std::string name
Nome sito radar.
Definition: site.h:29
static const Site & get(const char *name)
Get a Site object according to a site name.
Definition: site.cpp:159
int vpr_iaz_max
azimuth index of the end of the area for vpr computation
Definition: site.h:51
RadarSite radarSite
Description of radar site.
Definition: site.h:41
int vpr_iaz_min
azimuth index of the begin of the area for vpr computation
Definition: site.h:46
std::string datipath
Path mappe statiche e dati fuzzy logic.
Definition: site.h:35
virtual ~Site()
Destructor.
Definition: site.cpp:39
Radar site information.
Definition: site.h:24