Add function to import hotspot dataset#1386
Conversation
|
@GenericMappingTools/pygmt-maintainers Any ideas on how to make this csv import look less hacked together? |
Have you tried using |
I have. The problem is that I want to include the entire hotspot name in one field/string, but they're inconsistent in spacing/number of words. For example, the Bermuda line reads |
There was a problem hiding this comment.
Sorry for the delay. I see what you mean by inconsistent spacing, the hotspots.txt file is space-separated for the first three columns and tab-separated for the last column. I've figured out one alternative way by reading in the first 3 and last 1 column separately, and then concatenating together (see below).
P.S. There are some commits in this PR on sphdistance. You might want to cherry-pick the 'hotspot' only commits to a clean 'add-hospot-dataset' branch (and do a force-push). Or we could merge in the sphdistance PR at #1383 before this #1386 PR to save you some hassle 🙂
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Sounds good; I'll wait until the remote file is updated and then push an update to this PR. I'll convert to draft for the time being. |
|
@willschlitzer The hotspots.txt file is now updated. |
Sounds good, I'll update this branch and make sure everything checks out. |
|
@GenericMappingTools/pygmt-maintainers I have updated |
Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
…pygmt into add-hotspot-dataset
maxrjones
left a comment
There was a problem hiding this comment.
Nice work! Just one final recommendation to add the reference for the original data.
Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
This pull request adds a function to import the
hotspots.txtdataset used in some of the GMT code examples. Unfortunately, due to inconsistent spacing between the columns in the data, I was not able to usepd.read_csv()to read the data into a DataFrame. It would be great to get any feedback to shorten this code, as it currently appears messy.Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version