Skip to content

Commit 52ebc0d

Browse files
committed
Print a better error message when PROJ is not available
1 parent 05d429a commit 52ebc0d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/icemodel/initialization.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,13 +1072,21 @@ void IceModel::compute_lat_lon() {
10721072

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

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

1080+
#if (Pism_USE_PROJ==1)
10801081
compute_longitude(projection, m_geometry.longitude);
10811082
compute_latitude(projection, m_geometry.latitude);
1083+
#else
1084+
throw RuntimeError::formatted(PISM_ERROR_LOCATION,
1085+
"Cannot compute longitude and latitude.\n"
1086+
"Please rebuild PISM with PROJ\n"
1087+
"or set '%s' to 'false'.",
1088+
compute_lon_lat);
1089+
#endif
10821090

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

0 commit comments

Comments
 (0)