各出力ファイルの補正 (特に、下記"sequence16.txt"から"reverse17.txt"への整形) に膨大な
時間を要した。以下は半自動化の手法であるが、これを完全自動化するのは、ほぼ不可能と思う。
後日、HP(N0.1190)に追加掲載する。
Marina jpg Automatic experiment #2
----------------------------------------------------------------------------------------------
[extract11.rb] ... Extract lines starting with "2026-08-08 23:" in 60809mar_org.csv
> File.open("extract11.txt", "w") do |out|
> File.foreach("satnogs.csv") do |line|
> out.puts line if line.include?("2026-08-08 23:")
> end
> end
$ ruby extract11.rb > 60816ma1.sh
$ sh 60816ma1.sh
----------------------------------------------------------------------------------------------
[extract12.rb] ... Extract lines starting with "DUS-NORD-UHF-JO31jg" inextract11.txt
> File.open("extract12.txt", "w") do |out|
> File.foreach("extract11.txt") do |line|
> out.puts line if line.include?("DUS-NORD-UHF-JO31jg")
> end
> end
$ ruby extract12.rb > 60816ma2.sh
$ sh 60816ma2.sh
----------------------------------------------------------------------------------------------
[extract13.txt] ... Extract incloding lines from FFD8 to FFD9 in extract12.txt
> Extract time stamp from "2026-08-08 23:00:36" to "2026-08-08 23:01:33"
> Insert 0000 and 0080 into the bottom two lines, respectively.
> Save as extract13.txt
----------------------------------------------------------------------------------------------
[sequence14.rb] ... Rearrange the lines in pairs of "[i]80,[i]00" to match
the area outlined in red in the top figure.
> for i in 0..0x164
> printf("grep 87BBD400841B000000088E2D923...%02X extract13.txt | head -2 >> sequence14.txt\n", i)
> end
$ ruby sequence14.rb > 60816ma3.sh
$ sh 60816ma3.sh
----------------------------------------------------------------------------------------------
[sequence15.txt] ... Fill in the missing parts of "[i]80,[i]00" and save it again with a new name.
----------------------------------------------------------------------------------------------
[reverse16.rb] ,,, Swap the top and bottom lines of each pair changing
from "[i]80,[i]00" to "[i]00,[i]80". Check the [i] sequences for all lines.
In particular, verify the presence of FFD8 in the first line and FFD9 in
the last line. After making the corrections, rename the file from "sequence16
.txt" to "reverse17.txt" and save it.
> lines = File.readlines("sequence15.txt")
> File.open("sequence16.txt", "w") do |file|
> lines.each_slice(2) do |pair|
> pair.reverse_each { |line| file.print line }
> end
> end
$ ruby reverse16.rb > 60816ma4.sh
$ sh 60816ma4.sh
----------------------------------------------------------------------------------------------
[reverse17.txt] ... Add the necessary corrections to sequence16.txt.
----------------------------------------------------------------------------------------------
[reverse18.rb] ... Trim the beginning and end of each line, and extract the core data
range from all lines. The first letter of the first line is FFD8,
and the last letter of the last line is FFD9.
> File.open("reverse18.txt", "w") do |out|
> File.foreach("reverse17.txt") do |line|
> out.puts line.chomp[58, 256]
> end
> end
$ ruby reverse18.rb > 60816ma5.sh
$ sh 60816ma5.sh
----------------------------------------------------------------------------------------------
[one_line19.txt] ... Edit the FFD8~FFD9 range in reverse18.txt into a single line and convert it.
$ tr -d '\n' < reverse18.txt > one_line19.txt
$ cat one_line19.txt | xxd -r -p > marina.jpg
----------------------------------------------------------------------------------------------