Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Dec 30, 2017

Fix #43. Still work in progress. Any suggestions?

gmt/__init__.py Outdated
# Import modules to make the high-level GMT Python API
from .session_management import begin as _begin, end as _end
from .figure import Figure
from .modules import *

Choose a reason for hiding this comment

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

F403 'from .modules import *' used; unable to detect undefined names

Copy link
Member

Choose a reason for hiding this comment

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

Please don't import *. It's better to explicitly import the functions that should be public.

from .utils import build_arg_string
from .decorators import fmt_docstring, use_alias, kwargs_to_strings

@fmt_docstring

Choose a reason for hiding this comment

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

E302 expected 2 blank lines, found 1

@leouieda
Copy link
Member

leouieda commented Jan 9, 2018

@seisman mostly looks good to me. I have some minor comments that I'll leave inline.

gmt/modules.py Outdated
Parameters
----------
data: str
A data file name.
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep it only for data files for now. We can think about adding pandas.Dataframe later but I don't know if it will be helpful.

In this case, fname is a better name for the argument. I'll probably refactor plot to use fname for files as well.

gmt/modules.py Outdated
arg_str = ' '.join([data, build_arg_string(kwargs),
"->" + tmpfile.name])
with LibGMT() as lib:
lib.call_module('gmtinfo', arg_str)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need the "gmt" in the name.

gmt/modules.py Outdated
"""
assert isinstance(fname, str), 'Only accepts file names.'

with GMTTempfile() as tmpfile:

Choose a reason for hiding this comment

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

F821 undefined name 'GMTTempfile'

"""
assert isinstance(fname, str), 'Only accepts file names.'

with GMTTempFile() as tmpfile:

Choose a reason for hiding this comment

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

F821 undefined name 'GMTTempFile'

@seisman
Copy link
Member Author

seisman commented Jan 18, 2018

Maybe I need to add more tests?


TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')

def test_gmtinfo():

Choose a reason for hiding this comment

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

E302 expected 2 blank lines, found 1

@leouieda
Copy link
Member

leouieda commented Feb 7, 2018

Maybe I need to add more tests?

@seisman yes please! I try to have as many configurations as possible tested. The one you have now looks good for the basic functionality.

Would you mind adding some more information to the docstring? You can copy some of the basic descriptions from the GMT docs. Not all options need to be included, just the most common ones. We can think of some aliases for them as well.

Do you think we should print the output instead of returning it? There could be a flag to trigger a return instead of printing. Either way, if the returned string is just a list of numbers, it would be better to return an array/list of the number instead.

@leouieda
Copy link
Member

@seisman I'm updating the branch and merging this as is. I'm working on #92 and I'll make the changes mentioned above.

Thanks for putting in all the work!

@leouieda leouieda merged commit 95cd123 into GenericMappingTools:master Feb 13, 2018
@seisman seisman deleted the gmtinfo branch March 17, 2018 02:02
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.

3 participants