diff --git a/README.md b/README.md index 49eff51..5708911 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ spp_result = gp.spp(station, orbit, system="G", cut_off=7.0) ``` # Notes -crx2rnx function is not pure python implimentation and depends on +crx2rnx function is not pure python implementation and depends on RNXCMP software for compression/restoration of RINEX observation files developed by Y. Hatanaka of GSI. diff --git a/gnsspy/__init__.py b/gnsspy/__init__.py index 77d3c8a..fac35c5 100755 --- a/gnsspy/__init__.py +++ b/gnsspy/__init__.py @@ -22,7 +22,7 @@ from gnsspy.io.readFile import (read_navFile, read_obsFile, read_sp3File, read_clockFile, read_ionFile) -from gnsspy.io.manipulate import (rinex_merge, crx2rnx) +from gnsspy.io.manipulate import (rinex_merge) from gnsspy.position.atmosphere import (tropospheric_delay) from gnsspy.position.interpolation import (sp3_interp, ionosphere_interp) from gnsspy.position.position import (spp, multipath) diff --git a/gnsspy/funcs/checkif.py b/gnsspy/funcs/checkif.py index 0584fd3..f3a4f5f 100755 --- a/gnsspy/funcs/checkif.py +++ b/gnsspy/funcs/checkif.py @@ -1,16 +1,13 @@ # =========================================================== # ========================= imports ========================= import os -from patoolib import extract_archive import http.client from gnsspy import download -from gnsspy.doc.IGS import IGS, is_IGS +from gnsspy.doc.IGS import is_IGS from gnsspy.funcs.date import doy2date -from gnsspy.io.manipulate import crx2rnx +from hatanaka import decompress_on_disk # =========================================================== -global _CWD -_CWD = os.getcwd() def isfloat(value): """ To check if any variable can be converted to float or not """ @@ -42,61 +39,59 @@ def check_internet(): def isexist(fileName): if os.path.exists(fileName) == False: if (os.path.exists(fileName + ".Z") == False) and (fileName.endswith(".Z")==False): - extension = fileName.split(".")[1] - if extension[-1].lower() == "o": - if is_IGS(fileName[:4]) == True: + extension = fileName.split(".")[1].lower() + if extension[-1] == "o": + if is_IGS(fileName[:4]): print(fileName + ".Z does not exist in working directory | Downloading...") fileEpoch = doy2date(fileName) download.get_rinex([fileName[:4]], fileEpoch, Datetime = True) print(" | Download completed for", fileName + ".Z", " | Extracting...") - extract_archive(fileName + ".Z", outdir=_CWD) + decompress_on_disk(fileName + ".Z", delete=True) else: raise Warning(fileName,"does not exist in directory and cannot be found in IGS Station list!") - elif extension.lower() == "rnx": - if is_IGS(fileName[:4]) == True: + elif extension == "rnx": + if is_IGS(fileName[:4]): print(fileName + " does not exist in working directory | Downloading...") fileName = fileName.split(".")[0] + ".crx" fileEpoch = doy2date(fileName) download.get_rinex3([fileName[:4]], fileEpoch, Datetime = True) print(" | Download completed for", fileName + ".gz", " | Extracting...") - extract_archive(fileName + ".gz", outdir=_CWD) - crx2rnx(fileName) + decompress_on_disk(fileName + ".gz", delete=True) else: raise Warning(fileName,"does not exist in directory and cannot be found in IGS Station list!") - elif extension.lower() == "crx": - if is_IGS(fileName[:4]) == True: + elif extension == "crx": + if is_IGS(fileName[:4]): print(fileName + ".gz does not exist in working directory | Downloading...") fileEpoch = doy2date(fileName) download.get_rinex3([fileName[:4]], fileEpoch, Datetime = True) - extract_archive(fileName + ".gz", outdir=_CWD) - crx2rnx(fileName) + decompress_on_disk(fileName + ".gz", delete=True) else: raise Warning(fileName,"does not exist in directory and cannot be found in IGS Station list!") - elif extension[-1].lower() in {"n","p","g"}: - if is_IGS(fileName[:4]) == True: + elif extension[-1] in {"n","p","g"}: + if is_IGS(fileName[:4]): print(fileName + ".Z does not exist in working directory | Downloading...") fileEpoch = doy2date(fileName) download.get_navigation([fileName[:4]], fileEpoch, Datetime = True) - extract_archive(fileName + ".Z", outdir=_CWD) - elif extension.lower() in {"clk","clk_05s"}: + decompress_on_disk(fileName + ".Z", delete=True) + elif extension in {"clk","clk_05s"}: download.get_clock(fileName) - extract_archive(fileName + ".Z", outdir=_CWD) - elif extension.lower() == "sp3": + decompress_on_disk(fileName + ".Z", delete=True) + elif extension == "sp3": download.get_sp3(fileName) - extract_archive(fileName + ".Z", outdir=_CWD) + decompress_on_disk(fileName + ".Z", delete=True) elif extension[-1].lower() == "i": download.get_ionosphere(fileName) - extract_archive(fileName + ".Z", outdir=_CWD) + decompress_on_disk(fileName + ".Z", delete=True) else: - raise Warning("Unknown file extension:",extension.lower()) - elif (os.path.exists(fileName + ".Z") == True) and (fileName.endswith(".Z")==True): + raise Warning("Unknown file extension:", extension) + elif os.path.exists(fileName + ".Z"): print(fileName + " exists in working directory | Extracting...") - extract_archive(fileName, outdir=_CWD) + decompress_on_disk(fileName, delete=True) else: print(fileName + ".Z exists in working directory | Extracting...") - extract_archive(fileName + ".Z", outdir=_CWD) - elif (os.path.exists(fileName) == True) and (fileName.endswith(".Z")==True): + decompress_on_disk(fileName + ".Z", delete=True) + elif os.path.exists(fileName) and fileName.endswith(".Z"): print(fileName + " exists in working directory | Extracting...") - extract_archive(fileName, outdir=_CWD) + decompress_on_disk(fileName, delete=True) else: print(fileName + " exist in working directory | Reading...") diff --git a/gnsspy/io/CRX2RNX b/gnsspy/io/CRX2RNX deleted file mode 100755 index ad29fce..0000000 Binary files a/gnsspy/io/CRX2RNX and /dev/null differ diff --git a/gnsspy/io/RNX2CMP_LICENSE.txt b/gnsspy/io/RNX2CMP_LICENSE.txt deleted file mode 100644 index b435e78..0000000 --- a/gnsspy/io/RNX2CMP_LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -RNXCMP SOFTWARE -Copyright (c) 2007, 2009, 2012, 2014, 2016, 2019 Geospatial -Information Authority of Japan All rights reserved. - -This is the license document of the RNXCMP software (Technical -Reports of the Geospatial Information Authority of Japan H1-No.6 "The -RNXCMP software for compression/restoration of RINEX observation files"). -The RNXCMP software package consists of the source codes, the executable -binaries, the scripts and batch files of the frontend tools, and the -related documents. - -Geospatial Information Authority of Japan Website Terms of Use: -https://www.gsi.go.jp/ENGLISH/page_e30286.html -is applied to use, modification, or redistribution of the RNXCMP -software package, except for the provision 1)-a. -The user must cite the reference when the user modifies the RNXCMP -software or combines it with other software and distributes it. - -Appropriate reference to the RNXCMP software is -Hatanaka, Y. (2008), A Compression Format and Tools for GNSS Observation - Data, Bulletin of the Geospatioal Information Authority of Japan, 55, 21-30. -(available at https://www.gsi.go.jp/ENGLISH/Bulletin55.html) diff --git a/gnsspy/io/crx2rnx.exe b/gnsspy/io/crx2rnx.exe deleted file mode 100644 index 282309c..0000000 Binary files a/gnsspy/io/crx2rnx.exe and /dev/null differ diff --git a/gnsspy/io/manipulate.py b/gnsspy/io/manipulate.py index fc41442..7640841 100755 --- a/gnsspy/io/manipulate.py +++ b/gnsspy/io/manipulate.py @@ -63,12 +63,3 @@ def rinex_merge(station, doy, year, directory = os.getcwd()): header = False else: rinexMerged.write(line) - -def crx2rnx(rinexFile): - """ Converts Hatanaka format to RINEX format """ - path = os.path.dirname(os.path.abspath(__file__)) - if sys.platform=="linux" or sys.platform=="darwin": - subprocess.call([_FILEPATH+"/CRX2RNX",rinexFile], stdin = sys.stdin) - elif sys.platform=="windows": - subprocess.call([_FILEPATH+"/crx2rnx.exe",rinexFile], stdin = sys.stdin) -