Skip to content

Commit

Permalink
Fix cross track point perturbation
Browse files Browse the repository at this point in the history
  • Loading branch information
SorooshMani-NOAA committed Dec 2, 2023
1 parent eede830 commit f7e6643
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ensembleperturbation/perturbation/atcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,14 +802,14 @@ def perturb(
next_offset = get_offset(current_point, next_point, cross_track_error)

# get the perpendicular offset based on the average of the forward and backward piecewise track lines adjusted so that the distance matches the actual cross_error
normal_offset = numpy.mean([previous_offset, next_offset])
normal_offset = numpy.mean([previous_offset, next_offset], axis=0)
alpha = abs(cross_track_error) / numpy.sqrt(numpy.sum(normal_offset ** 2))

if numpy.isinf(alpha):
alpha = 0

# compute the next point and retrieve back the lat-lon geographic coordinate
new_point = current_point - alpha * normal_offset
new_point = current_point - abs(alpha) * normal_offset
new_coordinates.append(
transformer.transform(
new_point[0].magnitude,
Expand Down Expand Up @@ -1796,9 +1796,9 @@ def get_offset(
# z**2 / (1 + pslope**2) = x**2
# z / (1 + pslope**2)**0.5 = x

points = numpy.concatenate([point_1, point_2], axis=0)
points = numpy.vstack([point_1, point_2])

difference = numpy.diff(points, axis=0)
difference = numpy.diff(points, axis=0).ravel()

# tangential slope approximation
slope = difference[1] / difference[0]
Expand Down

0 comments on commit f7e6643

Please sign in to comment.