#include <iostream>
using namespace std;
using namespace Radar;
void dump_rays(
const char* quantityName,
PolarScan* scan,
const std::vector<int> raysindex)
{
cout << "Dumping " << quantityName << " values..." << endl;
for (size_t i=0; i<raysindex.size(); i++)
{
int ray = raysindex[i];
cout << "Raggio n. " << ray << ": ";
for (int b=0; b<bins; b++)
cout << matrix.
elem(ray, b) <<
" ";
cout << endl;
}
cout << endl;
delete data;
}
template <class T> static void writeVector(const std::vector<T>& v)
{
for (int i=0; i<v.size(); i++)
std::cout << v[i] << " ";
}
int main(int argc, char* argv[])
{
if (argc != 2)
{
cout << "Usage: " << argv[0] << " <odimh5file>" << endl;
return -1;
}
std::vector<PolarScan*> scans;
try
{
cout << "WHAT:" << endl;
cout <<
" - Object: " << volume->
getObject() << endl;
cout <<
" - Version: " << volume->
getVersion() << endl;
cout <<
" - Date/Time: " << volume->
getDateTime() << endl;
cout <<
" - Date/Time str: " << timeutils::absoluteToString(volume->
getDateTime()) << endl;
cout << "WHERE:" << endl;
cout <<
" - Latitude: " << volume->
getLatitude() << endl;
cout <<
" - Longitude: " << volume->
getLongitude() << endl;
cout <<
" - Altitude: " << volume->
getAltitude() << endl;
cout << "HOW:" << endl;
cout <<
" - End epochs: " << volume->
getEndEpochs() << endl;
cout <<
" - System: " << volume->
getSystem() << endl;
cout <<
" - Software: " << volume->
getSoftware() << endl;
cout <<
" - ZR_A: " << volume->
getZR_A() << endl;
cout <<
" - ZR_B: " << volume->
getZR_B() << endl;
cout <<
" - KR_A: " << volume->
getKR_A() << endl;
cout <<
" - KR_B: " << volume->
getKR_B() << endl;
for (int i=0; i<scans.size(); i++)
{
cout << "Scansione n. "<<i<<" (elevazione: " << elevation << ")" << endl;
cout << "Raggi: " << numRaggi << endl;
std::vector<int> raggiDaGuardare;
if (angles.size())
{
for (int r=0; r<numRaggi; r++)
if ((angles[r].start >= 15.) && (angles[r].stop < 45.))
raggiDaGuardare.push_back(r);
}
else
{
double step = 360. / numRaggi;
double startangle = 0;
for (int i=0; i<numRaggi; i++)
{
if (startangle >= 15. && startangle < 45.)
raggiDaGuardare.push_back(i);
startangle += step;
}
}
dump_rays(PRODUCT_QUANTITY_WRAD, scan, raggiDaGuardare);
dump_rays(PRODUCT_QUANTITY_VRAD, scan, raggiDaGuardare);
dump_rays(PRODUCT_QUANTITY_DBZH, scan, raggiDaGuardare);
dump_rays(PRODUCT_QUANTITY_TH, scan, raggiDaGuardare);
delete scan;
}
cout << "Lettura eseguita!" << endl;
}
catch (std::exception& stde)
{
cerr << "Errore di esecuzione: " << stde.what() << endl;
}
catch (...)
{
cerr << "Errore di esecuzione sconosciuto" << endl;
}
for (int i=0; i<scans.size(); i++) delete scans[i];
delete volume;
delete factory;
return 0;
}
T & elem(const int r, const int b)
Reference to the element (r,b)
Definition odimh5v20_support.hpp:573
OdimH5 objects factory.
Definition odimh5v20_factory.hpp:50
virtual PolarVolume * openPolarVolume(const std::string &path)
Get a OdimH5 PVOL object from an existing file.
Definition odimh5v20_factory.cpp:260
virtual std::string getVersion()
Get the value of 'version' attribute.
Definition odimh5v20_classes.cpp:294
virtual time_t getDateTime()
Get the joined value of 'date' and 'time' attributes.
Definition odimh5v20_classes.cpp:296
virtual std::string getObject()
Get the value of 'object' attribute.
Definition odimh5v20_classes.cpp:292
virtual SourceInfo getSource()
Get the value of 'source' attribute.
Definition odimh5v20_classes.cpp:298
virtual std::string getConventions()
Get OdimH5 conventions attribute value.
Definition odimh5v20_classes.cpp:152
OdimH5 v2.0 SCAN quantity data.
Definition odimh5v20_classes.hpp:1272
virtual int getNumRays()
Get the number of rays in the matrix.
Definition odimh5v20_classes.cpp:1807
virtual int getNumBins()
Get the number of bins in each ray of the matrix.
Definition odimh5v20_classes.cpp:1812
virtual void readTranslatedData(RayMatrix< float > &matrix)
Read the matrix data translating the values
Definition odimh5v20_classes.cpp:1817
OdimH5 v2.0 Polar Volume SCAN.
Definition odimh5v20_classes.hpp:989
virtual std::vector< AZAngles > getAzimuthAngles()
Get the 'azangles' attribute values.
Definition odimh5v20_classes.cpp:1438
virtual PolarScanData * getQuantityData(int index)
Get the data associated to a quantity.
Definition odimh5v20_classes.cpp:1673
virtual double getEAngle()
Get the 'elangle' attribute value.
Definition odimh5v20_classes.cpp:1375
virtual int getNumRays()
Get the 'numrays' attribute value.
Definition odimh5v20_classes.cpp:1383
virtual bool hasQuantityData(const char *name)
Check if the scan contains the data associated to a quantity.
Definition odimh5v20_classes.cpp:1611
OdimH5 v2.0 Polar Volume.
Definition odimh5v20_classes.hpp:846
virtual double getZR_A()
Get the 'zr_a' attribute value.
Definition odimh5v20_classes.cpp:1034
virtual double getKR_B()
Get the 'kr_b' attribute value.
Definition odimh5v20_classes.cpp:1040
virtual std::string getSoftwareVer()
Get the 'sw_version' attribute value.
Definition odimh5v20_classes.cpp:1032
virtual std::string getSystem()
Get the 'system' attribute value.
Definition odimh5v20_classes.cpp:1028
virtual double getAltitude()
Get the value of 'altitude' attribute.
Definition odimh5v20_classes.cpp:1019
virtual double getLatitude()
Get the value of 'longitude' attribute.
Definition odimh5v20_classes.cpp:1017
virtual double getZR_B()
Get the 'zr_b' attribute value.
Definition odimh5v20_classes.cpp:1036
virtual std::string getTaskOrProdGen()
Get the 'task' attribute value.
Definition odimh5v20_classes.cpp:1022
virtual time_t getEndEpochs()
Get the 'endepochs' attribute value.
Definition odimh5v20_classes.cpp:1026
virtual bool getSimulated()
Get the 'simulated' attribute value.
Definition odimh5v20_classes.cpp:1042
virtual std::string getSoftware()
Get the 'software' attribute value.
Definition odimh5v20_classes.cpp:1030
virtual double getKR_A()
Get the 'kr_a' attribute value.
Definition odimh5v20_classes.cpp:1038
virtual time_t getStartEpochs()
Get the 'startepochs' attribute value.
Definition odimh5v20_classes.cpp:1024
virtual std::vector< PolarScan * > getScansBetween(double minElevation, double maxElevation)
Get the pointers to all the scans with an elevation angle between the given limits.
Definition odimh5v20_classes.cpp:1178
OdimH5 rays matrix.
Definition odimh5v20_support.hpp:616
std::string toString() const
Convert fields into a string formated acording to OdimH5 specifications.
Definition odimh5v20_support.cpp:161
Namespace related to ODIMH5 version 2.0.
Definition odimh5v20.hpp:46
Main header file of the library.