From 154462be693c05dc67ee2ee3ff668244b4d285eb Mon Sep 17 00:00:00 2001 From: harry093 Date: Tue, 2 Mar 2021 11:22:10 +1100 Subject: [PATCH 1/5] Added a function to read the SITE/ID block of a SINEX2 file --- geodepy/gnss.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/geodepy/gnss.py b/geodepy/gnss.py index d7793c6..3ac97a5 100644 --- a/geodepy/gnss.py +++ b/geodepy/gnss.py @@ -6,7 +6,10 @@ In Development """ + +import sys from numpy import zeros +from geodepy.angles import DMSAngle def read_sinex_estimate(file): @@ -228,3 +231,53 @@ def read_sinex_matrix(file): matrix.append(info) return matrix + + +def read_sinex_sites(file): + + """This function reads in the SITE/ID block of a SINEX file. It returns + sites, a list of tuples: + + sites = [(site, point, domes, obs, station_description, lon, lat, h)] + + where: + * site is the site code + * point is the site's point code + * domes is the site's dome number + * obs is the observation technique + * station_description is a free format desciption of the site + * lon is the approximate longitude of the site as a DMSAngle object + * lat is the approximate latitude of the site as a DMSAngle object + * h is the approximate height of the site + + :param file: the input SINEX file + :return: sites + """ + + # Read the SITE/ID block into a list + lines = [] + go = False + with open(file) as f: + for line in f: + if line[:8] == '-SITE/ID': + break + if go and line[:8] == '*CODE PT': + pass + elif go: + lines.append(line) + if line[:8] == '+SITE/ID': + go = True + sites = [] + for line in lines: + site = line[1:5] + point = line[6:8].lstrip() + domes = line[9:18] + obs = line[19:20] + station_description = line[21:43].lstrip() + lon = DMSAngle(line[44:55].lstrip()) + lat = DMSAngle(line[56:67].lstrip()) + h = float(line[67:73]) + info = (site, point, domes, obs, station_description, lon, lat, h) + sites.append(info) + + return sites From 0705c0ceb3d4e8939777f5bc30439d70719c3bc3 Mon Sep 17 00:00:00 2001 From: harry093 Date: Thu, 4 Mar 2021 13:59:44 +1100 Subject: [PATCH 2/5] Added a function to read the SOLUTION/DISCONTINUITY block of a SINEX2 file --- geodepy/gnss.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/geodepy/gnss.py b/geodepy/gnss.py index 3ac97a5..9df7efc 100644 --- a/geodepy/gnss.py +++ b/geodepy/gnss.py @@ -281,3 +281,51 @@ def read_sinex_sites(file): sites.append(info) return sites + +def read_disconts(file): + + """This function reads in the SOLUTION/DISCONTINUITY block of a + SINEX file. It returns disconts , a list of tuples: + + sites = [(site, code1, point, code2, start, end, type)] + + where: + * site is the site code + * code1 is unknown + * point is the site's point code + * code2 is unknown + * start is the start date for the point code in YY:DOY:SSSSS + * end is the end date for the point code in YY:DOY:SSSSS + * type is the type of discontinuity; P for position or V for + velocity + + I could not find the standard for this block. + + :param file: the input discontinuities file + :return: disconts + """ + + # Read the SOLUTION/DISCONTINUITY block into a list + lines = [] + go = False + with open(file) as f: + for line in f: + if line[:23] == '-SOLUTION/DISCONTINUITY': + break + elif go: + lines.append(line) + if line[:23] == '+SOLUTION/DISCONTINUITY': + go = True + disconts = [] + for line in lines: + site = line[1:5] + code1 = line[5:8].lstrip() + point = line[8:13].lstrip() + code2 = line[14:15] + start = line[16:28] + end = line[29:41] + type = line[42:43] + info = (site, code1, point, code2, start, end, type) + disconts.append(info) + + return disconts From 474e8a0a608e99e5fc1718e1c071b91e5c2ca047 Mon Sep 17 00:00:00 2001 From: harry093 Date: Fri, 5 Mar 2021 16:20:25 +1100 Subject: [PATCH 3/5] Added a function to read the SOLUTION/EPOCHS block of a SINEX2 file --- geodepy/gnss.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/geodepy/gnss.py b/geodepy/gnss.py index 9df7efc..e7062d0 100644 --- a/geodepy/gnss.py +++ b/geodepy/gnss.py @@ -294,12 +294,12 @@ def read_disconts(file): * code1 is unknown * point is the site's point code * code2 is unknown - * start is the start date for the point code in YY:DOY:SSSSS - * end is the end date for the point code in YY:DOY:SSSSS + * start is the start time for the point code in YY:DOY:SECOD + * end is the end time for the point code in YY:DOY:SECOD * type is the type of discontinuity; P for position or V for velocity - I could not find the standard for this block. + I could not find the format description for this block. :param file: the input discontinuities file :return: disconts @@ -329,3 +329,51 @@ def read_disconts(file): disconts.append(info) return disconts + +def read_solution_epochs(file): + + """This function reads in the SOLUTION/EPOCHS block of a SINEX file. + It returns epochs, a list of tuples: + + epochs = [(site, point, sol, obs, start, end, mean)] + + where: + * site is the site code + * point is the site's point code + * sol is the solution number at a site/point + * obs is the observation technique + * start is the start time for the solution in YY:DOY:SECOD + * end is the end time for the solution in YY:DOY:SECOD + * mean is the mean time for the solution in YY:DOY:SECOD + + :param file: the input SINEX file + :return: epochs + """ + + # Read the SOLUTION/EPOCHS block into a list + lines = [] + go = False + with open(file) as f: + for line in f: + if line[:16] == '-SOLUTION/EPOCHS': + break + if go and line[:8] == '*CODE PT': + pass + elif go: + lines.append(line) + if line[:16] == '+SOLUTION/EPOCHS': + go = True + epochs = [] + # Parse each line, create a tuple and add it to the list + for line in lines: + site = line[1:5] + point = line[6:8].lstrip() + sol = line[9:13].lstrip() + obs = line[14:15] + start = line[16:28] + end = line[29:41] + mean = line[42:55].rstrip() + info = (site, point, sol, obs, start, end, mean) + epochs.append(info) + + return epochs From 835f59a63f207efc3b61e31585838b0df6df6752 Mon Sep 17 00:00:00 2001 From: harry093 Date: Thu, 17 Jun 2021 15:02:46 +1000 Subject: [PATCH 4/5] Fix bug in read_solution_epochs() --- geodepy/gnss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geodepy/gnss.py b/geodepy/gnss.py index e7062d0..0e9936d 100644 --- a/geodepy/gnss.py +++ b/geodepy/gnss.py @@ -357,7 +357,7 @@ def read_solution_epochs(file): for line in f: if line[:16] == '-SOLUTION/EPOCHS': break - if go and line[:8] == '*CODE PT': + if go and line[:8] == '*Code PT': pass elif go: lines.append(line) From 787d9878a73ee060cfd2c1a2fdcd3878b8d86af7 Mon Sep 17 00:00:00 2001 From: harry093 Date: Thu, 17 Jun 2021 16:05:38 +1000 Subject: [PATCH 5/5] Updated version to 0.0.22 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8185e59..5499cc3 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='geodepy', - version='0.0.21', + version='0.0.22', description='GA Geodesy Package', long_description='A toolkit for Geodesy and Surveying in Python', url='https://github.com/GeoscienceAustralia/GeodePy',