radarlib 1.4.6
read_polar_volume_scans.cpp
/*===========================================================================*/
/*
/* Questo programma legge tutte le elevazioni comprese tra due angoli
/* specificati e stampa angoli e tempi dei raggi nell'ordine originale in cui
/* erano stati acquisiti
/*
/* Esempo di utilizzo:
/* main.exe volume.h5
/*
/*===========================================================================*/
#include <iostream>
using namespace std;
using namespace OdimH5v20;
using namespace Radar;
/*===========================================================================*/
int main(int argc, char* argv[])
{
if (argc != 2)
{
cout << "Usage: " << argv[0] << " <odimh5file>" << endl;
return -1;
}
OdimFactory* factory = NULL;
PolarVolume* volume = NULL;
std::vector<PolarScan*> scans;
try
{
factory = new OdimFactory();
volume = factory->openPolarVolume(argv[1]);
cout << "File convetions: " << volume->getConventions() << endl;
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 << " - Source: " << volume->getSource().toString() << endl;
cout << "WHERE:" << endl;
cout << " - Latitude: " << volume->getLatitude() << endl;
cout << " - Longitude: " << volume->getLongitude() << endl;
cout << " - Altitude: " << volume->getAltitude() << endl;
cout << "HOW:" << endl;
cout << " - Task: " << volume->getTaskOrProdGen() << endl;
cout << " - Start epochs: " << volume->getStartEpochs() << endl;
cout << " - End epochs: " << volume->getEndEpochs() << endl;
cout << " - System: " << volume->getSystem() << endl;
cout << " - Software: " << volume->getSoftware() << endl;
cout << " - Software ver: " << volume->getSoftwareVer() << 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;
cout << " - Simulated: " << volume->getSimulated() << endl;
scans = volume->getScansBetween(-1., 5.);
for (size_t i=0; i<scans.size(); i++)
{
PolarScan* scan = scans[i];
/* estraggo vari dati che mi interessano */
time_t startdatetime = scan->getStartDateTime();
time_t enddatetime = scan->getEndDateTime();
int numrays = scan->getNumRays();
int a1gate = scan->getA1Gate();
int direction = scan->getDirection();
std::vector<AZAngles> angles = scan->getAzimuthAngles();
std::vector<AZTimes> times = scan->getAzimuthTimes();
cout << "------" << endl;
cout << " SCAN " << endl;
cout << "------" << endl;
cout << "Rays: " << numrays << endl;
cout << "Star ttime: " << timeutils::absoluteToString(startdatetime) << endl;
cout << "End time: " << timeutils::absoluteToString(enddatetime) << endl;
cout << "A1gate: " << a1gate << endl;
cout << "Direction: " << (direction > 0 ? "CW" : "CCW") << endl;
/* stampo tutti i raggi */
for (int i=0; i<numrays; i++)
{
/* traduco in base all'indice progressivo 'i' calcolo l'indice originale */
int j = PolarScan::originaRayIndex(i, direction, numrays, a1gate);
printf(
"i %03d = ray %03d = time %s / %s - az: %03.03f / %03.03f \n",
i,
j,
timeutils::absoluteToString( times[j].start ).c_str(),
timeutils::absoluteToString( times[j].stop ).c_str(),
angles[j].start,
angles[j].stop
);
}
}
cout << "Lettura eseguita!" << endl;
}
catch (std::exception& stde)
{
cerr << "Errore di esecuzione: " << stde.what() << endl;
}
catch (...)
{
cerr << "Errore di esecuzione sconosciuto" << endl;
}
for (size_t i=0; i<scans.size(); i++) delete scans[i];
delete volume;
delete factory;
getchar();
return 0;
}
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 Polar Volume SCAN.
Definition: odimh5v20_classes.hpp:989
virtual time_t getEndDateTime()
Get the value of 'enddate' and 'endtime' attributes.
Definition: odimh5v20_classes.cpp:1353
virtual std::vector< AZAngles > getAzimuthAngles()
Get the 'azangles' attribute values.
Definition: odimh5v20_classes.cpp:1438
virtual int getDirection()
Get the direction of the scan
Definition: odimh5v20_classes.cpp:1701
virtual time_t getStartDateTime()
Get the value of 'startdate' and 'starttime' attributes.
Definition: odimh5v20_classes.cpp:1351
virtual int getNumRays()
Get the 'numrays' attribute value.
Definition: odimh5v20_classes.cpp:1383
virtual int getA1Gate()
Get the 'a1gate' attribute value.
Definition: odimh5v20_classes.cpp:1385
virtual std::vector< AZTimes > getAzimuthTimes()
Get the 'aztimes' attribute values.
Definition: odimh5v20_classes.cpp:1505
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
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.