Skip to content

Commit

Permalink
ability to use old TLEs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Sep 9, 2021
1 parent f0d3368 commit 9c05678
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/georef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ function wxload(pngname)
return datatime,channel,data_all[end:-1:1,end:-1:1]
end

function georeference(pngname,satellite_name,channel; starttime = DateTime(1,1,1,0,0,0))
function georeference(pngname,satellite_name,channel;
starttime = DateTime(1,1,1,0,0,0),
tles = get_tle(:weather))

if !(channel in ['a','b'])
error("channel must be 'a' or 'b'")
end
Expand All @@ -45,7 +48,7 @@ function georeference(pngname,satellite_name,channel; starttime = DateTime(1,1,1
data = data[end:-1:1,end:-1:1]
datatime = (0:size(data,1)-1)/scans_per_seconds

plon,plat,data = georeference(data,satellite_name,datatime,starttime)
plon,plat,data = georeference(data,satellite_name,datatime,starttime, tles = tles)
return plon,plat,data
end

Expand Down
5 changes: 3 additions & 2 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function makeplots(wavname,satellite_name;
qrange = (0.01,0.99),
coastlinecolor = "magenta",
cmap = "RdYlBu_r",
tles = get_tle(:weather),
dpi = 150)

if starttime == nothing
Expand All @@ -60,14 +61,14 @@ function makeplots(wavname,satellite_name;
fig = figure()
plt.style.use("dark_background")
Alon,Alat,Adata = APTDecoder.georeference(
channelA,satellite_name,datatime,starttime, eop = eop)
channelA,satellite_name,datatime,starttime, eop = eop, tles = tles)
APTDecoder.plot(Alon,Alat,Adata; coastlinecolor=coastlinecolor, cmap=cmap)
plt.grid(linestyle = "--",color=grid_color)
savefig(imagenames.channel_a,dpi=dpi,pad_inches=0, bbox_inches="tight", transparent=false)
fig.clf()

Blon,Blat,Bdata = APTDecoder.georeference(
channelB,satellite_name,datatime,starttime, eop = eop)
channelB,satellite_name,datatime,starttime, eop = eop, tles = tles)
APTDecoder.plot(Blon,Blat,Bdata; coastlinecolor=coastlinecolor, cmap=cmap)
plt.grid(linestyle = "--",color=grid_color)
savefig(imagenames.channel_b,dpi=dpi,pad_inches=0, bbox_inches="tight", transparent=false)
Expand Down
8 changes: 6 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ end
import APTDecoder
using Test
using RemoteFiles
using SatelliteToolbox

@testset "decoding" begin
wavname = "gqrx_20190825_182745_137620000.wav"

if !isfile(wavname)
download("https://archive.org/download/gqrx_20190825_182745_137620000/gqrx_20190825_182745_137620000.wav",wavname)
end
APTDecoder.makeplots(wavname,"NOAA 15")
current_tles = APTDecoder.get_tle(:weather)
tles = SatelliteToolbox.read_tle(joinpath(dirname(pathof(APTDecoder)),"..","examples","weather-20190825.txt"))

APTDecoder.makeplots(wavname,"NOAA 15", tles = tles)

@test isfile(replace(wavname,r"\.wav$" => "_raw.png"))

Expand All @@ -37,7 +41,7 @@ using RemoteFiles

satellite_name = "NOAA 15"
channel = 'a'
plon,plat,data = APTDecoder.georeference(pngname,satellite_name,channel)
plon,plat,data = APTDecoder.georeference(pngname,satellite_name,channel, tles = tles)


satellite_name = "NOAA 15"
Expand Down

0 comments on commit 9c05678

Please sign in to comment.