Skip to content

Commit

Permalink
Print a better error message when PROJ is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
ckhroulev committed Oct 16, 2024
1 parent 05d429a commit 52ebc0d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/icemodel/initialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1072,13 +1072,21 @@ void IceModel::compute_lat_lon() {

std::string projection = m_grid->get_mapping_info().proj_string;

if (m_config->get_flag("grid.recompute_longitude_and_latitude") and
not projection.empty()) {
m_log->message(2,
"* Computing longitude and latitude using projection parameters...\n");
const char *compute_lon_lat = "grid.recompute_longitude_and_latitude";

if (m_config->get_flag(compute_lon_lat) and not projection.empty()) {
m_log->message(2, "* Computing longitude and latitude using projection parameters...\n");

#if (Pism_USE_PROJ==1)
compute_longitude(projection, m_geometry.longitude);
compute_latitude(projection, m_geometry.latitude);
#else
throw RuntimeError::formatted(PISM_ERROR_LOCATION,
"Cannot compute longitude and latitude.\n"
"Please rebuild PISM with PROJ\n"
"or set '%s' to 'false'.",
compute_lon_lat);
#endif

// IceModel::bootstrap_2d() uses these attributes to determine if it needs to regrid
// longitude and latitude.
Expand Down

0 comments on commit 52ebc0d

Please sign in to comment.