Elaboradar  0.1
 Tutto Classi Namespace File Funzioni Variabili Tipi enumerati (enum) Gruppi
volume.cpp
1 #include "volume.h"
2 #include "logging.h"
3 #include <stdexcept>
4 #include <algorithm>
5 
6 static const double ker = 8494666.666667; // c'è qualcosa in geo_par.h
7 
8 using namespace std;
9 
10 namespace radarelab {
11 
12 PolarScanBase::PolarScanBase(unsigned beam_count, unsigned beam_size)
13  : beam_count(beam_count), beam_size(beam_size),
14  azimuths_real(beam_count), elevations_real(beam_count)
15 {
16 }
17 
18 PolarScanBase::PolarScanBase(const PolarScanBase& s)
19  : beam_count(s.beam_count), beam_size(s.beam_size),
20  azimuths_real(s.azimuths_real),
21  elevation(s.elevation),
22  elevations_real(s.elevations_real),
23  cell_size(s.cell_size)
24 {
25 }
26 
27 double PolarScanBase::height(unsigned rg, double beam_half_width)
28 {
29  return sample_height(elevation + beam_half_width, (double)rg*cell_size) / 1000.; // km
30 }
31 
32 double PolarScanBase::diff_height(unsigned rg_start, unsigned rg_end)
33 {
34  return fabs(height(rg_end) - height(rg_start));
35 }
36 
37 double PolarScanBase::sample_height(unsigned cell_idx) const
38 {
39  return sample_height(elevation, (double)cell_idx * cell_size);
40 }
41 
42 double PolarScanBase::sample_height(double elevation, double range, double equiv_earth_radius)
43 {
44  return sqrt(
45  range * range
46  + equiv_earth_radius * equiv_earth_radius
47  + 2. * equiv_earth_radius * range * sin(elevation * M_PI / 180.)
48  ) - equiv_earth_radius; //meters
49 }
50 
51 double PolarScanBase::sample_height(double elevation, double range)
52 {
53  return sample_height(elevation, range, ker);
54 }
55 
56 void VolumeStats::print(FILE* out)
57 {
58  fprintf(out, "Nel Zeros Ones Others Sum\n");
59  for (size_t iel =0; iel<count_zeros.size(); ++iel){
60  fprintf(out, "%4zu %8u %8u %8u %8u\n",iel,count_zeros[iel],count_ones[iel],count_others[iel],sum_others[iel]);
61  }
62 }
63 
64 template class PolarScan<double>;
65 template class Volume<double>;
66 
67 namespace volume {
68 template class Scans<double>;
69 }
70 
71 }
Definisce le principali strutture che contengono i dati.
double cell_size
Size of a beam cell in meters.
Definition: volume.h:48
double diff_height(unsigned rg_start, unsigned rg_end)
Height difference in kilometers (legacy) between two range gates.
Definition: volume.cpp:32
double sample_height(unsigned cell_idx) const
Return the height (in meters) of the sample at the given cell indexa.
Definition: volume.cpp:37
double height(unsigned rg, double beam_half_width=0.0)
Height in kilometers (legacy) at range gate for beam elevation + beam_half_width. ...
Definition: volume.cpp:27
double elevation
Nominal elevation of this PolarScan, which may be different from the effective elevation of each sing...
Definition: volume.h:42