Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion gnsspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
57 changes: 26 additions & 31 deletions gnsspy/funcs/checkif.py
Original file line number Diff line number Diff line change
@@ -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 """
Expand Down Expand Up @@ -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...")
Binary file removed gnsspy/io/CRX2RNX
Binary file not shown.
22 changes: 0 additions & 22 deletions gnsspy/io/RNX2CMP_LICENSE.txt

This file was deleted.

Binary file removed gnsspy/io/crx2rnx.exe
Binary file not shown.
9 changes: 0 additions & 9 deletions gnsspy/io/manipulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)