Skip to content

Commit

Permalink
Version 1.6.4. Show/hide O- and X- modes. Checking sunspot number. Ig…
Browse files Browse the repository at this point in the history
…noring errors
  • Loading branch information
Albom committed Jul 26, 2024
1 parent e17d53a commit e7d2585
Show file tree
Hide file tree
Showing 12 changed files with 680 additions and 315 deletions.
393 changes: 208 additions & 185 deletions IonogramViewer2.py

Large diffs are not rendered by default.

458 changes: 366 additions & 92 deletions data/SN_d_tot_V2.0.txt

Large diffs are not rendered by default.

49 changes: 26 additions & 23 deletions dps_amp_iono.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ def __init__(self):
super().__init__()
self.ursi_code = None
self.cmap = cmap_two_comp
self.ox_mode = True

def load(self, file_name):

with open(file_name, 'r') as file:
with open(file_name, "r", encoding="ascii") as file:
lines = [line[:-1] for line in file.readlines()]

self.date = datetime.strptime(lines[0], '%Y.%m.%d (%j) %H:%M:%S.%f')
self.date = datetime.strptime(lines[0], "%Y.%m.%d (%j) %H:%M:%S.%f")

for line in lines[1:4]:
if line.startswith('Station name'):
self.station_name = line.split(':')[-1].strip()
elif line.startswith('URSI code'):
self.ursi_code = line.split(':')[-1].strip()
elif line.startswith('Ionosonde model'):
self.ionosonde_model = line.split(':')[-1].strip()
if line.startswith("Station name"):
self.station_name = line.split(":")[-1].strip()
elif line.startswith("URSI code"):
self.ursi_code = line.split(":")[-1].strip()
elif line.startswith("Ionosonde model"):
self.ionosonde_model = line.split(":")[-1].strip()

self.columns = [line.strip() for line in lines[4].split()]

Expand All @@ -34,26 +35,25 @@ def load(self, file_name):
for n_col, value in enumerate(values):
data[self.columns[n_col]].append(value)

self.frequencies = sorted([float(x) for x in set(data['Freq'])])
self.ranges = sorted([float(x) for x in set(data['Range'])])
self.frequencies = sorted([float(x) for x in set(data["Freq"])])
self.ranges = sorted([float(x) for x in set(data["Range"])])

self.n_freq = len(self.frequencies)
self.n_rang = len(self.ranges)

self.data = \
[[0 for x in range(self.n_freq)] for y in range(self.n_rang)]
self.data = [[0 for x in range(self.n_freq)] for y in range(self.n_rang)]

for i, amp in enumerate(data['Amp']):
freq = float(data['Freq'][i])
rang = float(data['Range'][i])
pol = int(data['Pol'][i])
az = float(data['Az'][i])
zn = float(data['Zn'][i])
for i, amp in enumerate(data["Amp"]):
freq = float(data["Freq"][i])
rang = float(data["Range"][i])
pol = int(data["Pol"][i])
az = float(data["Az"][i])
zn = float(data["Zn"][i])
i_freq = self.frequencies.index(freq)
i_rang = self.ranges.index(rang)

if az == 0 and zn == 0:
self.data[self.n_rang-i_rang-1][i_freq] = float(amp)*sin(pol)
self.data[self.n_rang - i_rang - 1][i_freq] = float(amp) * sin(pol)

self.load_sunspot()

Expand All @@ -68,13 +68,16 @@ def get_freq_tics(self):
return [float(x) for x in self.get_freq_labels()]

def get_freq_labels(self):
return ['{:.1f}'.format(i) for i in range(int(self.frequencies[0]),
int(self.frequencies[-1])+1)]
return [
"{:.1f}".format(i)
for i in range(int(self.frequencies[0]), int(self.frequencies[-1]) + 1)
]

def get_ursi_code(self):
return self.ursi_code

if __name__ == '__main__':

