Elaboradar 0.1
Caricamento in corso...
Ricerca in corso...
Nessun risultato

◆ read_archived_vpr()

bool elaboradar::Assets::read_archived_vpr ( const radarelab::algo::DBZ dbz,
time_t  time,
radarelab::algo::VPR &  vpr 
)

Try to read the archived VPR at time time.

Return false if the file was not found.

Definizione alla linea 347 del file assets.cpp.

348{
349 const char* dir = getenv("DIR_STORE_VPR"); //--questa non sarebbe una dir_arch più che store?... contesto il nome...
350 if (!dir) return false;
351
352 struct tm t;
353 gmtime_r(&time, &t);
354
355 char fname[64];
356 snprintf(fname, 64, "%04d%02d%02d%02d%02d_vpr_%s",
357 t.tm_year + 1900, t.tm_mon + 1, t.tm_mday,
358 t.tm_hour, t.tm_min, conf_site->name.c_str());
359
360 string pathname = dir;
361 pathname += "/";
362 pathname += fname;
363
364 File in(logging_category);
365 if (!in.open(pathname, "r", "archived VPR file"))
366 return false;
367
368 // TODO: check the actual format of the file and make the parsing safe:
369 // currently if one of these strings is longer than 99, we crash or worse.
370 char stringa[100];
371 fscanf(in, " %s %s %s %s" ,stringa ,stringa,stringa,stringa);
372 for (unsigned ilay=0; ilay < vpr.size(); ++ilay){
373 float vpr_dbz;
374 long int ar;
375 int il;
376 fscanf(in, " %i %f %li", &il, &vpr_dbz, &ar); //---NB il file in archivio è in dBZ e contiene anche la quota----
377
378 //---- converto in R il profilo vecchio--
379 if (vpr_dbz > 0)
380 {
381 vpr.val[ilay] = dbz.DBZtoR(vpr_dbz);
382 vpr.area[ilay] = ar;
383 }
384 else
385 vpr.val[ilay] = NODATAVPR;
386 }
387
388 return true;
389}
Open a file taking its name from a given env variable.
Definition: utils.h:22
std::string name
Nome sito radar.
Definition: site.h:29

Referenzia elaboradar::Site::name, e radarelab::File::open().

Referenziato da find_vpr0().