Skip to content
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

WIP: Wrap fitcircle #1550

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft

WIP: Wrap fitcircle #1550

wants to merge 35 commits into from

Conversation

willschlitzer
Copy link
Contributor

This pull request wraps the module fitcircle.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@willschlitzer willschlitzer added the feature Brand new feature label Sep 29, 2021
@willschlitzer willschlitzer added this to the 0.5.0 milestone Sep 29, 2021
@willschlitzer willschlitzer self-assigned this Sep 29, 2021
@willschlitzer willschlitzer modified the milestones: 0.5.0, 0.6.0 Oct 7, 2021
@willschlitzer willschlitzer marked this pull request as ready for review January 14, 2022 00:40
@weiji14 weiji14 removed this from the 0.6.0 milestone Mar 13, 2022
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/tests/test_fitcircle.py Outdated Show resolved Hide resolved
pygmt/src/fitcircle.py Outdated Show resolved Hide resolved
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Comment on lines +119 to +125
if outfile == tmpfile.name: # if user did not set outfile, return pd.DataFrame
result = pd.read_csv(
tmpfile.name,
sep="\t",
names=["longitude", "latitude", "method"],
comment=">",
)
Copy link
Member

@seisman seisman May 31, 2022

Choose a reason for hiding this comment

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

$ gmt fitcircle @sat_03.txt -L2     
330.249933144	-18.4048179232	Points read: 703 Average Position (Flat Earth)
330.169184777	-18.4206532702	L2 Average Position (Eigenval Method)
52.7451972868	21.2040074195	L2 N Hemisphere Great Circle Pole (Eigenval Method)
232.745197287	-21.2040074195	L2 S Hemisphere Great Circle Pole (Eigenval Method)
$ gmt fitcircle @sat_03.txt -L2 -Fms 
330.169184777	-18.4206532702	232.745197287	-21.2040074195

As you can see, the output of fitcircle is quite different with or without -F option, so the read_csv call doesn't work with -F.

I'm wondering should we return a dict instead, e.g.,:

>>> solution = fitcircle(data="@sat_03.txt", norm=2)
>>> print(solution)
{'average': {'latitude': -18.4048179232, 'longitude': 330.249933144},
 'L2_average': {'latitude': -18.4206532702, 'longitude': 330.169184777},
 'L2_north': {'latitude': 21.2040074195, 'longitude': 52.7451972868},
 'L2_south': {'latitude': -21.2040074195, 'longitude': 232.745197287}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can work on this, but I'm about to move so I may not be too speedy

Copy link
Member

Choose a reason for hiding this comment

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

No hurry. Better to have more discussions about the output before working on it.

@seisman seisman modified the milestones: 0.7.0, 0.8.0 Jun 19, 2022
@willschlitzer willschlitzer changed the title Wrap fitcircle WIP: Wrap fitcircle Dec 1, 2022
@seisman seisman marked this pull request as draft December 2, 2022 00:46
@willschlitzer
Copy link
Contributor Author

I don't think I'm able to come up with a good way to format the output; I'm going to close this PR for the time being. If anyone has a solution please feel free to reopen it!

@seisman
Copy link
Member

seisman commented Dec 9, 2022

I'm reopening the issue so it's more visible to people who'd like to help.

@seisman seisman reopened this Dec 9, 2022
@seisman seisman modified the milestones: 0.8.0, 0.9.0 Dec 11, 2022
@willschlitzer willschlitzer removed their assignment Feb 2, 2023
@weiji14 weiji14 removed this from the 0.9.0 milestone Mar 6, 2023
@seisman seisman added this to the 0.12.0 milestone Dec 11, 2023
@seisman seisman removed this from the 0.12.0 milestone Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Brand new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants