How to load data into pyGMT

Hi,
I just found your awesome project.

How can I load some data from a csv into pyGMT? And how does the csv have to look like?

Cheers

Hi there,

You can just use pandas.read_csv to load data from a CSV file. Or you can just pass in the filename to a pygmt function if it allows it. The CSV file can look like anything if you use pandas. With filenames, you might find space separated to work better, and headers need to start with a #.

You might find the workshop tutorial at foss4g2019oceania/2_pydata_and_pygmt.ipynb at master · GenericMappingTools/foss4g2019oceania · GitHub to be a useful start. Let us know if you need any additional help :grin:.

thanks man :slight_smile:
Do you guys mind if I make a Tutorial-Video about installing and using your software?

1 Like

Sure, why not? People learn in different ways, and i must say, video can be quite an effective medium! We actually have a Youtube channel but that’s light on content right now.

PyGMT v0.1.0 should be released soon (this month :crossed_fingers:), and the installation instructions will get a lot easier in pip and likely on conda too. I think more users would appreciate your tutorials then :smile:

great!
How can I see which version of PyGMT is running and is there a way to upgrade?

You can check the version by printing pygmt.__version__ in python, e.g.:

python -c "import pygmt; print(pygmt.__version__)"

The installation instructions are on the documentation page (and it should upgrade you to the latest). Until we release version 0.1.0, that means installing from Github using pip install --upgrade https://github.com/GenericMappingTools/pygmt/archive/master.zip. Once we have a release, you should be able to just do pip install pygmt. I’ll edit this post once that happens, hopefully around the end of April. Edit: PyGMT v0.1.0 has been released, so pip install pygmt should work!