Skip to content

Commit

Permalink
Ensure geographic grids are written as such (#7956)
Browse files Browse the repository at this point in the history
See #7954 for failure.  This PR addresses this problem related to assembled grids.
  • Loading branch information
PaulWessel authored Oct 22, 2023
1 parent f6a77e6 commit 3175b76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gmt_grdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,10 @@ void gmtlib_grd_set_units (struct GMT_CTRL *GMT, struct GMT_GRID_HEADER *header)
string[1] = header->y_units;
string[2] = header->z_units;

/* Safety valve for geographic grids */
if (strstr (string[GMT_X], "longitude")) gmt_set_column_type (GMT, GMT_IN, GMT_X, GMT_IS_LON);
if (strstr (string[GMT_Y], "latitude")) gmt_set_column_type (GMT, GMT_IN, GMT_Y, GMT_IS_LAT);

/* Use input data type as backup for output data type */
for (i = 0; i < 3; i++)
if (gmt_M_type (GMT, GMT_OUT, i) == GMT_IS_UNKNOWN) GMT->current.io.col_type[GMT_OUT][i] = GMT->current.io.col_type[GMT_IN][i];
Expand Down

0 comments on commit 3175b76

Please sign in to comment.