if __name__ == "__main__":
iono = DpsAmpIono()
iono.load('./examples/dps_amp/00_00.txt')
iono.load("./examples/dps_amp/00_00.txt")
print(iono.get_extent())
Binary file added examples/visrc2t/20231222235500.ig.bz2
Binary file not shown.
1 change: 1 addition & 0 deletions iono.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, debug_level=0):
self.sunspot = -1
self.debug_level = debug_level
self.cmap = cmap_one_comp
self.ox_mode = False

def get_data(self):
return self.data
Expand Down
7 changes: 4 additions & 3 deletions rinan_iono.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from math import log
import numpy as np
from datetime import datetime
from configparser import ConfigParser, NoSectionError, NoOptionError
from datetime import datetime
import numpy as np
from iono import Iono
from colormaps import cmap_two_comp

Expand All @@ -12,11 +12,12 @@ def __init__(self):
super().__init__()

def load(self, file_name):
with open(file_name) as file:
with open(file_name, encoding="ascii") as file:
lines = [s.strip() for s in file.readlines()]

if file_name.lower().endswith('.pion'):
self.cmap = cmap_two_comp
self.ox_mode = True

index_freq = lines.index('Frequency Set')
index_end_of_header = lines.index('END')
Expand Down
19 changes: 7 additions & 12 deletions sunspot_loader.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@

from datetime import datetime


class SunspotLoader:

def __init__(self, filename='./data/SN_d_tot_V2.0.txt'):
with open(filename) as file:
def __init__(self, filename="./data/SN_d_tot_V2.0.txt"):
with open(filename, encoding="ascii") as file:
self.lines = [s.split() for s in file.readlines()]

def get(self, date):
year = date.year
month = date.month
day = date.day
number = -1
for line in self.lines:
if (int(line[0]) == year
and int(line[1]) == month
and int(line[2]) == day):
number = int(line[4])
break
return number
if int(line[0]) == year and int(line[1]) == month and int(line[2]) == day:
number = int(line[4])
return number
return -1


Sunspots = SunspotLoader()
67 changes: 67 additions & 0 deletions ui/MainWnd.ui
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@
</widget>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="enabled">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
Expand All @@ -336,6 +339,11 @@
<addaction name="separator"/>
<addaction name="actionMoveLeft"/>
<addaction name="actionMoveRight"/>
<addaction name="separator"/>
<addaction name="actionO_trace"/>
<addaction name="actionX_trace"/>
<addaction name="separator"/>
<addaction name="actionIgnore_errors"/>
<addaction name="actionClean"/>
<addaction name="separator"/>
<addaction name="actionHelp"/>
Expand Down Expand Up @@ -986,6 +994,65 @@ number</string>
<string>Ctrl+R</string>
</property>
</action>
<action name="actionO_trace">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<normaloff>images/o-trace.png</normaloff>
<normalon>images/o-trace.png</normalon>images/o-trace.png</iconset>
</property>
<property name="text">
<string>O-trace</string>
</property>
<property name="toolTip">
<string>O-trace</string>
</property>
</action>
<action name="actionX_trace">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset>
<normalon>images/x-trace.png</normalon>
</iconset>
</property>
<property name="text">
<string>X-trace</string>
</property>
<property name="toolTip">
<string>X-trace</string>
</property>
</action>
<action name="actionIgnore_errors">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<normaloff>images/Martz90-Circle-Addon2-Warning.24.png</normaloff>images/Martz90-Circle-Addon2-Warning.24.png</iconset>
</property>
<property name="text">
<string>Ignore errors</string>
</property>
<property name="toolTip">
<string>Ignore errors</string>
</property>
</action>
</widget>
<resources/>
<connections/>
Expand Down
Binary file added ui/images/Martz90-Circle-Addon2-Warning.24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/images/o-trace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/images/x-trace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions visrc2t_iono.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self, debug_level=0):
self.dip = 66.7
self.debug_level = debug_level
self.cmap = cmap_two_comp
self.ox_mode = True


def __read_raw_data(self, file_name):
Expand Down

0 comments on commit e7d2585

Please sign in to comment.