mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-02 10:57:59 +00:00
skyplot: make constellation(s) to be plot configurable
This commit is contained in:
@@ -24,6 +24,7 @@ showing satellite visibility over time.
|
||||
- Plots satellite tracks in azimuth-elevation coordinates.
|
||||
- Elevation mask set to 5°, configurable via the `--elev-mask` flag.
|
||||
- Color-codes satellites by constellation (GPS, Galileo, GLONASS, BeiDou).
|
||||
- Constellations to plot can be configured via the `--system` flag.
|
||||
- Customizable observer location.
|
||||
- Outputs high-quality image in PDF format.
|
||||
- Non-interactive mode for CI jobs (with `--no-show` flag).
|
||||
@@ -40,7 +41,7 @@ showing satellite visibility over time.
|
||||
### Basic Command
|
||||
|
||||
```
|
||||
./skyplot.py <RINEX_FILE> [LATITUDE] [LONGITUDE] [ALTITUDE] [--use-obs] [--elev-mask] [--no-show]
|
||||
./skyplot.py <RINEX_FILE> [LATITUDE] [LONGITUDE] [ALTITUDE] [--use-obs] [--elev-mask] [--system ...] [--no-show]
|
||||
```
|
||||
|
||||
### Arguments
|
||||
@@ -52,6 +53,8 @@ showing satellite visibility over time.
|
||||
| `LONGITUDE` | Optional | degrees (°) | East/West position | 1.9876°E |
|
||||
| `ALTITUDE` | Optional | meters (m) | Height above sea level | 80.0 m |
|
||||
| `--use-obs` | Optional | - | Use RINEX obs data | - |
|
||||
| `--elev-mask` | Optional | degrees (°) | Elevation mask | 5° |
|
||||
| `--system` | Optional | - | Systems to plot | All |
|
||||
| `--no-show` | Optional | - | Do not show plot | - |
|
||||
|
||||
### Examples
|
||||
@@ -73,6 +76,14 @@ showing satellite visibility over time.
|
||||
```
|
||||
./skyplot.py brdc0010.22n -33.4592 -70.6453 520.0 --no-show
|
||||
```
|
||||
- Only plot GPS and Galileo satellites:
|
||||
```
|
||||
./skyplot.py brdc0010.22n -33.4592 -70.6453 520.0 --system GPS Galileo
|
||||
```
|
||||
or
|
||||
```
|
||||
./skyplot.py brdc0010.22n -33.4592 -70.6453 520.0 --system G E
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
|
@@ -517,6 +517,17 @@ def plot_satellite_tracks(satellites, obs_lat, obs_lon, obs_alt,
|
||||
|
||||
def main():
|
||||
"""Generate the skyplot"""
|
||||
# Set system names and codes
|
||||
system_name_to_code = {
|
||||
'GPS': 'G',
|
||||
'GLONASS': 'R',
|
||||
'GALILEO': 'E',
|
||||
'BEIDOU': 'C',
|
||||
'QZSS': 'J',
|
||||
'IRNSS': 'I',
|
||||
'SBAS': 'S'
|
||||
}
|
||||
|
||||
# Set up argument parser
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Generate GNSS skyplot from RINEX navigation file',
|
||||
@@ -540,17 +551,22 @@ def main():
|
||||
'--elev-mask', type=float, default=5.0,
|
||||
help='Elevation mask in degrees for plotting satellite tracks (default: 5°)'
|
||||
)
|
||||
|
||||
# Add the system flag.
|
||||
parser.add_argument(
|
||||
'--system',
|
||||
nargs='+',
|
||||
help='Only plot satellites from these systems (e.g., G R E or GPS Galileo GLONASS)'
|
||||
)
|
||||
# Parse known args (this ignores other positional args)
|
||||
args, remaining_args = parser.parse_known_args()
|
||||
|
||||
# Handle help manually
|
||||
if '-h' in remaining_args or '--help' in remaining_args:
|
||||
print("""
|
||||
Usage: python skyplot.py <RINEX_FILE> [LATITUDE] [LONGITUDE] [ALTITUDE] [--use-obs] [--elev-mask] [--no-show]
|
||||
Usage: python skyplot.py <RINEX_FILE> [LATITUDE] [LONGITUDE] [ALTITUDE] [--use-obs] [--elev-mask] [--system ...] [--no-show]
|
||||
|
||||
Example:
|
||||
python skyplot.py brdc0010.22n 41.275 1.9876 80.0 --use-obs --no-show --elev-mask=10
|
||||
python skyplot.py brdc0010.22n 41.275 1.9876 80.0 --use-obs --no-show --elev-mask=10 --system GPS Galileo
|
||||
""")
|
||||
sys.exit(0)
|
||||
|
||||
@@ -587,6 +603,21 @@ Example:
|
||||
print("No satellite data found in the file.")
|
||||
return
|
||||
|
||||
if args.system:
|
||||
systems_upper = set()
|
||||
for s in args.system:
|
||||
s_upper = s.upper()
|
||||
if s_upper in system_name_to_code:
|
||||
systems_upper.add(system_name_to_code[s_upper])
|
||||
else:
|
||||
systems_upper.add(s_upper) # Assume user passed the code
|
||||
|
||||
satellites = {prn: eph_list for prn, eph_list in satellites.items() if prn[0].upper() in systems_upper}
|
||||
|
||||
if not satellites:
|
||||
print(f"No satellites found for systems: {', '.join(sorted(systems_upper))}")
|
||||
return
|
||||
|
||||
# Print summary information
|
||||
all_epochs = sorted(list(set(
|
||||
e['epoch'] for prn, ephemerides in satellites.items() for e in ephemerides
|
||||
|
Reference in New Issue
Block a user