Elaboradar 0.1
Caricamento in corso...
Ricerca in corso...
Nessun risultato
azimuth_resample.h
Vai alla documentazione di questo file.
1
5#ifndef RADARELAB_ALGO_AZIMUTHRESAMPLE_H
6#define RADARELAB_ALGO_AZIMUTHRESAMPLE_H
7
8#include <map>
9#include <vector>
10#include <ostream>
11#include <radarelab/volume.h>
12
13namespace radarelab {
14namespace algo {
15namespace azimuthresample {
16
21{
22protected:
24 std::map<double, unsigned> by_angle;
25
26public:
31 AzimuthIndex(const Eigen::VectorXd& azimuths);
32
39 std::pair<double, unsigned> closest(double azimuth) const;
40
48 std::vector<std::pair<double, unsigned>> intersecting(double dst_azimuth, double dst_amplitude, double src_amplitude) const;
49};
50
52template<typename T>
54{
58 virtual void resample_polarscan(const PolarScan<T>& src, PolarScan<T>& dst, double src_beam_width) const = 0;
59
60
62 //virtual void merger(const PolarScan<T>&, PolarScan<T>&, unsigned) = 0;
63
72 void resample_volume(const Volume<T>& src, Volume<T>& dst, double src_beam_width) const
73 {
74 // Copy volume metadata
75 dst.quantity = src.quantity;
76 dst.units = src.units;
77 dst.load_info = src.load_info;
78 dst.radarSite=src.radarSite;
79
80 for (unsigned iel = 0; iel < src.size(); ++iel)
81 {
82 const PolarScan<T>& src_scan = src.scan(iel);
83 PolarScan<T>& dst_scan = dst.append_scan(src_scan.beam_size, src_scan.elevation, src_scan.cell_size);
84 resample_polarscan(src_scan, dst_scan, src_beam_width);
85 }
86 }
87
96 void resample_volume(const volume::Scans<T>& src, Volume<T>& dst, double src_beam_width) const
97 {
98 // Copy volume metadata
99 dst.load_info = src.load_info;
100 dst.quantity = src.quantity;
101 dst.units = src.units;
102 dst.radarSite=src.radarSite;
103 for (unsigned iel = 0; iel < src.size(); ++iel)
104 {
105 const PolarScan<T>& src_scan = src.at(iel);
106 PolarScan<T>& dst_scan = dst.append_scan(src_scan.beam_size, src_scan.elevation, src_scan.cell_size);
107 resample_polarscan(src_scan, dst_scan, src_beam_width);
108 dst_scan.nodata = src_scan.nodata;
109 dst_scan.undetect = src_scan.undetect;
110 dst_scan.gain = src_scan.gain;
111 dst_scan.offset = src_scan.offset;
112 }
113 }
114};
115
116template<typename T>
117struct Closest : public LevelwiseResampler<T>
118{
119 virtual void resample_polarscan(const PolarScan<T>& src, PolarScan<T>& dst, double src_beam_width) const override;
120};
121
122template<typename T>
123struct MaxOfClosest : public LevelwiseResampler<T>
124{
125 virtual void resample_polarscan(const PolarScan<T>& src, PolarScan<T>& dst, double src_beam_width) const override;
126};
127
128}
129}
130}
131
132#endif
133
double nodata
Value used as 'no data' value.
Definition: volume.h:116
double undetect
Minimum amount that can be measured.
Definition: volume.h:118
double offset
Conversion factor.
Definition: volume.h:122
double gain
Conversion factor.
Definition: volume.h:120
PolarScan - structure to describe a polarScan containing a matrix of data and conversion factors.
Definition: volume.h:113
PolarScan< T > & append_scan(unsigned beam_size, double elevation, double cell_size)
Append a scan to this volume.
Definition: volume.h:544
Homogeneous volume with a common beam count for all PolarScans.
Definition: volume.h:431
std::pair< double, unsigned > closest(double azimuth) const
Get the closest position to an azimuth angle.
std::vector< std::pair< double, unsigned > > intersecting(double dst_azimuth, double dst_amplitude, double src_amplitude) const
Get all the positions intersecting an angle centered on azimuth and with the given amplitude.
std::map< double, unsigned > by_angle
map azimuth angles to beam indices
Classe to manage Index beam positions by azimuth angles.
RadarSite radarSite
RadarSite.
Definition: volume.h:274
std::string units
Data units according to ODIM documentation.
Definition: volume.h:270
std::string quantity
Odim quantity name.
Definition: volume.h:268
std::shared_ptr< LoadInfo > load_info
Polar volume information.
Definition: volume.h:272
PolarScan< T > & scan(unsigned idx)
Access a polar scan.
Definition: volume.h:313
Sequence of PolarScans which can have a different beam count for each elevation.
Definition: volume.h:264
String functions.
Definition: cart.cpp:4
unsigned beam_size
Number of samples in each beam.
Definition: volume.h:33
double elevation
Nominal elevation of this PolarScan, which may be different from the effective elevation of each sing...
Definition: volume.h:42
double cell_size
Size of a beam cell in meters.
Definition: volume.h:48
void resample_volume(const Volume< T > &src, Volume< T > &dst, double src_beam_width) const
Merge.
void resample_volume(const volume::Scans< T > &src, Volume< T > &dst, double src_beam_width) const
Fill dst with data from src, coping with the two volumes having a different number of beams per scan.
virtual void resample_polarscan(const PolarScan< T > &src, PolarScan< T > &dst, double src_beam_width) const =0
Fill dst with data from src, using the given merger function.
Resample a volume one level at a time.
Definisce le principali strutture che contengono i dati.