225 ParmParse
pp(pp_prefix);
227 Vector<std::string> names;
228 const int nstation =
pp.countval(
"station_names");
230 pp.getarr(
"station_names", names, 0, nstation);
236 pp.queryAdd(
"station_output_dir",
m_dir);
240 for (
const auto&
name : names)
242 check_station_name(
name);
244 if (earlier.name ==
name) {
245 amrex::Abort(
"Station '" +
name +
"' is named twice in erf.station_names; the "
246 "two would write the same file");
253 ParmParse pps(pp_prefix +
"." +
name);
255 const int nfield = pps.countval(
"field");
257 Abort(station_key_error(
name,
"field",
"must name at least one variable"));
259 Vector<std::string> fields;
260 pps.getarr(
"field", fields, 0, nfield);
261 for (
const auto& field : fields) {
264 station.
vars.push_back(var);
268 const std::string lon_key = pps.contains(
"long") ?
"long" :
"lon";
269 const bool has_lat = pps.contains(
"lat");
270 const bool has_lon = pps.contains(
"long") || pps.contains(
"lon");
271 const bool has_x = pps.contains(
"x");
272 const bool has_y = pps.contains(
"y");
274 if ((has_lat || has_lon) && (has_x || has_y)) {
275 Abort(
"Station '" +
name +
"': specify either lat/long or x/y, not both");
278 if (has_lat || has_lon) {
279 if (!has_lat || !has_lon) {
280 Abort(
"Station '" +
name +
"': lat and long must both be given");
282 const int nlat = pps.countval(
"lat");
283 const int nlon = pps.countval(lon_key.c_str());
285 Abort(
"Station '" +
name +
"': lat has " + std::to_string(nlat) +
286 " values but " + lon_key +
" has " + std::to_string(nlon) +
287 "; they are paired, so the counts must match");
289 Vector<Real> lat, lon;
290 pps.getarr(
"lat", lat, 0, nlat);
291 pps.getarr(lon_key.c_str(), lon, 0, nlon);
292 for (
int i = 0; i < nlat; ++i) {
297 station.
locs.push_back(loc);
300 if (!has_x || !has_y) {
301 Abort(
"Station '" +
name +
"': give either lat/long, or x and y in domain coordinates");
303 const int nx = pps.countval(
"x");
304 const int ny = pps.countval(
"y");
306 Abort(
"Station '" +
name +
"': x has " + std::to_string(
nx) +
307 " values but y has " + std::to_string(
ny) +
308 "; they are paired, so the counts must match");
311 pps.getarr(
"x", xv, 0,
nx);
312 pps.getarr(
"y", yv, 0,
ny);
313 for (
int i = 0; i <
nx; ++i) {
318 station.
locs.push_back(loc);
328 const int n_agl = pps.countval(
"height_agl");
329 const int n_abs = pps.countval(
"height_abs");
331 if (n_agl > 0 && n_abs > 0) {
332 Abort(
"Station '" +
name +
"': give heights as either erf." +
name +
333 ".height_agl (above the local terrain) or erf." +
name +
334 ".height_abs (in the model's z coordinate), not both");
336 if (pps.contains(
"height")) {
337 Abort(
"Station '" +
name +
"': erf." +
name +
".height is not a key; say "
338 "erf." +
name +
".height_agl for metres above the local terrain, or erf." +
339 name +
".height_abs for metres in the model's z coordinate");
343 const char* height_key = station.
heights_are_agl ?
"height_agl" :
"height_abs";
344 const int nheight = std::max(n_agl, n_abs);
346 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:116
amrex::Vector< Station > m_stations
Definition: ERF_StationSampler.H:272
int m_buffer_steps
Definition: ERF_StationSampler.H:274
bool m_allow_unavailable
Definition: ERF_StationSampler.H:275
std::string m_dir
Definition: ERF_StationSampler.H:292
Definition: ERF_StationSampler.H:117
amrex::Real req_lat
Definition: ERF_StationSampler.H:121
amrex::Real req_lon
Definition: ERF_StationSampler.H:122
amrex::Real x
Definition: ERF_StationSampler.H:125
bool use_latlon
Definition: ERF_StationSampler.H:118
amrex::Real y
Definition: ERF_StationSampler.H:126
Definition: ERF_StationSampler.H:71
std::string name
Definition: ERF_StationSampler.H:72
Definition: ERF_StationSampler.H:174
amrex::Vector< StationLoc > locs
Definition: ERF_StationSampler.H:177
bool heights_are_agl
Definition: ERF_StationSampler.H:183
std::string name
Definition: ERF_StationSampler.H:175
amrex::Vector< amrex::Real > heights
Definition: ERF_StationSampler.H:182
amrex::Vector< StationVar > vars
Definition: ERF_StationSampler.H:176