ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
erf_forest_utils Namespace Reference

Functions

std::string validate_cartesian_coordinates (bool has_x, bool has_y, bool has_lon, bool has_lat, const std::string &source)
 
std::string validate_laimax (const amrex::Real laimax, const std::string &source)
 

Function Documentation

◆ validate_cartesian_coordinates()

std::string erf_forest_utils::validate_cartesian_coordinates ( bool  has_x,
bool  has_y,
bool  has_lon,
bool  has_lat,
const std::string &  source 
)
inline
16 {
17  if (has_x != has_y) {
18  return source + " must provide both projected Cartesian x and y coordinate variables";
19  }
20  if (!has_x && (has_lon || has_lat)) {
21  return source + " provides lon/lat coordinates, but projected Cartesian x/y are required; "
22  "no lon/lat-to-Cartesian projection is applied";
23  }
24  if (!has_x) {
25  return source + " must provide projected Cartesian x and y coordinate variables";
26  }
27  return {};
28 }

◆ validate_laimax()

std::string erf_forest_utils::validate_laimax ( const amrex::Real  laimax,
const std::string &  source 
)
inline

Return an actionable diagnostic for an invalid type-2 canopy LAI maximum. The caller supplies the source description so file-backed and input-backed errors can identify where the bad value came from without aborting here.

37 {
38  if (std::isfinite(static_cast<double>(laimax)) &&
39  laimax >= amrex::Real(0.0) && laimax < amrex::Real(1.0)) {
40  return {};
41  }
42 
43  std::ostringstream message;
44  message << source << " must satisfy 0 <= laimax < 1 (got " << laimax << ")";
45  return message.str();
46 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19

Referenced by ForestDrag::ForestDrag().

Here is the caller graph for this function: