20 namespace fs = std::filesystem;
28 #define OBSATTRS_NAME "OBSATTRS"
29 #define SPAX_NAME "SPAXEL"
30 #define FREQS_NAME "frequencies"
31 #define TIME_NAME "times"
35 #define AZ_SPAX_NAME "az_spax"
36 #define EL_SPAX_NAME "el_spax"
37 #define OUT_NAME "data"
43 void readAtmMeta(
int **meta, std::string path);
45 template <
typename T,
typename U>
52 template <
typename T,
typename U>
70 hid_t dspace_id, dspace_slab_id, dset_id;
73 hsize_t dims_1D[RANK1D],
75 dims_2D_chunk[RANK2D],
76 dims_2D_stride[RANK2D];
78 hsize_t dims_2D_null[2] = {0,0};
81 hsize_t start[2], count[2];
86 void check_API_call_status(
93 printf(
"HDF5 API error occured on line %d\n", loc);
108 this->ntimes = ntimes;
109 this->nfreqs = nfreqs;
125 obsattrs_id = H5Gcreate(
136 dspace_id = H5Screate_simple(
152 check_API_call_status(
164 check_API_call_status(
169 check_API_call_status(
177 dspace_id = H5Screate_simple(
193 check_API_call_status(
205 check_API_call_status(
221 check_API_call_status(
233 check_API_call_status(
248 check_API_call_status(
260 check_API_call_status(
265 check_API_call_status(
270 check_API_call_status(
271 H5Gclose(obsattrs_id),
284 char spax_name[CHBUFF] = SPAX_NAME;
306 dspace_id = H5Screate(H5S_SCALAR);
318 check_API_call_status(
329 check_API_call_status(
344 check_API_call_status(
356 check_API_call_status(
361 check_API_call_status(
367 dspace_id = H5Screate_simple(
384 void write_chunk_to_spaxel(
389 start[0] = offset_times;
390 count[0] = ntimes_chunk;
392 dims_1D[0] = ntimes_chunk * nfreqs;
394 check_API_call_status(
406 dspace_slab_id = H5Screate_simple(
412 check_API_call_status(
424 offset_times += ntimes_chunk;
425 check_API_call_status(
426 H5Sclose(dspace_slab_id),
431 void close_spaxel(
int spax_index)
433 check_API_call_status(
438 check_API_call_status(
443 check_API_call_status(
451 check_API_call_status(
466 fs::path file(
"atm_meta.datp");
467 fs::path abs_loc = dir / file;
469 *meta =
new int[NATMGRID];
473 std::ifstream myfile(abs_loc);
481 <<
"Could not open the file at "
488 while(std::getline(myfile, line))
490 std::istringstream iss(line);
491 while(std::getline(iss, store,
' '))
493 if (store==
"") {
continue;}
494 (*meta)[idx] = std::stoi(store);
502 template <
typename T,
typename U>
511 pwv_atm->start = 0.1;
513 pwv_atm->num = NPWVATM;
515 freq_atm->start = 70.e9;
516 freq_atm->step = 0.1e9;
517 freq_atm->num = NFREQ;
519 *eta_array =
new T[NPWVATM * NFREQ];
524 std::ifstream myfile(filepath);
533 <<
"Could not open the resource file at "
540 while(std::getline(myfile, line))
542 std::istringstream iss(line);
549 while(std::getline(iss, store,
' '))
561 (*eta_array)[NFREQ * (idx-1) + (line_nr - 1)] = std::stof(store);
570 template <
typename T,
typename U>
580 fs::path abs_loc = dir / file;
582 *PWV_screen =
new T[x_spec->num * y_spec->num];
586 std::ifstream myfile(abs_loc);
595 <<
"Could not open the file!"
600 while(std::getline(myfile, line))
602 std::istringstream iss(line);
603 while(std::getline(iss, store,
' '))
610 (*PWV_screen)[y_spec->num * line_nr + idx] = std::stof(store);