213 ParmParse
pp(pp_prefix);
215 Vector<std::string> names;
216 const int nstation =
pp.countval(
"station_names");
218 pp.getarr(
"station_names", names, 0, nstation);
224 pp.queryAdd(
"station_output_dir",
m_dir);
226 for (
const auto&
name : names)
228 check_station_name(
name);
230 if (earlier.name ==
name) {
231 amrex::Abort(
"Station '" +
name +
"' is named twice in erf.station_names; the "
232 "two would write the same file");
239 ParmParse pps(pp_prefix +
"." +
name);
241 const int nfield = pps.countval(
"field");
243 Abort(station_key_error(
name,
"field",
"must name at least one variable"));
245 Vector<std::string> fields;
246 pps.getarr(
"field", fields, 0, nfield);
247 for (
const auto& field : fields) {
250 station.
vars.push_back(var);
254 const std::string lon_key = pps.contains(
"long") ?
"long" :
"lon";
255 const bool has_lat = pps.contains(
"lat");
256 const bool has_lon = pps.contains(
"long") || pps.contains(
"lon");
257 const bool has_x = pps.contains(
"x");
258 const bool has_y = pps.contains(
"y");
260 if ((has_lat || has_lon) && (has_x || has_y)) {
261 Abort(
"Station '" +
name +
"': specify either lat/long or x/y, not both");
264 if (has_lat || has_lon) {
265 if (!has_lat || !has_lon) {
266 Abort(
"Station '" +
name +
"': lat and long must both be given");
268 const int nlat = pps.countval(
"lat");
269 const int nlon = pps.countval(lon_key.c_str());
271 Abort(
"Station '" +
name +
"': lat has " + std::to_string(nlat) +
272 " values but " + lon_key +
" has " + std::to_string(nlon) +
273 "; they are paired, so the counts must match");
275 Vector<Real> lat, lon;
276 pps.getarr(
"lat", lat, 0, nlat);
277 pps.getarr(lon_key.c_str(), lon, 0, nlon);
278 for (
int i = 0; i < nlat; ++i) {
283 station.
locs.push_back(loc);
286 if (!has_x || !has_y) {
287 Abort(
"Station '" +
name +
"': give either lat/long, or x and y in domain coordinates");
289 const int nx = pps.countval(
"x");
290 const int ny = pps.countval(
"y");
292 Abort(
"Station '" +
name +
"': x has " + std::to_string(
nx) +
293 " values but y has " + std::to_string(
ny) +
294 "; they are paired, so the counts must match");
297 pps.getarr(
"x", xv, 0,
nx);
298 pps.getarr(
"y", yv, 0,
ny);
299 for (
int i = 0; i <
nx; ++i) {
304 station.
locs.push_back(loc);
314 const int n_agl = pps.countval(
"height_agl");
315 const int n_abs = pps.countval(
"height_abs");
317 if (n_agl > 0 && n_abs > 0) {
318 Abort(
"Station '" +
name +
"': give heights as either erf." +
name +
319 ".height_agl (above the local terrain) or erf." +
name +
320 ".height_abs (in the model's z coordinate), not both");
322 if (pps.contains(
"height")) {
323 Abort(
"Station '" +
name +
"': erf." +
name +
".height is not a key; say "
324 "erf." +
name +
".height_agl for metres above the local terrain, or erf." +
325 name +
".height_abs for metres in the model's z coordinate");
329 const char* height_key = station.
heights_are_agl ?
"height_agl" :
"height_abs";
330 const int nheight = std::max(n_agl, n_abs);
332 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:101
amrex::Vector< Station > m_stations
Definition: ERF_StationSampler.H:227
int m_buffer_steps
Definition: ERF_StationSampler.H:229
std::string m_dir
Definition: ERF_StationSampler.H:246
Definition: ERF_StationSampler.H:86
amrex::Real req_lat
Definition: ERF_StationSampler.H:90
amrex::Real req_lon
Definition: ERF_StationSampler.H:91
amrex::Real x
Definition: ERF_StationSampler.H:94
bool use_latlon
Definition: ERF_StationSampler.H:87
amrex::Real y
Definition: ERF_StationSampler.H:95
Definition: ERF_StationSampler.H:76
std::string name
Definition: ERF_StationSampler.H:77
Definition: ERF_StationSampler.H:133
amrex::Vector< StationLoc > locs
Definition: ERF_StationSampler.H:136
bool heights_are_agl
Definition: ERF_StationSampler.H:142
std::string name
Definition: ERF_StationSampler.H:134
amrex::Vector< amrex::Real > heights
Definition: ERF_StationSampler.H:141
amrex::Vector< StationVar > vars
Definition: ERF_StationSampler.H:135