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

Simplify conversions between km and degrees #5824

Merged
merged 1 commit into from
Sep 30, 2021
Merged

Simplify conversions between km and degrees #5824

merged 1 commit into from
Sep 30, 2021

Conversation

PaulWessel
Copy link
Member

Users (like myself...) who have data columns representing distances on the Earth (or other planets) may need to convert between arc and distance units (mostly degrees and km). This is an awkward thing to do via proxies like +s111.195. In grdmath we have operators DEG2KM and KM2DEG for this. For tables I have now implemented special arguments d and k to -icol+s. So, -i0+sk will convert spherical degrees in column one to km, using the prevailing mean ellipse radius.
No effect on any existing tests, and I checked that both codes work correctly.

Users who have data columns representing distances on the Earth (or other planets) will need to convert arc and distance units (mostly degrees and km).  This is an awkward thing to do via proxies like +s111.195.  In grdmath we have operators DEG2KM for this.  For tables I have now implemented special arguments d and k to -i+s.  So, -i0+sk will convert spherical degrees in column one to km, using the prevailing mean ellipse radius.
@@ -16,7 +16,8 @@ one of the following modifiers to any column or column range to transform the in

- **+l** to take the **log10** of the input values.
- **+d** to divide the input values by the factor *divisor* [default is 1].
- **+s** to multiply the input values by the factor *scale* [default is 1].
- **+s** to multiply the input values by the factor *scale* [default is 1]. Alternatively, give **d** to convert
km to degrees or **k** to convert degrees to km.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
km to degrees or **k** to convert degrees to km.
km to degrees or **k** to convert degrees to km using :term:`PROJ_MEAN_RADIUS`.

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Nice!

@Esteban82 Esteban82 merged commit ee0e09f into master Sep 30, 2021
@Esteban82 Esteban82 deleted the degree-to-km branch September 30, 2021 02:15
@PaulWessel
Copy link
Member Author

Yikes, I forgot to accept @meghanrjones suggestion... OK, I added the missing text directly to master...

@maxrjones maxrjones added add-changelog Add PR to the changelog new feature PR that implements a new feature or capability in GMT labels Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add-changelog Add PR to the changelog new feature PR that implements a new feature or capability in GMT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants