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
Add new function to load fractures sample data #1101
Conversation
As suggested in #794 here's the function implementation to load the fractures_06.txt sample data.
Are you sure that fracture_06.txt includes lengths? It seems too coincidental that column 0 increments by one (viewable here: https://github.com/GenericMappingTools/gmtserver-admin/blob/master/cache/fractures_06.txt) |
I noticed that this is copied from GMT's example 6. @PaulWessel, do the lengths in @fracture_06.txt represent real fractures or should we specify that the lengths are synthetic and the directions are digitized from maps? |
If I remember correctly the lengths are located in column 1 and directions in column 0 (therefore 0 to 360°). That's also the reason why to use |
Yes, the order makes sense since the |
The data set is fake I think but I cannot recall for sure. This takes us back to 1990. While some guys give roses to their love-interests, I wrote psrose for my future wife to impress her (she needed to make these plots for her thesis). Even nerds know that women likes flowers. |
Funny to hear some things from the very beginning of psrose @PaulWessel, especially since the corresponding example was the first I was faced with when I started using GMT in 2011 😄. |
I'm glad to have asked the question to learn this story about the origins of the @michaelgrund - up to you about whether it needs to be specified that the data may be made up. You could add something like 'hypothetically digitized' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test to 'pygmt/tests/test_datasets_tutorial.py`?
Adjusted 😉. |
Done! Thanks for mentioning @meghanrjones. |
If I understand it correctly, rose expects length and azimuth, but the data gives azimuth and length. Do you think we should swap the column order returned by the function? |
From man page: rose reads (length, azimuth) pairs from file [or standard input] and plot a windrose diagram. Add -i0 if your file only has azimuth values This is a bit unfortunate as it would make lots more sense that azimuth would be the first column since azimuths are always required and lengths are optional. I am not sure if there is a way to fix this in a backwards compatible way though. |
Would be fine for me, however, for advanced GMT users which are familiar with this "old" example there may be some confusion.
It would be easy to fix that for PyGMT only, however, I would prefer to ensure consistency with GMT. Any comments on that? |
At least for GMT core we need to maintain backwards compatibility. Here are the options we have I think:
I am not sure if the problem is severe enought to consider those options though. With pscircular we get a fresh page and can redesign those messy options into something better since backwards compatibility is no longer an issue (as long as we can construct psrose commands from them).. |
I don't think any core gmt changes are needed here. I think @seisman was just suggesting that the PyGMT function to load in the fractures data could switch the columns, so that -: isn't needed. |
Yes, I agree. I think the recent suggestions (#1101 (comment)) made by @meghanrjones can help remove -: or -i1,0. |
Yes, probably better to rename things in a separate PR. |
As discussed in #1101 here's a PR to rename ``tutorial.py`` (in which functions are defined to load sample data from the GMT tutorials) to ``samples.py``.
Opened #1110 for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good enough to me, thanks @michaelgrund!
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Description of proposed changes
As suggested in #794 here's the function implementation to load the fractures_06.txt sample data.
Reminders
make format
andmake check
to 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