224 ParmParse
pp(pp_prefix);
226 Vector<std::string> names;
227 const int nstation =
pp.countval(
"station_names");
229 pp.getarr(
"station_names", names, 0, nstation);
235 pp.queryAdd(
"station_output_dir",
m_dir);
237 for (
const auto&
name : names)
239 check_station_name(
name);
241 if (earlier.name ==
name) {
242 amrex::Abort(
"Station '" +
name +
"' is named twice in erf.station_names; the "
243 "two would write the same file");
250 ParmParse pps(pp_prefix +
"." +
name);
252 const int nfield = pps.countval(
"field");
254 Abort(station_key_error(
name,
"field",
"must name at least one variable"));
256 Vector<std::string> fields;
257 pps.getarr(
"field", fields, 0, nfield);
258 for (
const auto& field : fields) {
261 station.
vars.push_back(var);
265 const std::string lon_key = pps.contains(
"long") ?
"long" :
"lon";
266 const bool has_lat = pps.contains(
"lat");
267 const bool has_lon = pps.contains(
"long") || pps.contains(
"lon");
268 const bool has_x = pps.contains(
"x");
269 const bool has_y = pps.contains(
"y");
271 if ((has_lat || has_lon) && (has_x || has_y)) {
272 Abort(
"Station '" +
name +
"': specify either lat/long or x/y, not both");
275 if (has_lat || has_lon) {
276 if (!has_lat || !has_lon) {
277 Abort(
"Station '" +
name +
"': lat and long must both be given");
279 const int nlat = pps.countval(
"lat");
280 const int nlon = pps.countval(lon_key.c_str());
282 Abort(
"Station '" +
name +
"': lat has " + std::to_string(nlat) +
283 " values but " + lon_key +
" has " + std::to_string(nlon) +
284 "; they are paired, so the counts must match");
286 Vector<Real> lat, lon;
287 pps.getarr(
"lat", lat, 0, nlat);
288 pps.getarr(lon_key.c_str(), lon, 0, nlon);
289 for (
int i = 0; i < nlat; ++i) {
294 station.
locs.push_back(loc);
297 if (!has_x || !has_y) {
298 Abort(
"Station '" +
name +
"': give either lat/long, or x and y in domain coordinates");
300 const int nx = pps.countval(
"x");
301 const int ny = pps.countval(
"y");
303 Abort(
"Station '" +
name +
"': x has " + std::to_string(
nx) +
304 " values but y has " + std::to_string(
ny) +
305 "; they are paired, so the counts must match");
308 pps.getarr(
"x", xv, 0,
nx);
309 pps.getarr(
"y", yv, 0,
ny);
310 for (
int i = 0; i <
nx; ++i) {
315 station.
locs.push_back(loc);
325 const int n_agl = pps.countval(
"height_agl");
326 const int n_abs = pps.countval(
"height_abs");
328 if (n_agl > 0 && n_abs > 0) {
329 Abort(
"Station '" +
name +
"': give heights as either erf." +
name +
330 ".height_agl (above the local terrain) or erf." +
name +
331 ".height_abs (in the model's z coordinate), not both");
333 if (pps.contains(
"height")) {
334 Abort(
"Station '" +
name +
"': erf." +
name +
".height is not a key; say "
335 "erf." +
name +
".height_agl for metres above the local terrain, or erf." +
336 name +
".height_abs for metres in the model's z coordinate");
340 const char* height_key = station.
heights_are_agl ?
"height_agl" :
"height_abs";
341 const int nheight = std::max(n_agl, n_abs);
343 pps.getarr(height_key, station.
heights, 0, nheight);
const int nx
Definition: ERF_InitCustomPertVels_CloudChamber.H:14
const int ny
Definition: ERF_InitCustomPertVels_CloudChamber.H:15
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:105
amrex::Vector< Station > m_stations
Definition: ERF_StationSampler.H:203
int m_buffer_steps
Definition: ERF_StationSampler.H:205
std::string m_dir
Definition: ERF_StationSampler.H:222
Definition: ERF_StationSampler.H:62
amrex::Real req_lat
Definition: ERF_StationSampler.H:66
amrex::Real req_lon
Definition: ERF_StationSampler.H:67
amrex::Real x
Definition: ERF_StationSampler.H:70
bool use_latlon
Definition: ERF_StationSampler.H:63
amrex::Real y
Definition: ERF_StationSampler.H:71
Definition: ERF_StationSampler.H:52
std::string name
Definition: ERF_StationSampler.H:53
Definition: ERF_StationSampler.H:109
amrex::Vector< StationLoc > locs
Definition: ERF_StationSampler.H:112
bool heights_are_agl
Definition: ERF_StationSampler.H:118
std::string name
Definition: ERF_StationSampler.H:110
amrex::Vector< amrex::Real > heights
Definition: ERF_StationSampler.H:117
amrex::Vector< StationVar > vars
Definition: ERF_StationSampler.H:111