question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lack of consistency between `fwd` and `fwd_intermediate` azimuth output

See original GitHub issue

Problem description

I’ve noticed an inconsistency between the azimuth output of fwd and fwd_intermediate. In the example below, I compute the lon/lat/azi when moving 1km from London with an initial forward azimuth of 45 degrees with the both methods. As expected from the documentation, fwd returns the backward azimuth whereas fwd_intermediate returns the forward azimuth of the terminus point. For consistency and to avoid confusion, I suggest fwd_intermediate also return the backward azimuth.

Code Sample

from pyproj import Geod, enums

wgs84 = Geod(ellps="WGS84")

# Inputs 
london = (-0.118092, 51.509865) #lon/lat
dist = 1e3  # m
bearing = 45  # deg
flags = enums.GeodIntermediateFlag(0).AZIS_KEEP  # get fwd_intermediate to return azimuths

# fwd
lon, lat, azi = wgs84.fwd(*london, bearing, dist)

# fwd_intermediate (return first and last point)
res = wgs84.fwd_intermediate(*london, bearing, 2, dist, flags=flags, terminus_idx=0, initial_idx=0)

print("lon, lat, azimuth from fwd             :", lon, lat, azi)
print("lon, lat, azimuth from fwd_intermediate:", res.lons[-1], res.lats[-1], res.azis[-1])

which outputs:

lon, lat, azimuth from fwd             : -0.10790547005142687 51.51622011204643 -134.99202649526126
lon, lat, azimuth from fwd_intermediate: -0.10790547005142687 51.51622011204643 45.007973504738736

Environment Information

pyproj info: pyproj: 3.4.0 PROJ: 9.1.0

Installation method

Installed via pip

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
idanmiaracommented, Oct 24, 2022

Hi, As we don’t want to break backwards compatibility, I’ve added this option as a non-default argument. Hope it helps 😃

1reaction
idanmiaracommented, Oct 25, 2022

Hi @idanmiara, Thanks for the changes. I understand the argument for backward compatibility. However, wouldn’t it make more sense for the default behaviour of ‘fwd’ and ‘fwd_intermediate’ to be the same? You could have ‘return_back_azimuth’ is True by default and a note in the next release warning prior user.

@snowman2 agrees with you, so I’ve changed the default. I added this parameter to fwd, inv, fwd_intermediate, inv_intermediate

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global Meteor Network – Methodology and first results
A novel astrometry calibration method is presented which allows decoupling of the camera pointing from the distortion, and is used for frequent pointing ......
Read more >
Aviation Electronics Technician - Intermediate - Navy Tribe
THE COURSE: This self-study course is organized into subject matter areas, each containing learning objectives to help you determine what you should learn ......
Read more >
TELEMETRY STANDARDS IRIG STANDARD 106-04 Part I
1.0 Bit Rate Versus Receiver Intermediate-Frequency Bandwidth . ... Lack of proper output termination will not cause the reproduce amplifier to oscillate.
Read more >
Enhanced metanephric specification to functional proximal ...
Here we show that enhanced specification to metanephric nephron progenitors results in elongated and radially aligned proximalised nephrons with ...
Read more >
High-resolution retrieval of cloud microphysical properties and ...
Abstract. Optical properties of clouds and heavy aerosol retrieved from satellite measurements are the most important elements for calculating ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found