__RINEX (Receiver Independent Exchange Format) file __ is simply the data received from the satellite by the electronic reference point used in the satellite positioning system. ...maybe By the way, I have almost no knowledge of what kind of information is inside, so I will analyze it appropriately while also practicing the program.
Reference URL -[Positioning Satellite System Wiki](https://ja.wikipedia.org/wiki/%E8%A1%9B%E6%98%9F%E6%B8%AC%E4%BD%8D%E3%82% B7% E3% 82% B9% E3% 83% 86% E3% 83% A0) -What is an electronic reference point (Ministry of Land, Infrastructure, Transport and Tourism)
We will use tkinter, which is the standard GUI library that is included from the beginning when Anaconda is installed. Let's code without being too conscious of object orientation!
analyzer.py
import tkinter as tk
from calendar import isleap
from constant import * #Own definition module
class Widget:
"""
GUI widget generation class
"""
def __init__(self):
self.root = tk.Tk()
self.root.title('RINEX Analyzer')
self.root.columnconfigure(0, weight=1)
self.flame = tk.Frame(self.root)
self.flame.grid(row=0, column=0)
[self.flame.columnconfigure(x, weight=1) for x in range(4)]
#From here onward, the placement of button widgets, etc.
self.widget_dict = {}
for cnt,ilist in enumerate(OPTION_LIST):
tk.Label(self.flame, text=ilist[0].replace("_","\n")).grid(row=0, column=cnt)
self.widget_dict[ilist[0]] = tk.StringVar()
if "END" in ilist[0]:
if not isleap(int(self.widget_dict["YEAR"].get())):
self.widget_dict[ilist[0]].set(ilist[1][-2]) #365 if not a leap year
else:
self.widget_dict[ilist[0]].set(ilist[1][-1]) #366 for leap years
else:
self.widget_dict[ilist[0]].set(ilist[1][0])
tk.OptionMenu(self.flame, self.widget_dict[ilist[0]], *ilist[1]).grid(row=1, column=cnt)
self.widget_dict["GET_RINEX"] = tk.Button(self.flame, text="GET RINEX", bg="SkyBlue")
self.widget_dict["GET_RINEX"].grid(row=2, column=3, padx=1, pady=1)
self.widget_dict["GET_RINEX"].config(command=lambda: self.button_event())
self.widget_dict["TEXT"] = tk.Text(self.flame, width=40, height=10)
self.widget_dict["TEXT"].grid(row=3, column=0, columnspan=4, padx=5, pady=5)
self.widget_dict["TEXT"].insert("end", "Message output\n")
self.widget_dict["CANVAS"] = tk.Canvas(self.flame, width=50, height=50)
self.widget_dict["CANVAS"].grid(row=4, column=0, columnspan=4)
self.root.mainloop()
def button_event(self):
"""
Describe the behavior when the button is pressed
"""
#Message output to text box
if int(self.widget_dict["START_DOY"].get()) > int(self.widget_dict["END_DOY"].get()):
# START_END than DOY_If DOY comes first
self.widget_dict["TEXT"].insert("end", "START_END than DOY_DOY date comes first\n")
elif not isleap(int(self.widget_dict["YEAR"].get())):
#If not a leap year
if int(self.widget_dict["START_DOY"].get()) == 366 or int(self.widget_dict["END_DOY"].get()) == 366:
self.widget_dict["TEXT"].insert("end", "{0}There are no 366 days in the year\n".format(self.widget_dict["YEAR"].get()))
else:
[self.widget_dict["TEXT"].insert("end", "{0}:{1}\n".format(x, self.widget_dict[x].get())) for x in LABEL_LIST]
else:
[self.widget_dict["TEXT"].insert("end", "{0}:{1}\n".format(x, self.widget_dict[x].get())) for x in LABEL_LIST]
self.widget_dict["TEXT"].see("end")
#Description required when starting a Python file by double-clicking
if __name__ == "__main__":
try:
Widget() #Start interface
print("\n Normal termination")
except Exception as _e:
print(_e, type(_e))
print("\n Abnormal termination")
Processing leap years was sober and troublesome Or rather, there was a function that could determine if it was a leap year
constant.py
"""Constant definition module"""
YEAR_LIST = ["2018", "2019", "2020", "2021", "2022"] #Definition for 5 years for the time being
DOY_LIST = [str(x).zfill(3) for x in range(1, 367)] # Day of year
ERP_LIST = ["0958", "3005", "3007", "3008", "3011",
"3013","0223", "0224", "0753", "0754", "0755"] #Station number of electronic reference point...For the time being, let's define the one in Saitama prefecture
LABEL_LIST = ["YEAR", "START_DOY", "END_DOY", "ERP"]
OPTION_LIST = [[LABEL_LIST[cnt], i] for cnt,i in enumerate([YEAR_LIST, DOY_LIST, DOY_LIST, ERP_LIST])] #Double list
When creating a module that defines constants It seems that there are currently 11 electronic reference points in Saitama Prefecture.
Hmm, tired They
ʻOption Menu of
tkinter` is called a list box or combo box.
-[TK Notebook Various Widgets](https://www.nakamuri.info/mw/index.php/%E3%81%84%E3%82%8D%E3%81%84%E3%82%8D% E3% 81% AA% E3% 82% A6% E3% 82% A3% E3% 82% B8% E3% 82% A7% E3% 83% 83% E3% 83% 88) -Create a pull-down menu with DelftStack Tkinter -Ministry of Land, Infrastructure, Transport and Tourism Electronic Reference Point List
I have a simple GUI for the time being Next time, I would like to implement around the acquisition of RINEX files. I also felt the ease of use of PyCharm. It's easy to debug, and it feels good to check the syntax and PEP8 conventions without permission.
: arrow_backward: Previous article | [Next article]: arrow_forward:
Recommended Posts