From bf659ba80c4b9061bf1c202fbabf73e93691cb56 Mon Sep 17 00:00:00 2001 From: KyranCookGA Date: Tue, 28 Jul 2026 04:47:37 +0000 Subject: [PATCH 1/3] Added missing script needed for APREF post processing --- reduce_sinex_size.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 reduce_sinex_size.py diff --git a/reduce_sinex_size.py b/reduce_sinex_size.py new file mode 100644 index 0000000..8d3ef19 --- /dev/null +++ b/reduce_sinex_size.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +# This script reduces the size of the SINEX file by removing the +# velocity parameters (which are not needed for this workflow). +# If velocity parameters are needed, then change the function call +# to remove_matrixzeros_sinex() insetad of remove_velocity_sinex() below. +# This will remove zero lines only from +SOLUTION/MATRIX_ESTIMATE block, +# Whilst reatining the velocity parameters. +# +# NOTE: this file does overwrite the input file, but a copy is made, +# with the extension tag "VEL" +# +# +# Usage: reduce_sinex_size.py + +import os +import glob +import geodepy.gnss + + +# Get the path to the home directory and move to the working directory +home = os.path.expanduser("~") +os.chdir(home + '/apref/workDir/') + +# Get the input file name +for f in glob.glob('apref*.snx'): + ifile = f +try: + ifile +except NameError: + sys.exit('There is no APREF SINEX file by that name in the working directory') + +# Make copy of original file +os.system(f'cp {ifile} {ifile}.VEL') + +# Remove velocity parameters and rename output file +geodepy.gnss.remove_velocity_sinex(ifile) +ofile = ifile +os.rename('output.snx', ofile) From d25037db329002317531e95195554c2e76dc0c12 Mon Sep 17 00:00:00 2001 From: KyranCookGA Date: Tue, 28 Jul 2026 04:51:48 +0000 Subject: [PATCH 2/3] Made small changes to reduce_sinex_size.py --- reduce_sinex_size.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reduce_sinex_size.py b/reduce_sinex_size.py index 8d3ef19..271189c 100644 --- a/reduce_sinex_size.py +++ b/reduce_sinex_size.py @@ -16,7 +16,8 @@ import os import glob import geodepy.gnss - +import sys +from shutil import copy2 # Get the path to the home directory and move to the working directory home = os.path.expanduser("~") @@ -31,7 +32,7 @@ sys.exit('There is no APREF SINEX file by that name in the working directory') # Make copy of original file -os.system(f'cp {ifile} {ifile}.VEL') +copy2(ifile, f"{ifile}.VEL") # Remove velocity parameters and rename output file geodepy.gnss.remove_velocity_sinex(ifile) From a20f2385edc3c7e2f87a894a6e4782152c665933 Mon Sep 17 00:00:00 2001 From: KyranCookGA Date: Tue, 28 Jul 2026 23:08:15 +0000 Subject: [PATCH 3/3] Fixed glob issues if multiple files exist --- reduce_sinex_size.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/reduce_sinex_size.py b/reduce_sinex_size.py index 271189c..4877733 100644 --- a/reduce_sinex_size.py +++ b/reduce_sinex_size.py @@ -24,17 +24,24 @@ os.chdir(home + '/apref/workDir/') # Get the input file name -for f in glob.glob('apref*.snx'): - ifile = f -try: - ifile -except NameError: +files = glob.glob('apref*.snx') + +if not files: sys.exit('There is no APREF SINEX file by that name in the working directory') +if len(files)> 1: + sys.exit('There are multiple APREF SINEX files in the working directory') + +ifile = files[0] + # Make copy of original file copy2(ifile, f"{ifile}.VEL") # Remove velocity parameters and rename output file -geodepy.gnss.remove_velocity_sinex(ifile) +try: + geodepy.gnss.remove_velocity_sinex(ifile) +except: + raise NameError("Velocities could not be removed from sinex file") + ofile = ifile os.rename('output.snx', ofile)