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

Refactor the gmt.clib package #210

Merged
merged 9 commits into from
Jul 8, 2018
Merged

Refactor the gmt.clib package #210

merged 9 commits into from
Jul 8, 2018

Conversation

leouieda
Copy link
Member

@leouieda leouieda commented Jul 8, 2018

A much needed refactor of the gmt.clib package.

  • Renames LibGMT to Session because that is what it actually is (the GMT API session).
  • Renames clib.core to clib.session and break up clib.utils into clib.loading (functions for loading libgmt) and clib.conversion (functions that handle the ctypes conversions from numpy, etc).
  • Renames the virtual file creating methods from *_to_vfile to virtualfile_from_*
  • The create and destroy methods now set the session pointer (Session.session_pointer), which simplifies the __enter__ and __exit__ methods.
  • Session.get_constant is now implemented as Session.__getitem__ so getting a constant is now much shorter: self["GMT_IS_MATRIX"].
  • The constant values are stored as module variables instead of in the class.
  • Re-enables intersphinx.

@leouieda leouieda changed the title Refactor gmt.clib [WIP] Refactor gmt.clib Jul 8, 2018
@leouieda
Copy link
Member Author

leouieda commented Jul 8, 2018

I'm still not entirely happy with the virtual file mechanics. It would make a lot more sense for the virtual file to be its own class but that doesn't match with the way GMT does things. For one, it would need the current clib.Session object as input, which would look silly in Python.

@leouieda leouieda changed the title [WIP] Refactor gmt.clib Refactor gmt.clib Jul 8, 2018
@leouieda leouieda changed the title Refactor gmt.clib Refactor the gmt.clib package Jul 8, 2018
@leouieda leouieda merged commit 81a30a8 into master Jul 8, 2018
@leouieda leouieda deleted the clib-refactor branch July 8, 2018 01:22
@leouieda
Copy link
Member Author

leouieda commented Jul 8, 2018

@seisman I made some changes to the clib package. Most of these fix some pain points I came across when trying to explain the API for my Scipy talk next week.

weiji14 added a commit that referenced this pull request Jun 22, 2020
Should be GMT_IS_OUTPUT instead of GMT_OUTPUT. Also update some docstrings that were missed in the #210 refactor PR.
weiji14 added a commit that referenced this pull request Jul 14, 2020
Should be GMT_IS_OUTPUT instead of GMT_OUTPUT. Also update some docstrings that were missed in the #210 refactor PR.
weiji14 added a commit that referenced this pull request Jul 16, 2020
* Add registration (r) to common options
* Set valid GMT data mode as GMT_IS_OUTPUT
Should be GMT_IS_OUTPUT instead of GMT_OUTPUT.
Also update some docstrings that were missed in the #210 refactor PR.
* Simplify grid region extent calculation
* Refactor virtualfile_from_grid and dataarray_to_matrix to use accessor
* Fix tests where virtual grid had wrong region, registration and gtype
* Expect failures from two grdview tests that used wrong coordinate system
* Fix test_grdimage_over_dateline by using gridline instead of pixel reg
* Flip grid array left right in xarray instead of in numpy
* Test with a grid that does not reach the North Pole
Values go from latitude 89S to 89N. Avoids the `grdimage [INFORMATION]:
359 (of 361) inconsistent grid values at North pole.` message.
* Try just running test_grdimage_over_dateline first before other tests
* Say why we need to run test_grdimage_over_dateline before other tests
* Register the custom runfirst pytest marker
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.

1 participant