Skip to content

Commit

Permalink
i.atcorr: fix plot_filter function in create_iwave (OSGeo#3911)
Browse files Browse the repository at this point in the history
* missing import of pyplot
* fix figures not shown correctly
* fix wrong axes
  • Loading branch information
pesekon2 authored Aug 23, 2024
1 parent 913c620 commit 1205137
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions imagery/i.atcorr/create_iwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,28 @@ def interpolate_band(values, step=2.5):
def plot_filter(values):
"""Plot wl response values and interpolated
filter function. This is just for checking...
value is a 2 column numpy array
value is a 2-column numpy array
function has to be used inside Spyder python environment
"""
import matplotlib.pyplot as plt

filter_f, limits = interpolate_band(values)

# removing nodata
w = values[:, 1] >= 0
response = values[w]

plot(response[:, 0], response[:, 1], "ro")
plot(arange(limits[0], limits[1], 2.5), filter_f)
fig = plt.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2)

ax1.plot(response[:, 0], response[:, 1], "ro")
rounded = np.arange(limits[0], limits[1], 0.0025) * 1000
if len(rounded) == len(filter_f):
ax2.plot(rounded, filter_f)
else:
ax2.plot(rounded[:-1], filter_f)
plt.show()


def pretty_print(filter_f):
Expand Down

0 comments on commit 1205137

Please sign in to comment.