Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create LibGMT.grid_to_vfile for xarray support #159

Merged
merged 5 commits into from
Apr 10, 2018
Merged

Conversation

leouieda
Copy link
Member

@leouieda leouieda commented Apr 9, 2018

Changes proposed in this pull request

Implements a new context manager LibGMT.grid_to_vfile that takes
an xarray.DataArray, creates a GMT_MATRIX to store the data,
passes it along to a virtual file, and yields the virtual file name.

This is the main building block for supporting the grd* commands (#124).

Implemented a doctest using the earth relief data. Not passing at the
moment. Failing with a Seg Fault. Might be because the direction needs
to be `GMT_IN|GMT_IS_REFERENCE`. Need support for | in the direction
argument.
Still crashing when using ranges and inc but works with dim. Might be a
bug in GMT
Need docs for dataarray_to_matrix and more tests for the code.
@leouieda
Copy link
Member Author

leouieda commented Apr 9, 2018

Still needs some work on documentation and extensive testing.

gmt/clib/core.py Outdated
direction_int = self._parse_constant(
direction, valid=['GMT_IN', 'GMT_OUT'],
valid_modifiers=['GMT_IS_REFERENCE'])
# valid_modifiers=None)

Choose a reason for hiding this comment

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

E116 unexpected indentation (comment)


"""
if len(grid.dims) != 2:
raise GMTInvalidInput(

Choose a reason for hiding this comment

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

F821 undefined name 'GMTInvalidInput'

north_incs = north[1:] - north[0:-1]
north_inc = north_incs[0]
if not np.allclose(north_incs, north_inc):
raise GMTInvalidInput(

Choose a reason for hiding this comment

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

F821 undefined name 'GMTInvalidInput'

@leouieda
Copy link
Member Author

leouieda commented Apr 9, 2018

Requires GMT 6.0.0a14 to work. There was a bug in the GMT grid creation when specified the grid dimensions and increments.

@leouieda leouieda merged commit f979f02 into master Apr 10, 2018
@leouieda leouieda deleted the xarray-support branch April 10, 2018 04:31
@leouieda leouieda mentioned this pull request Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants