Skip to content

Fix the grid accessor (grid registration and type) for 3D grids#1913

Merged
seisman merged 1 commit intomainfrom
fix-cube-accessors
May 4, 2022
Merged

Fix the grid accessor (grid registration and type) for 3D grids#1913
seisman merged 1 commit intomainfrom
fix-cube-accessors

Conversation

@seisman
Copy link
Member

@seisman seisman commented May 3, 2022

Description of proposed changes

As mentioned in GenericMappingTools/gmt#6588 (comment), the grdinfo output for a 3D grid was wrong in old GMT versions.

After the upstream fix, the grdinfo output is:

$ gmt grdinfo -Cn eraint_uvz.nc     
grdinfo [WARNING]: No 3-D array in file eraint_uvz.nc.  Selecting first 3-D slice in the 4-D array z
-180	179.25	-90	90	200	850	66825.5	66825.5	0.75	0.75	0	480	241	3	0	1

which has 16 columns, instead of 12 columns for 2D grids. Thus, we cannot get the grid registration and type information from columes 11 and 12. Instead, we should use the last two columns instead.

Fixes #

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman changed the title Fix the grid accessor for 3D grid Fix the grid accessor for 3D grids May 3, 2022
@seisman seisman changed the title Fix the grid accessor for 3D grids Fix the grid accessor (grid registration and type) for 3D grids May 3, 2022
@seisman seisman added the maintenance Boring but important stuff for the core devs label May 3, 2022
@seisman seisman added this to the 0.7.0 milestone May 3, 2022
@seisman seisman added bug Something isn't working and removed maintenance Boring but important stuff for the core devs labels May 3, 2022
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, and it's compatible with GMT 6.3 and 6.4!

@weiji14 weiji14 added the final review call This PR requires final review and approval from a second reviewer label May 3, 2022
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label May 4, 2022
@seisman seisman merged commit d8a7f9e into main May 4, 2022
@seisman seisman deleted the fix-cube-accessors branch May 4, 2022 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants