You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pygmt.info function should accept pandas.DataFrame or 2D numpy.array matrices as input. This was mentioned in passing when pygmt.info was originally implemented at #106 (comment). Currently it can only handle filename (str) types:
raiseGMTInvalidInput("'info' only accepts file names.")
What I'm particularly interested in is getting a nicely rounded xmin/xmax/ymin/ymax 'region' by simply passing in a pandas.DataFrame (Option 3 in the related issue at #147). Something like this:
importpandasaspddf: pd.DataFrame=pygmt.datasets.load_ocean_ridge_points()
region=pygmt.info(df, spacing="0.1") # pygmt.info("@ridge.txt", I="0.1")print(region)
# would output '-R-180/180/-65.7/86.8\n', or better, a proper python list
Yes, it's possible to do region = [df.x.min(), df.x.max(), df.y.min(), df.y.max()], but gmtinfo -I does rounding (and I believe it rounds outside of the tight region?), and it has other smart functionality too.
It shouldn't be too hard to make pygmt.info support non-filename types, just need to use lib.virtualfile_from_vectors or the like.
Note that the return values of pygmt.info should be discussed at #147. This issue only tackles the input format type. Perhaps we should handle #147 before this tackling this issue.
Are you willing to help implement and maintain this feature? Yes
The text was updated successfully, but these errors were encountered:
Description of the desired feature
The pygmt.info function should accept pandas.DataFrame or 2D numpy.array matrices as input. This was mentioned in passing when
pygmt.info
was originally implemented at #106 (comment). Currently it can only handle filename (str) types:pygmt/pygmt/modules.py
Lines 89 to 90 in bedb48d
What I'm particularly interested in is getting a nicely rounded xmin/xmax/ymin/ymax 'region' by simply passing in a
pandas.DataFrame
(Option 3 in the related issue at #147). Something like this:Yes, it's possible to do
region = [df.x.min(), df.x.max(), df.y.min(), df.y.max()]
, butgmtinfo -I
does rounding (and I believe it rounds outside of the tight region?), and it has other smart functionality too.It shouldn't be too hard to make
pygmt.info
support non-filename types, just need to uselib.virtualfile_from_vectors
or the like.Note that the return values of
pygmt.info
should be discussed at #147. This issue only tackles the input format type. Perhaps we should handle #147 before this tackling this issue.Are you willing to help implement and maintain this feature? Yes
The text was updated successfully, but these errors were encountered: