### Install gnsstools Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Installation commands for the gnsstools package. ```bash pip install gnsstools ``` ```bash python install . ``` -------------------------------- ### Extract Modified Julian Day from gnsstime Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Get the Modified Julian Day value from a gnsstime object. ```python from gnsstools import gnsstime date = gnsstime(2000, 1, 1, 0, 0, 0) # Modified Julian Day mjd = date.mjd ``` -------------------------------- ### Accessing Physical Constants Source: https://context7.com/arthurdjn/gnsstools/llms.txt Demonstrates how to access standard GNSS physical constants provided by the library, such as the speed of light, Earth's gravitational constant, and relativistic correction factors. ```python from gnsstools.const import c, mu, F, omega_e, deg2rad # Speed of light [m/s] print(f"Speed of light: {c} m/s") # 299792458.0 # Earth gravitational constant [m3/s2] print(f"GM (mu): {mu} m3/s2") # 3.986005e14 # Relativistic correction factor print(f"F constant: {F}") # -4.442807633e-10 ``` -------------------------------- ### Initialize gnsstime objects Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Create gnsstime objects using various input formats and types. ```python from gnsstools import gnsstime # Create a datetime from GNSS information # Year, Month, Day, Hour, Minute, Second, MicroSecond date = gnsstime(18, 1, 1, 0, 0, 0) date = gnsstime(2018, 1, 1, 0, 0, 0) ``` ```python # Provide arguments as a string date = gnsstime("18", "1", "1", "0", "0", "0") date = gnsstime("2018", "01", "01", "00", "00", "00.000000") # Provide argument as a float date = gnsstime(2018, 1, 1, 5.933, 4.36, 33.231) ``` -------------------------------- ### Create and Use gnsstime Objects Source: https://context7.com/arthurdjn/gnsstools/llms.txt Instantiate gnsstime objects from various inputs like year/month/day or strings. Access temporal and GNSS-specific time properties like day of year, second of week, and GPS time. ```python from gnsstools import gnsstime # Create gnsstime from year, month, day, hour, minute, second # Supports both 2-digit and 4-digit years date = gnsstime(2018, 1, 1, 0, 0, 0) date_short = gnsstime(18, 1, 1, 0, 0, 0) # Automatically converts to 2018 # Flexible input types - accepts strings or floats date = gnsstime("2018", "01", "15", "12", "30", "45.500000") # Float arguments automatically extract microseconds date = gnsstime(2018, 1, 1, 5.933, 4.36, 33.231) # Access temporal properties print(f"Day of Year: {date.doy}") # Day number in current year print(f"Week of Year: {date.woy}") # Week number in current year print(f"Second of Day: {date.sod}") # Seconds elapsed in current day print(f"Second of Week: {date.sow}") # Seconds elapsed in current week print(f"Session: {date.session}") # Hourly session letter (a-x, 0) # GPS Time properties (from GPS origin: 1980-01-06T00:00:00 UTC) print(f"Seconds from GPS0: {date.seconds0}") print(f"Days from GPS0: {date.days0}") print(f"Weeks from GPS0: {date.weeks0}") # Julian Day conversions print(f"Julian Day: {date.jd}") # JD from 4713 BC print(f"Julian Day 1950: {date.jd50}") # JD relative to 1950 print(f"Modified Julian Day: {date.mjd}") # MJD relative to 2000 ``` -------------------------------- ### rinex.load Source: https://context7.com/arthurdjn/gnsstools/llms.txt Unified interface to load RINEX observation/navigation files and SP3 ephemeris files into pandas DataFrames. ```APIDOC ## rinex.load ### Description Loads GNSS data files into pandas DataFrames. Automatically detects file type and version. ### Parameters - **filepath** (str) - Required - Path to the RINEX or SP3 file ### Response - **DataFrame** (pandas.DataFrame) - Contains parsed satellite data (System, PRN, Date, observations, or X, Y, Z coordinates) - **attrs** (dict) - Header metadata including version and file type ``` -------------------------------- ### Single Point Positioning (SPP) Workflow Source: https://context7.com/arthurdjn/gnsstools/llms.txt Performs Single Point Positioning (SPP) by combining observation data, orbit computation, and trilateration to determine receiver position. Loads RINEX observation and navigation files. ```python from gnsstools import GNSSProcess, Orbit, rinex, gnsstime # Load observation and navigation data df_obs = rinex.load("data/edf1285b.18o") df_nav = rinex.load("data/BRDC00IGS_R_20182850000_01D_MN.rnx") # Create orbit object with navigation data orbit = Orbit() orbit.load_nav(df_nav) # Create GNSS processor processor = GNSSProcess() # Process single epoch for receiver position epoch = df_obs.select_epoch(gnsstime(2018, 10, 12, 0, 40, 15)) # Compute receiver position using SPP Xr, Yr, Zr, cdtr = processor.spp(epoch=epoch, orbit=orbit) print(f"Receiver Position (ECEF):") print(f" X: {Xr:.3f} m") print(f" Y: {Yr:.3f} m") print(f" Z: {Zr:.3f} m") print(f" Clock Error * c: {cdtr:.3f} m") print(f" Number of satellites used: {processor.nb_sat}") ``` -------------------------------- ### gnsstime.fromjd / fromdoy Source: https://context7.com/arthurdjn/gnsstools/llms.txt Factory methods to create gnsstime objects from astronomical time references or GNSS-specific day-of-year formats. ```APIDOC ## gnsstime.fromjd / fromdoy ### Description Creates a gnsstime object from Julian Day (fromjd), Julian Day 1950 (fromjd50), Modified Julian Day (frommjd), or Day of Year (fromdoy). ### Parameters - **jd** (float) - Required (for fromjd) - Julian Day value - **jd50** (float) - Required (for fromjd50) - Days since 1950-01-01 - **mjd** (float) - Required (for frommjd) - MJD value - **year** (int) - Required (for fromdoy) - Year - **doy** (int) - Required (for fromdoy) - Day of year - **sod** (float) - Optional (for fromdoy) - Second of day ``` -------------------------------- ### Load GNSS Data Files (RINEX, SP3) Source: https://context7.com/arthurdjn/gnsstools/llms.txt Use `rinex.load` for a unified interface to load RINEX (v2/v3) observation/navigation files and SP3 precise ephemeris files into pandas DataFrames. File type is auto-detected. ```python from gnsstools import rinex # Load RINEX 2 Observation file (*.??o) df_obs = rinex.load("data/edf1285b.18o") print(df_obs.head()) # Returns DataFrame with columns: System, PRN, Date, C1, L1, P1, P2, etc. # Load RINEX 3 Navigation file (*.rnx) df_nav = rinex.load("data/BRDC00IGS_R_20182850000_01D_MN.rnx") print(df_nav.head()) # Returns NavigationDataFrame indexed by (System, PRN, Date) # Load GPS navigation file (*.??n) df_gps_nav = rinex.load("data/edf1285b.18n") # Load GLONASS navigation file (*.??g) df_glo_nav = rinex.load("data/edf1285b.18g") # Load SP3 precise ephemeris file df_sp3 = rinex.load("data/COM20225_15M.SP3") print(df_sp3.head()) # Returns DataFrame with satellite positions (X, Y, Z) and clock errors # Access header metadata print(df_nav.attrs) # Contains version, file type, and header information ``` -------------------------------- ### Create GPS Satellite Object Source: https://context7.com/arthurdjn/gnsstools/llms.txt Instantiate a GPS satellite object with its orbital and clock correction parameters. This class holds Keplerian elements for position computation. ```python from gnsstools.satellites import GPS from gnsstools import gnsstime # Create GPS satellite with orbital parameters gps = GPS( prn=2, toc=gnsstime(2018, 10, 12, 0, 0, 0), sv_clock_bias=-1.234567e-04, sv_clock_drift=1.234567e-11, sv_clock_drift_rate=0.0, iode=123, crs=12.34, delta_n=4.567e-09, m0=1.234567, cuc=1.234e-06, e=0.0123456, # Eccentricity cus=5.678e-06, sqrt_a=5153.682, # sqrt of semi-major axis toe=432000.0, cic=1.234e-07, omega0=2.345678, cis=5.678e-08, i0=0.9876543, # Inclination crc=234.56, omega=1.234567, # Argument of perigee omega_dot=-8.123e-09, idot=1.234e-10, gps_week=2024, sv_acc=2.0, sv_health=0.0, tgd=-1.234e-08, iodc=123 ) print(f"System: {gps.system}") # 'G' print(f"PRN: {gps.prn}") print(f"Time of Clock: {gps.toc}") print(gps) # Full formatted output ``` -------------------------------- ### Create gnsstime from Julian Day Source: https://context7.com/arthurdjn/gnsstools/llms.txt Convert Julian Day, Julian Day 1950, or Modified Julian Day values into gnsstime objects. Useful for astronomical time references. ```python from gnsstools import gnsstime # Create gnsstime from Julian Day jd = 2451545.0 # J2000.0 epoch (2000-01-01T12:00:00) date = gnsstime.fromjd(jd) print(f"Date from JD: {date}") # 2000-01-01 12:00:00 # Create from Julian Day 1950 jd50 = 18262.5 # Days since 1950-01-01 date = gnsstime.fromjd50(jd50) print(f"Date from JD50: {date}") # Create from Modified Julian Day mjd = 51544.5 # MJD for 2000-01-01 date = gnsstime.frommjd(mjd) print(f"Date from MJD: {date}") ``` -------------------------------- ### Create GLONASS Satellite Object Source: https://context7.com/arthurdjn/gnsstools/llms.txt Instantiate a GLONASS satellite object using Cartesian position and velocity state vectors. This class is suitable for GLONASS-specific calculations. ```python from gnsstools.satellites import GLONASS from gnsstools import gnsstime # Create GLONASS satellite with state vectors glonass = GLONASS( prn=5, toc=gnsstime(2018, 10, 12, 0, 15, 0), sv_clock_bias=-1.234567e-04, sv_rel_freq_bias=1.234e-12, message_frame_time=54900.0, x=12345.678, # Position X [km] dx=1.234567, # Velocity X [km/s] dx2=0.0, # Acceleration X [km/s2] health=0, y=-23456.789, # Position Y [km] dy=-2.345678, # Velocity Y [km/s] dy2=0.0, freq_num=1, z=8765.432, # Position Z [km] dz=3.456789, # Velocity Z [km/s] dz2=0.0, age_op_info=0 ) print(f"System: {glonass.system}") # 'R' print(f"Position: ({glonass.x}, {glonass.y}, {glonass.z}) km") print(f"Velocity: ({glonass.dx}, {glonass.dy}, {glonass.dz}) km/s") ``` -------------------------------- ### Create GALILEO Satellite Object Source: https://context7.com/arthurdjn/gnsstools/llms.txt Instantiate a GALILEO satellite object with Galileo-specific orbital parameters. This class is used for Galileo ephemeris data. ```python from gnsstools.satellites import GALILEO from gnsstools import gnsstime # Create Galileo satellite with orbital parameters galileo = GALILEO( prn=11, toc=gnsstime(2018, 10, 12, 0, 0, 0), sv_clock_bias=-1.234567e-04, sv_clock_drift=1.234567e-11, sv_clock_drift_rate=0.0, iod_nav=123, # Issue of Data (Navigation) crs=12.34, delta_n=4.567e-09, m0=1.234567, cuc=1.234e-06, e=0.0123456, cus=5.678e-06, sqrt_a=5440.602, toe=432000.0, cic=1.234e-07, omega0=2.345678, cis=5.678e-08, i0=0.9876543, crc=234.56, omega=1.234567, omega_dot=-8.123e-09, idot=1.234e-10, gal_week=1024, sisa=3.12, # Signal in Space Accuracy sv_health=0, bgd_e5a=-1.234e-09, # Broadcast Group Delay E5a/E1 bgd_e5b=-2.345e-09 # Broadcast Group Delay E5b/E1 ) print(f"System: {galileo.system}") # 'E' print(f"SISA: {galileo.sisa} m") ``` -------------------------------- ### Select Satellite Data by Time Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Select ephemeris or satellite data for a specific date and satellite from a loaded DataFrame. If the exact date is not found, the closest available date is returned. ```python from gnsstools import gnsstime date = gnsstime(2018, 10, 12, 0, 40, 15) satellite = df.select("G", 2, date) ``` -------------------------------- ### Load SP3 Data Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Load SP3 format GNSS data into a pandas DataFrame. ```python from gnsstools import rinex filename = "data/COM20225_15M.SP3" df = rinex.load(filename) ``` -------------------------------- ### Create gnsstime from Julian Day Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Instantiate a gnsstime object from a Julian Day value. Use `fromjd50` for the Julian Day of year 1950. ```python from gnsstools import gnsstime jd = 2451545.0 date = gnsstime.fromjd(jd) jd50 = 2433282.5 date = gnsstime.fromjd50(jd50) ``` -------------------------------- ### Create gnsstime from Modified Julian Day Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Instantiate a gnsstime object from a Modified Julian Day value. ```python from gnsstools import gnsstime mjd = 51544.5 date = gnsstime.frommjd(mjd) ``` -------------------------------- ### Access Earth rotation rate and degree conversion Source: https://context7.com/arthurdjn/gnsstools/llms.txt Displays the Earth's rotation rate in radians per second and the conversion factor for degrees to radians. ```python # Earth rotation rate [rad/s] print(f"Earth rotation: {omega_e} rad/s") # -7.2921151467e-5 # Degree to radian conversion print(f"Deg to rad: {deg2rad}") # pi/180 ``` -------------------------------- ### Compute Satellite Position from SP3 Ephemeris Source: https://context7.com/arthurdjn/gnsstools/llms.txt Loads SP3 precise ephemeris data and computes satellite ECEF coordinates and clock error using Lagrange interpolation for sub-epoch precision. Requires SP3 data file and specifies interpolation order. ```python from gnsstools.orbits import OrbitSP3 from gnsstools import rinex, gnsstime # Load SP3 precise ephemeris df_sp3 = rinex.load("data/COM20225_15M.SP3") # Create OrbitSP3 and load data orbit_sp3 = OrbitSP3() orbit_sp3.load_sp3(df_sp3) # Compute position with Lagrange interpolation date = gnsstime(2018, 10, 12, 0, 40, 15) mjd = date.mjd # Get position with interpolation order (degree of Lagrange polynomial) X, Y, Z, clock_error = orbit_sp3.pos_sat_sp3( const="G", # Constellation (G=GPS, R=GLONASS, E=Galileo) prn=2, # Satellite PRN number mjd=mjd, # Modified Julian Day ordre=9 # Lagrange interpolation order ) print(f"Precise Satellite Position (ECEF):") print(f" X: {X:.3f} m") print(f" Y: {Y:.3f} m") print(f" Z: {Z:.3f} m") print(f" Clock Error: {clock_error:.12f} s") ``` -------------------------------- ### Create gnsstime from Day of Year Source: https://context7.com/arthurdjn/gnsstools/llms.txt Construct gnsstime objects using the year, day of year, and second of day. This format is common in GNSS data files. ```python from gnsstools import gnsstime # Create from day of year date = gnsstime.fromdoy(year=2018, doy=285, sod=0) print(f"Date: {date}") # 2018-10-12 00:00:00 # With second of day (float for sub-second precision) date = gnsstime.fromdoy(year=2018, doy=1, sod=43200.5) # Noon + 0.5 seconds print(f"Date with SOD: {date}") # 2018-01-01 12:00:00.500000 ``` -------------------------------- ### Load Rinex 3 Navigation Data Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Load GNSS navigation data from a Rinex 3 file into a pandas DataFrame. ```python from gnsstools import rinex filename = "data/BRDC00IGS_R_20182850000_01D_MN.rnx" df = rinex.load(filename) ``` -------------------------------- ### Load Rinex 2 Observation Data Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Load GNSS observation data from a Rinex 2 file into a pandas DataFrame. ```python from gnsstools import rinex filename = "data/edf1285b.18o" df = rinex.load(filename) ``` -------------------------------- ### Compute Satellite Position using Navigation Data Source: https://context7.com/arthurdjn/gnsstools/llms.txt Loads navigation data and computes the ECEF coordinates and clock error of a GPS satellite at a specific time. ```python from gnsstools import Orbit, gnsstime # Assuming df_nav is loaded navigation data # orbit = Orbit() # orbit.load_nav(df_nav) # Load navigation data # Compute satellite position at specific time date = gnsstime(2018, 10, 12, 0, 40, 15) mjd = date.mjd # Convert to Modified Julian Day # Get ECEF coordinates and clock error for GPS satellite PRN 2 # coords, clock_error = orbit.get_sat_coords(const="G", prn=2, mjd=mjd) # X, Y, Z = coords # print(f"Satellite Position (ECEF):") # print(f" X: {X:.3f} m") # print(f" Y: {Y:.3f} m") # print(f" Z: {Z:.3f} m") # print(f" Clock Error: {clock_error:.9f} s") ``` -------------------------------- ### Select Satellite Ephemeris Data Source: https://context7.com/arthurdjn/gnsstools/llms.txt Use the select method to retrieve ephemeris for a specific satellite (GPS, GLONASS, Galileo) at a given time. The ignore_offset parameter can be set to True to bypass the default 2-hour time difference check. ```python from gnsstools import rinex, gnsstime # Load navigation data df_nav = rinex.load("data/BRDC00IGS_R_20182850000_01D_MN.rnx") # Select GPS satellite PRN 2 at specific time date = gnsstime(2018, 10, 12, 0, 40, 15) gps_sat = df_nav.select(system="G", prn=2, date=date) print(gps_sat) # GPS( # system: G # prn: 2 # toc: 2018-10-12 00:00:00 [UTC] (Time Of Clock) # sv_clock_bias: -1.234567e-04 [s] # sqrt_a: 5.153682e+03 [sqrt(m)] # e: 1.234567e-02 (Eccentricity) # ... # ) # Access orbital parameters directly print(f"Semi-major axis sqrt: {gps_sat.sqrt_a}") print(f"Eccentricity: {gps_sat.e}") print(f"Mean anomaly M0: {gps_sat.m0}") print(f"Inclination i0: {gps_sat.i0}") # Select GLONASS satellite glonass_sat = df_nav.select(system="R", prn=5, date=date) # Select Galileo satellite galileo_sat = df_nav.select(system="E", prn=11, date=date) # Ignore time offset check (allows selection even if date is >2 hours away) sat = df_nav.select(system="G", prn=2, date=date, ignore_offset=True) ``` -------------------------------- ### Retrieve time attributes Source: https://github.com/arthurdjn/gnsstools/blob/main/README.md Access various time-related properties from a gnsstime object. ```python date = gnsstime(2018, 1, 1, 0, 0, 0) doy = date.doy # Day of the year woy = date.woy # Week of the year sod = date.sod # Second of the day sow = date.sow # Second of the week ``` ```python date = gnsstime(2018, 1, 1, 0, 0, 0) # From GPS0 defined at 1980-01-06T00:00:00 (UTC) seconds0 = date.seconds0 days0 = date.days0 weeks0 = date.weeks0 ``` ```python date = gnsstime(2000, 1, 1, 0, 0, 0) # Julian Day for year 2000 jd = date.jd ``` -------------------------------- ### Compute Satellite Position using Orbit Class Source: https://context7.com/arthurdjn/gnsstools/llms.txt The Orbit class is used to compute satellite ECEF coordinates from broadcast ephemeris. It solves Kepler's equation and applies necessary corrections. ```python from gnsstools import Orbit, rinex, gnsstime # Load navigation data and create orbit object df_nav = rinex.load("data/BRDC00IGS_R_20182850000_01D_MN.rnx") ``` -------------------------------- ### gnsstime Class Source: https://context7.com/arthurdjn/gnsstools/llms.txt The gnsstime class handles GNSS-specific time conversions, supporting various input formats and providing access to temporal properties like day of year, week of year, and GPS-based time offsets. ```APIDOC ## gnsstime Class ### Description Provides GNSS-specific time conversions and properties. Extends Python's datetime to handle GPS time, Julian Day, and Modified Julian Day. ### Parameters - **year** (int/str) - Required - Year (2 or 4 digits) - **month** (int/str) - Required - Month - **day** (int/str) - Required - Day - **hour** (int/str/float) - Required - Hour - **minute** (int/str/float) - Required - Minute - **second** (int/str/float) - Required - Second ### Response - **doy** (int) - Day of year - **woy** (int) - Week of year - **sod** (float) - Seconds elapsed in current day - **sow** (float) - Seconds elapsed in current week - **jd** (float) - Julian Day - **mjd** (float) - Modified Julian Day ``` -------------------------------- ### Orbit.get_sat_coords - Compute Satellite Position Source: https://context7.com/arthurdjn/gnsstools/llms.txt Computes satellite ECEF coordinates from broadcast ephemeris using Keplerian orbital mechanics. ```APIDOC ## Orbit.get_sat_coords - Compute Satellite Position ### Description The Orbit class computes satellite ECEF coordinates from broadcast ephemeris using Keplerian orbital mechanics. It solves Kepler's equation iteratively and applies all necessary corrections. ### Method `get_sat_coords(sat, date)` ### Parameters #### Path Parameters None #### Query Parameters - **sat** (Satellite Object) - Required - A satellite object (GPS, GLONASS, or GALILEO) containing ephemeris data. - **date** (gnsstime) - Required - The specific time for which to compute the satellite position. ### Request Example ```python from gnsstools import Orbit, rinex, gnsstime # Load navigation data and create orbit object df_nav = rinex.load("data/BRDC00IGS_R_20182850000_01D_MN.rnx") # Select a satellite (e.g., GPS PRN 2) date = gnsstime(2018, 10, 12, 0, 40, 15) gps_sat = df_nav.select(system="G", prn=2, date=date) # Compute satellite position orbit = Orbit() position = orbit.get_sat_coords(gps_sat, date) print(f"Satellite ECEF Coordinates: {position}") ``` ### Response #### Success Response (200) Returns a tuple containing the satellite's ECEF coordinates (x, y, z) in meters. #### Response Example ``` (1234567.89, -2345678.90, 3456789.01) ``` ``` -------------------------------- ### NavigationDataFrame.select - Select Satellite Ephemeris Source: https://context7.com/arthurdjn/gnsstools/llms.txt Retrieves ephemeris data for a specific satellite and time. Supports GPS, GLONASS, and Galileo systems. An option to ignore time offset checks is available. ```APIDOC ## NavigationDataFrame.select - Select Satellite Ephemeris ### Description The `select` method on NavigationDataFrame retrieves ephemeris data for a specific satellite and time, returning a satellite object (GPS, GLONASS, or GALILEO) with all orbital parameters needed for position computation. ### Method `select(system, prn, date, ignore_offset=False)` ### Parameters #### Path Parameters None #### Query Parameters - **system** (str) - Required - Satellite system ('G' for GPS, 'R' for GLONASS, 'E' for Galileo). - **prn** (int) - Required - Pseudo-Random Noise code of the satellite. - **date** (gnsstime) - Required - The specific time for which to select the ephemeris. - **ignore_offset** (bool) - Optional - If True, ignores the time offset check (default is False). ### Request Example ```python from gnsstools import rinex, gnsstime # Load navigation data df_nav = rinex.load("data/BRDC00IGS_R_20182850000_01D_MN.rnx") # Select GPS satellite PRN 2 at specific time date = gnsstime(2018, 10, 12, 0, 40, 15) gps_sat = df_nav.select(system="G", prn=2, date=date) print(gps_sat) # Access orbital parameters directly print(f"Semi-major axis sqrt: {gps_sat.sqrt_a}") print(f"Eccentricity: {gps_sat.e}") print(f"Mean anomaly M0: {gps_sat.m0}") print(f"Inclination i0: {gps_sat.i0}") # Select GLONASS satellite glonass_sat = df_nav.select(system="R", prn=5, date=date) # Select Galileo satellite galileo_sat = df_nav.select(system="E", prn=11, date=date) # Ignore time offset check sat = df_nav.select(system="G", prn=2, date=date, ignore_offset=True) ``` ### Response #### Success Response (200) Returns a satellite object (GPS, GLONASS, or GALILEO) containing ephemeris and clock correction parameters. #### Response Example ``` GPS( system: G prn: 2 toc: 2018-10-12 00:00:00 [UTC] (Time Of Clock) sv_clock_bias: -1.234567e-04 [s] sqrt_a: 5.153682e+03 [sqrt(m)] e: 1.234567e-02 (Eccentricity) ... ) ``` ``` -------------------------------- ### Trilateration for Receiver Position Source: https://context7.com/arthurdjn/gnsstools/llms.txt Implements iterative least-squares trilateration to compute receiver position in ECEF coordinates from satellite positions and pseudorange observations. Includes receiver clock bias estimation. Requires numpy. ```python import numpy as np from gnsstools import Trilateration # Satellite positions in ECEF coordinates [m] sat_coords = np.array([ [15600000.0, 7540000.0, 20140000.0], # Satellite 1 [-18760000.0, 14630000.0, 8090000.0], # Satellite 2 [17610000.0, -16370000.0, 840000.0], # Satellite 3 [-5740000.0, -19850000.0, 14490000.0], # Satellite 4 [10230000.0, 18640000.0, 12520000.0], # Satellite 5 ]) # Pseudorange observations [m] distances = np.array([ 21027745.23, 23629193.48, 20437567.12, 22142012.89, 20892534.67 ]) # Initial receiver position estimate rec_coords_init = np.array([0.0, 0.0, 0.0]) # Create trilateration solver trilat = Trilateration( sat_coords=sat_coords, distances=distances, rec_coords=rec_coords_init, cdt=0, # Initial clock bias * c estimate sigma=1 # Observation variance ) # Solve for receiver position rec_coords, cdt = trilat.optimize(max_steps=20, epsilon=1e-6) # Or equivalently: rec_coords, cdt = trilat() X_rec, Y_rec, Z_rec = rec_coords clock_bias = cdt / 299792458.0 # Convert c*dt to seconds print(f"Receiver Position (ECEF):") print(f" X: {X_rec:.3f} m") print(f" Y: {Y_rec:.3f} m") print(f" Z: {Z_rec:.3f} m") print(f" Clock Bias: {clock_bias:.9f} s") # Access solution statistics print(f"Variance factor: {trilat.sigma0_2:.6f}") print(f"Covariance matrix:\n{trilat.Qx}") print(f"Residuals:\n{trilat.v.flatten()}") ``` -------------------------------- ### GLONASS Satellite Class Source: https://context7.com/arthurdjn/gnsstools/llms.txt Represents GLONASS satellite data using Cartesian position/velocity state vectors. ```APIDOC ## GLONASS Satellite Class ### Description The GLONASS class represents GLONASS satellite data using Cartesian position/velocity state vectors rather than Keplerian elements. ### Fields - **prn** (int) - Satellite number. - **toc** (gnsstime) - Time Of Clock. - **sv_clock_bias** (float) - Satellite clock bias [s]. - **sv_rel_freq_bias** (float) - Relative frequency bias [Hz]. - **message_frame_time** (float) - Time interval between two consecutive measurement data. - **x** (float) - Position X [km]. - **dx** (float) - Velocity X [km/s]. - **dx2** (float) - Acceleration X [km/s^2]. - **health** (int) - Satellite health status. - **y** (float) - Position Y [km]. - **dy** (float) - Velocity Y [km/s]. - **dy2** (float) - Acceleration Y [km/s^2]. - **freq_num** (int) - Frequency number. - **z** (float) - Position Z [km]. - **dz** (float) - Velocity Z [km/s]. - **dz2** (float) - Acceleration Z [km/s^2]. - **age_op_info** (int) - Age of operation information. ### Request Example ```python from gnsstools.satellites import GLONASS from gnsstools import gnsstime # Create GLONASS satellite with state vectors glonass = GLONASS( prn=5, toc=gnsstime(2018, 10, 12, 0, 15, 0), sv_clock_bias=-1.234567e-04, sv_rel_freq_bias=1.234e-12, message_frame_time=54900.0, x=12345.678, # Position X [km] dx=1.234567, # Velocity X [km/s] dx2=0.0, # Acceleration X [km/s2] health=0, y=-23456.789, # Position Y [km] dy=-2.345678, # Velocity Y [km/s] dy2=0.0, freq_num=1, z=8765.432, # Position Z [km] dz=3.456789, # Velocity Z [km/s] dz2=0.0, age_op_info=0 ) print(f"System: {glonass.system}") # 'R' print(f"Position: ({glonass.x}, {glonass.y}, {glonass.z}) km") print(f"Velocity: ({glonass.dx}, {glonass.dy}, {glonass.dz}) km/s") ``` ### Response #### Success Response (200) Returns a GLONASS satellite object with its state vectors and clock correction parameters. #### Response Example ``` GLONASS( prn: 5 toc: 2018-10-12 00:15:00 [UTC] sv_clock_bias: -1.234567e-04 [s] sv_rel_freq_bias: 1.234e-12 [Hz] message_frame_time: 54900.0 [s] x: 12345.678 [km] dx: 1.234567 [km/s] dx2: 0.0 [km/s2] health: 0 y: -23456.789 [km] dy: -2.345678 [km/s] dy2: 0.0 [km/s2] freq_num: 1 z: 8765.432 [km] dz: 3.456789 [km/s] dz2: 0.0 [km/s2] age_op_info: 0 ) ``` ``` -------------------------------- ### GALILEO Satellite Class Source: https://context7.com/arthurdjn/gnsstools/llms.txt Represents Galileo satellite ephemeris data, including Galileo-specific fields. ```APIDOC ## GALILEO Satellite Class ### Description The GALILEO class represents Galileo satellite ephemeris with orbital parameters similar to GPS but with Galileo-specific fields. ### Fields - **prn** (int) - Pseudo-Random Noise code of the satellite. - **toc** (gnsstime) - Time Of Clock. - **sv_clock_bias** (float) - Satellite clock bias [s]. - **sv_clock_drift** (float) - Satellite clock drift rate [s/s]. - **sv_clock_drift_rate** (float) - Satellite clock drift rate acceleration [s/s^2]. - **iod_nav** (int) - Issue of Data (Navigation). - **crs** (float) - Cosine of the orbit radius argument correction [m]. - **delta_n** (float) - Mean motion difference from computed mean motion [rad/s]. - **m0** (float) - Mean anomaly at reference time [rad]. - **cuc** (float) - Cosine of the argument of latitude correction [rad]. - **e** (float) - Eccentricity. - **cus** (float) - Sine of the argument of latitude correction [rad]. - **sqrt_a** (float) - Square root of the semi-major axis [sqrt(m)]. - **toe** (float) - Time of ephemeris reference [s]. - **cic** (float) - Cosine of the inclination angle correction [rad]. - **omega0** (float) - Argument of longitude of the ascending node [rad]. - **cis** (float) - Sine of the inclination angle correction [rad]. - **i0** (float) - Inclination angle at reference time [rad]. - **crc** (float) - Cosine of the orbit radius correction [m]. - **omega** (float) - Argument of perigee [rad]. - **omega_dot** (float) - Rate of right ascension of the ascending node [rad/s]. - **idot** (float) - Rate of inclination angle [rad/s]. - **gal_week** (int) - Galileo week number. - **sisa** (float) - Signal in Space Accuracy [m]. - **sv_health** (int) - Satellite health status. - **bgd_e5a** (float) - Broadcast Group Delay E5a/E1 [s]. - **bgd_e5b** (float) - Broadcast Group Delay E5b/E1 [s]. ### Request Example ```python from gnsstools.satellites import GALILEO from gnsstools import gnsstime # Create Galileo satellite with orbital parameters galileo = GALILEO( prn=11, toc=gnsstime(2018, 10, 12, 0, 0, 0), sv_clock_bias=-1.234567e-04, sv_clock_drift=1.234567e-11, sv_clock_drift_rate=0.0, iod_nav=123, # Issue of Data (Navigation) crs=12.34, delta_n=4.567e-09, m0=1.234567, cuc=1.234e-06, e=0.0123456, cus=5.678e-06, sqrt_a=5440.602, toe=432000.0, cic=1.234e-07, omega0=2.345678, cis=5.678e-08, i0=0.9876543, crc=234.56, omega=1.234567, omega_dot=-8.123e-09, idot=1.234e-10, gal_week=1024, sisa=3.12, # Signal in Space Accuracy sv_health=0, bgd_e5a=-1.234e-09, # Broadcast Group Delay E5a/E1 bgd_e5b=-2.345e-09 # Broadcast Group Delay E5b/E1 ) print(f"System: {galileo.system}") # 'E' print(f"SISA: {galileo.sisa} m") ``` ### Response #### Success Response (200) Returns a GALILEO satellite object with its ephemeris and clock correction parameters. #### Response Example ``` GALILEO( prn: 11 toc: 2018-10-12 00:00:00 [UTC] sv_clock_bias: -1.234567e-04 [s] sv_clock_drift: 1.234567e-11 [s/s] sv_clock_drift_rate: 0.0 [s/s2] iod_nav: 123 crs: 12.34 [m] delta_n: 4.567e-09 [rad/s] m0: 1.234567 [rad] cuc: 1.234e-06 [rad] e: 0.0123456 cus: 5.678e-06 [rad] sqrt_a: 5440.602 [sqrt(m)] toe: 432000.0 [s] cic: 1.234e-07 [rad] omega0: 2.345678 [rad] cis: 5.678e-08 [rad] i0: 0.9876543 [rad] crc: 234.56 [m] omega: 1.234567 [rad] omega_dot: -8.123e-09 [rad/s] idot: 1.234e-10 [rad/s] gal_week: 1024 sisa: 3.12 [m] sv_health: 0 bgd_e5a: -1.234e-09 [s] bgd_e5b: -2.345e-09 [s] ) ``` ```