Go to the documentation of this file.
16 int **wv_vals_out,
int **wv_indexes_out,
17 int *wv_num_to_pass,
const char *prod_list) {
19 netCDF::NcFile l2_file(inp_file, netCDF::NcFile::read);
20 auto grp = l2_file.getGroup(
"sensor_band_parameters");
22 if (grp.getVar(
"wavelength_3d").isNull()) {
24 std::cerr <<
"No wavelength 3D are found in the L2 file "
25 << inp_file <<
" but the user supplied it";
31 std::cout <<
"No wavelength_3d list is supplied by the user. "
32 "All wavelength 3D will be in output "
37 auto dims_wv_3d = grp.getVar(
"wavelength_3d").getDims();
40 dims_wv_3d.begin(), dims_wv_3d.end(),
41 [&](
const netCDF::NcDim &dim) { wv_3d_len *= dim.getSize(); });
42 std::vector<int> wv_3d_vals(wv_3d_len, 0);
43 grp.getVar(
"wavelength_3d").getVar(wv_3d_vals.data());
44 std::unordered_map<int, int> wv_3d_vals_lut;
46 std::for_each(wv_3d_vals.begin(), wv_3d_vals.end(),
48 wv_3d_vals_lut.insert({val, count});
51 static std::vector<int> wv_requested_vals,wv_requested_indexes;
52 parse_wv_list(wv_list, wv_3d_vals_lut,wv_requested_vals,wv_requested_indexes);
54 *wv_vals_out = wv_requested_vals.data();
55 *wv_indexes_out = wv_requested_indexes.data();
56 *wv_num_to_pass = (
int)wv_requested_vals.size();
57 }
catch (netCDF::exceptions::NcException
const &e) {
60 }
catch (std::exception
const &e) {
61 std::cerr <<
"Error opening file for reading: " << e.what()
void parse_wv_list(const std::string &wv_list, const std::unordered_map< int, int > &wv3d_list, std::vector< int > &wv_requested_vals, std::vector< int > &wv_requested_indexes, bool exit_on_not_found)