Skip to content

Commit

Permalink
added local station coordinate database (LLH), v 3.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinemlarson committed Jul 22, 2024
1 parent cc3c44a commit fe29742
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 18 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 3.6.4

July 22, 2024

I added a final plot to subdaily. Doesn't have the spline in it. Uses a line instead
of a symbol. But otherwise it isn't new information.

I added a simple file for a priori lat lon and ellipsoidal height values.
It should be located in $REFL_CODE/llh_local.txt. and the values should simply
be station lat lon height. NO COMMANS between then, simply spaces.
comment lines are allowed if preceded by percent sign. I would prefer station names to be
lowercase, but it allows and checks uppercase.
This kind of file would be particularly useful for NMEA people as it allows you to
store your a priori receiver coordinates and don't have to worry about it being
overwritten if you change your analysis strategy.

## 3.6.3
July 19, 2024

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gnssrefl v3.6.3
# gnssrefl v3.6.4

gnssrefl is an open source software package for GNSS interferometric reflectometry (GNSS-IR).
If you use this code in presentations or a publication, please cite either
Expand Down
2 changes: 1 addition & 1 deletion gnssrefl/gnssir_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def make_gnssir_input(station: str, lat: float=0, lon: float=0, height: float=0,
# try to find the coordinates at UNR
lat, lon, height = g.queryUNR_modern(station)
if lat == 0:
print('Tried to find coordinates in our station database. None found so exiting')
print('Tried to find coordinates in station database. None found so exiting')
sys.exit()

# calculate Hortho using EGM96 if none provided
Expand Down
79 changes: 66 additions & 13 deletions gnssrefl/gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5591,19 +5591,12 @@ def queryUNR_modern(station):
Queries the UNR database for station coordinates that has been stored in sql. downloads
the sql file and stores it locally if necessary
Parameters
-----------
station : str
4 character station name
Returns
-------
lat : float
latitude in degrees (zero if not found)
lon : float
longitude in degrees (zero if not found)
ht : float
ellipsoidal ht in meters (zzero if not found)
Also queries a local file if you have defined one.
It should be located in $REFL_CODE/input/llh_local.txt
four columns should be station name lat lon height
No commas between them and the station name should be four characters
Hopefully lowercase, but I will try to put in a toggle that allows uppercase
"""
lat = 0; lon = 0; ht = 0
Expand All @@ -5617,6 +5610,11 @@ def queryUNR_modern(station):
if not os.path.isdir(fdir):
subprocess.call(['mkdir', fdir])

# check local database file
foundit, lat, lon, ht = query_coordinate_file(station)
if foundit:
return lat, lon, ht

# new database locations
nfile00 = 'gnssrefl/station_pos_2024.db'
nfile0 = xdir + '/Files/station_pos_2024.db'
Expand Down Expand Up @@ -5656,21 +5654,30 @@ def queryUNR_modern(station):

if (station == 'moss'):
lat= -16.434464800 ;lon = 145.403622520 ; ht = 71.418
print('override')
elif (station == 'mnis'):
lat = -16.667810553; lon = 139.170597267; ht = 60.367;
print('override')
elif (station == 'boig'):
lat = -9.24365375 ; lon = 142.253961217; ht = 82.5;
print('override')
elif (station == 'glbx'):
lat = 58.455146633; lon = -135.888483766 ; ht = 12.559;
print('override')
elif (station == 'ugar'):
lat = -9.50477824; lon = 143.54686680 ; ht = 81.2
print('override')
elif (station == 'whla'):
lat = -33.01640186 ; lon = 137.59157111 ; ht = 7.856
print('override')
elif (station == 'kubn'):
lat =-10.23608303 ; lon =142.21446068; ht = 78.2
print('override')
elif (station == 'smm4'):
lat =72.57369139 ; lon =-38.470709199 ; ht = 3262
print('override')
elif (station == 'pchl'):
print('override')
lat = 60.242562899 ; lon = -147.248979547 ; ht = 18.368

if (not_in_database) and (lat == 0):
Expand Down Expand Up @@ -7408,4 +7415,50 @@ def greenland_rinex3(station,year,doy):
return filename, found


def query_coordinate_file(station):
"""
Returns a priori Cartesian coordinates from a local file
The file is stored in $REFL_CODE/input/llh_local.txt
It has a simple structure. Each value is separated by spaces
station latitude longitude height
The station name is four characters and the units of the other
three are degrees, degrees, and meters. Height is the ellipsoidal
height. Comments are allowed using a percent sign.
Parameters
-----------
station : str
4 character station name. checks both upper and lower case
Returns
-------
foundit : bool
whether you found the coordinates
lat : float
latitude in degrees (zero if not found)
lon : float
longitude in degrees (zero if not found)
ht : float
ellipsoidal ht in meters (zzero if not found)
"""
xdir = os.environ['REFL_CODE']
f= xdir + '/input/llh_local.txt'
foundit = False
lat = 0; lon = 0; ht = 0;
if os.path.isfile(f):
allofit =np.loadtxt(f,usecols = (0,1,2,3), dtype='str',comments= '%')
nr,nc = np.shape(allofit)
for i in range(0,nr):
dbname = allofit[i,0].lower()
if (station.lower() == dbname):
print('Found in local coordinates file : ', f)
lat = float(allofit[i,1])
lon = float(allofit[i,2])
ht = float(allofit[i,3])
foundit = True

return foundit, lat, lon, ht

12 changes: 10 additions & 2 deletions gnssrefl/nmea2snr_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,20 @@ def nmea2snr( station: str, year: int, doy: int, snr: int = 66, year_end: int=No
sp3 = False
else:
sp3 = True
# check local coordinte file
foundcoords, lat, lon, ht = g.query_coordinate_file(station)
if foundcoords:
print(lat,lon,ht)
x,y,z = g.llh2xyz(lat,lon,ht)
recv = [x,y,z]
else:
# try to get a priori coordinates, Cartesian
recv, foundcoords = nmea.nmea_apriori_coords(station,llh,sp3)
recv, foundcoords = nmea.nmea_apriori_coords(station,llh,sp3)
if not foundcoords:
print('The default in this code is to use precise orbits to calculate az/el values.')
print('We need to know apriori coordinates for your site. Please input lat/lon/ellipsoidal height ')
print('on the command line or set those values using gnssir_input.')
print('on the command line or use a local coordinate file as explained in the documentation for')
print('query_coordinate_file. You can also store the values using gnssir_input.')
sys.exit()


Expand Down
4 changes: 4 additions & 0 deletions gnssrefl/quickLook_function2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def quickLook_function(station, year, doy, snr_type,f,e1,e2,minH,maxH,reqAmp,pel
This is a new version that tries to picks all rising and setting arcs, not just those constrained to 90 degree
quadrants.
It will attempt to make a refraction correction if you have a local coordinate file or
a station analysis json. The format of the local coordinate file can be found in the documentation
for query_coordinate_file which is in the gps library.
Parameters
----------
station : str
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
]
setup(
name="gnssrefl",
version="3.6.3",
version="3.6.4",
author="Kristine Larson",
author_email="[email protected]",
description="A GNSS reflectometry software package ",
Expand Down

0 comments on commit fe29742

Please sign in to comment.