Skip to content

Simplify conversions between km and degrees#5824

Merged
Esteban82 merged 1 commit intomasterfrom
degree-to-km
Sep 30, 2021
Merged

Simplify conversions between km and degrees#5824
Esteban82 merged 1 commit intomasterfrom
degree-to-km

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.
- **+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.

3 participants