#include <iostream>
int main(int argc, char* argv[])
{
if (argc != 2)
{
std::cout << "Usage: " << argv[0] << " <odimh5file>" << std::endl;
return -1;
}
OdimFactory* factory = NULL;
PolarVolume* volume = NULL;
OdimObjectDumper* dumper = NULL;
std::set<std::string> quantities;
try
{
factory = new OdimFactory();
volume = factory->createPolarVolume(argv[1]);
SourceInfo source;
source.setWMO("wmo");
source.setOperaRadarSite("rad");
source.setOriginatingCenter(1);
source.setPlace("plc");
source.setCountry(2);
source.setComment("cmt");
volume->setSource(source);
volume->setLongitude (11.6236);
volume->setLatitude (44.4567);
volume->setAltitude (31.);
volume->setTaskOrProdGen ("task");
volume->setSystem ("system");
volume->setSoftware ("software");
volume->setSoftwareVer ("sw_version");
volume->setZR_A (10.);
volume->setZR_B (11.);
volume->setKR_A (12.);
volume->setKR_B (13.);
volume->setSimulated (true);
volume->getHow()->set("attributo intero inventato", (int)100);
volume->getHow()->set("attributo stringa inventato", "valore stringa inventato");
for (int s=0; s<10; s++)
{
PolarScan* scan = volume->createScan();
const int NUMBINS = 1;
const int NUMRAYS = 1;
scan->setEAngle ((double)s * 3.);
scan->setA1Gate (s);
scan->setNumBins (NUMBINS);
scan->setNumRays (NUMRAYS);
scan->setRangeStart (0);
scan->setRangeScale (1000);
scan->setRadarHorizon ((double)(1000 * NUMBINS) / 1000.);
scan->setBeamWidth (0.1);
scan->setWaveLength (0.1);
scan->setRPM (3);
scan->setLowPRF (300);
scan->setHighPRF (600);
scan->getWhat()->set("attributo intero inventato", (int)100);
scan->getWhat()->set("attributo stringa inventato", "valore stringa inventato");
for (std::set<std::string>::iterator i=quantities.begin(); i!=quantities.end(); i++)
{
std::string quantityName = *i;
PolarScanData* data = scan->createQuantityData(quantityName);
data->setNodata (0.);
data->setUndetect (0.);
data->setOffset (0.);
data->setGain (1.);
data->getWhat()->set("attributo intero inventato", (int)100);
data->getWhat()->set("attributo stringa inventato", "valore stringa inventato");
RayMatrix<unsigned char> matrixW(NUMRAYS,NUMBINS);
for (int i=0; i<NUMRAYS; i++)
for (int j=0; j<NUMBINS; j++)
matrixW.elem(i,j) = 65 + ((i * j) % 120);
data->writeData(matrixW);
delete data;
PolarScanData* data2 = scan->createQuantityData(PRODUCT_QUANTITY_VRAD);
double offset = 123.456;
double gain = (NUMRAYS * NUMBINS * 0.5 - offset) / 256.;
data2->setNodata (0.);
data2->setUndetect (0.);
data2->setOffset ((double)offset);
data2->setGain ((double)gain);
data2->getWhat()->set("attributo intero inventato", (int)100);
data2->getWhat()->set("attributo stringa inventato", "valore stringa inventato");
RayMatrix<float> matrixV(NUMRAYS,NUMBINS);
for (int i=0; i<NUMRAYS; i++)
for (int j=0; j<NUMBINS; j++)
matrixV.elem(i,j) = (float)(i * j * 0.5 + offset);
data2->writeAndTranslate(matrixV, (float)offset, (float)gain, H5::PredType::NATIVE_UINT8);
delete data2;
}
delete scan;
}
std::cout << "Esecuzione terminata" << std::endl;
}
catch (std::exception& stde)
{
std::cerr << "Errore di esecuzione: " << stde.what() << std::endl;
}
catch (...)
{
std::cerr << "Errore sconociuto" << std::endl;
}
delete dumper;
delete volume;
delete factory;
return 0;
}
static void getStandardQuantities(std::set< std::string > &names)
Gets the names of standard quantities.
Definition: odimh5v20_const.cpp:479
static void checkVersion()
Check the library version.
Definition: lib.hpp:76
Namespace related to ODIMH5 version 2.0.
Definition: odimh5v20.hpp:46
time_t mktime(int year, int month, int day)
Create a time from a date.
Definition: time.cpp:110
Main header file of the library.