45 LonLatGrid(
const std::vector<double> &x,
const std::vector<double> &y,
46 const std::string &projection) {
48 size_t nrow = y.size();
49 size_t ncol = x.size();
50 size_t N = nrow * ncol;
56 auto C = [ncol](
size_t row,
size_t col) {
return row * ncol + col; };
59 auto deg2rad = [](
double degree) {
return degree * M_PI / 180; };
63 for (
size_t row = 0; row < nrow; ++row) {
64 for (
size_t col = 0; col < ncol; ++col) {
65 auto coords = mapping.
lonlat(x[col], y[row]);
67 lon[C(row, col)] = deg2rad(coords[0]);
68 lat[C(row, col)] = deg2rad(coords[1]);