### Install GeoRinex (Development Version) Source: https://github.com/geospace-code/georinex/blob/main/README.md Clone the repository and install the development version of GeoRinex in editable mode. ```sh git clone https://github.com/geospace-code/georinex python -m pip install -e ./georinex ``` -------------------------------- ### Install GeoRinex (Stable Release) Source: https://github.com/geospace-code/georinex/blob/main/README.md Install the latest stable release of GeoRinex using pip. ```sh pip install georinex ``` -------------------------------- ### Get RINEX File Times (CLI) Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Prints the start and stop times, along with the measurement interval, for a given RINEX file or all RINEX files in a directory using the command line interface. ```sh python -m georinex.gtime ~/my.rnx ``` ```sh python -m georinex.gtime ~/data *.rnx ``` -------------------------------- ### GeoRinex Command-Line Interface Examples Source: https://context7.com/geospace-code/georinex/llms.txt GeoRinex provides CLI modules for common operations without writing Python code. Examples include reading files, plotting specific data, batch conversion, and loading receiver locations. ```bash # Read and print a single RINEX file (OBS or NAV, any version/compression) python -m georinex.read myrinex.10o # Read and plot L1C for GPS, specific time window python -m georinex.read myrinex.rnx.gz -use G -meas L1C -p \ --tlim 2018-07-29T00:00 2018-07-29T06:00 # Strict (non-speculative) mode for files that cause fast-mode errors python -m georinex.read myrinex.10o -strict # Read with LLI/SSI indicators python -m georinex.read myrinex.10o -useindicators # Print all timestamps in a file or directory python -m georinex.gtime ~/my.rnx python -m georinex.gtime ~/data "*.rnx" # Batch convert a directory of RINEX files to NetCDF4 python -m georinex.rinex2hdf5 ~/data "*o" -o ~/data # Read a previously converted NetCDF4 file python -m georinex.read ~/data/myrinex.10o.nc # Load and plot receiver locations from all RINEX/NC files in a directory python -m georinex.loc ~/data ``` -------------------------------- ### Print Time Information for Multiple Files Source: https://github.com/geospace-code/georinex/blob/main/Readme_NAV.md Prints the start time, stop time, and measurement interval for all NAV RINEX files in a specified directory using the command line. ```sh python -m georinex.gtime ~/data *.rnx ``` -------------------------------- ### Print Time Information for Single File Source: https://github.com/geospace-code/georinex/blob/main/Readme_NAV.md Prints the start time, stop time, and measurement interval for a single NAV RINEX file using the command line. ```sh python -m georinex.gtime ~/my.rnx ``` -------------------------------- ### Run GeoRinex Selftest Source: https://github.com/geospace-code/georinex/blob/main/README.md Execute the selftest suite using pytest to verify the system setup. ```sh python -m pytest ``` -------------------------------- ### Get RINEX Header Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Retrieves the header information from a RINEX file as a dictionary. ```python hdr = gr.rinexheader('myfile.rnx') ``` -------------------------------- ### Analyze RINEX Data with xarray Source: https://context7.com/geospace-code/georinex/llms.txt GeoRinex readers return `xarray.Dataset` objects, enabling rich analysis with Pandas/Xarray selectors. Examples include selecting specific satellites, time ranges, converting to Pandas DataFrames, saving to NetCDF4, and concatenating multiple files. ```python import georinex as gr import xarray import numpy as np obs = gr.load('tests/demo.10o') # --- Select a specific satellite --- g01 = obs.sel(sv='G01').dropna(dim='time', how='all') # --- Select a time range --- subset = obs.sel(time=slice('2010-04-01T00:00', '2010-04-01T01:00')) # --- Convert to Pandas DataFrame (2-D reshaped) --- df = obs['L1'].to_dataframe() # Access specific SV: df.loc['G12'].dropna() (MultiIndex) # --- Save result to NetCDF4 for fast later reloads --- obs.to_netcdf('processed.nc', group='OBS') # --- Load back with xarray directly --- obs_back = xarray.open_dataset('processed.nc', group='OBS') # --- Concatenate data from two OBS files --- obs1 = gr.load('day1.rnx') obs2 = gr.load('day2.rnx') combined = xarray.concat((obs1, obs2), dim='time') # or more flexibly: merged = xarray.merge((obs1, obs2)) ``` -------------------------------- ### Get Epoch Times from NAV RINEX Source: https://github.com/geospace-code/georinex/blob/main/Readme_NAV.md Retrieves a vector of datetime objects representing the epochs (Time of Clock) from a NAV RINEX file. ```python times = gr.gettimes('~/my.rnx') ``` -------------------------------- ### Access Receiver ECEF Position and Compute Geodetic Coordinates Source: https://context7.com/geospace-code/georinex/llms.txt Converts receiver's Earth-Centered, Earth-Fixed (ECEF) coordinates to geodetic latitude, longitude, and altitude using the pymap3d library. Ensure pymap3d is installed and the observation data contains a 'position' attribute in ECEF format. ```python import pymap3d ecef = obs.attrs['position'] # [X, Y, Z] meters lat, lon, alt = pymap3d.ecef2geodetic(*ecef) ``` -------------------------------- ### Command-Line Interface Source: https://context7.com/geospace-code/georinex/llms.txt GeoRinex provides several CLI modules for common operations without writing Python code. ```APIDOC ## Command-Line Interface GeoRinex provides several CLI modules for common operations without writing Python code. ### Usage Examples ```bash # Read and print a single RINEX file (OBS or NAV, any version/compression) python -m georinex.read myrinex.10o # Read and plot L1C for GPS, specific time window python -m georinex.read myrinex.rnx.gz -use G -meas L1C -p \ --tlim 2018-07-29T00:00 2018-07-29T06:00 # Strict (non-speculative) mode for files that cause fast-mode errors python -m georinex.read myrinex.10o -strict # Read with LLI/SSI indicators python -m georinex.read myrinex.10o -useindicators # Print all timestamps in a file or directory python -m georinex.gtime ~/my.rnx python -m georinex.gtime ~/data "*.rnx" # Batch convert a directory of RINEX files to NetCDF4 python -m georinex.rinex2hdf5 ~/data "*o" -o ~/data # Read a previously converted NetCDF4 file python -m georinex.read ~/data/myrinex.10o.nc # Load and plot receiver locations from all RINEX/NC files in a directory python -m georinex.loc ~/data ``` ``` -------------------------------- ### Load RINEX OBS, NAV, or SP3 files with gr.load() Source: https://context7.com/geospace-code/georinex/llms.txt The `gr.load()` function is a universal loader that auto-detects file type, version, and compression. It can filter data by time, satellite system, and measurement type, and supports conversion to NetCDF4. ```python import georinex as gr from datetime import datetime # --- Load a RINEX 2 OBS file (plain ASCII) --- obs = gr.load('tests/demo.10o') print(obs) # # Dimensions: (time: 40, sv: 13) # Coordinates: # * time (time) datetime64[ns] 2010-... # * sv (sv) # Dimensions: (time: 96, sv: 32, ECEF: 3) # Data variables: # position (time, sv, ECEF) float64 [km] # clock (time, sv) float64 [microseconds] # velocity (time, sv, ECEF) float64 [dm/s] # dclock (time, sv) float64 clock rate-of-change # t0 datetime reference epoch # --- Access ECEF position for GPS satellite G01 --- g01_pos = sp3['position'].sel(sv='G01') print(g01_pos) # shape (time, 3) in km # --- Save to NetCDF4 --- sp3 = gr.load_sp3(Path('tests/igs19362.sp3c'), outfn=Path('/tmp/sp3out.nc')) # --- Access metadata --- print(sp3.attrs['coord_sys']) # e.g. 'IGS14' print(sp3.attrs['orbit_type']) # e.g. 'FIT' print(sp3.attrs['agency']) # e.g. 'IGS' ``` -------------------------------- ### Load NAV RINEX File Source: https://github.com/geospace-code/georinex/blob/main/Readme_NAV.md Loads a RINEX 2 or 3 NAV file into an xarray.Dataset. The dataset is indexed by time and quantity. ```python nav = gr.load('tests/demo_MN.rnx') ``` -------------------------------- ### Batch Convert RINEX to NetCDF4 (Command Line) Source: https://github.com/geospace-code/georinex/blob/main/README.md Perform batch conversion of RINEX files to NetCDF4/HDF5 format. The output filename will have a .nc suffix appended. ```sh python -m georinex.rinex2hdf5 ~/data "*o" -o ~/data ``` -------------------------------- ### Working with xarray Output Source: https://context7.com/geospace-code/georinex/llms.txt All GeoRinex readers return `xarray.Dataset` objects, enabling rich analysis with Pandas/Xarray selectors. ```APIDOC ## Working with xarray Output All GeoRinex readers return `xarray.Dataset` objects, enabling rich analysis with Pandas/Xarray selectors. ### Usage Examples ```python import georinex as gr import xarray import numpy as np obs = gr.load('tests/demo.10o') # --- Select a specific satellite --- g01 = obs.sel(sv='G01').dropna(dim='time', how='all') # --- Select a time range --- subset = obs.sel(time=slice('2010-04-01T00:00', '2010-04-01T01:00')) # --- Convert to Pandas DataFrame (2-D reshaped) --- df = obs['L1'].to_dataframe() # Access specific SV: df.loc['G12'].dropna() (MultiIndex) # --- Save result to NetCDF4 for fast later reloads --- obs.to_netcdf('processed.nc', group='OBS') # --- Load back with xarray directly --- obs_back = xarray.open_dataset('processed.nc', group='OBS') # --- Concatenate data from two OBS files --- obs1 = gr.load('day1.rnx') obs2 = gr.load('day2.rnx') combined = xarray.concat((obs1, obs2), dim='time') # or more flexibly: merged = xarray.merge((obs1, obs2)) ``` ``` -------------------------------- ### Benchmark RINEX OBS File Processing Source: https://github.com/geospace-code/georinex/blob/main/README.md Measure the time taken to process a RINEX OBS file using the command line. Useful for understanding performance characteristics. ```shell time python -m georinex.read tests/CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz -u E ``` ```shell time python -m georinex.read tests/CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz -u E -m C1C ``` -------------------------------- ### Profile georinex.load Function Source: https://github.com/geospace-code/georinex/blob/main/README.md Profile the performance of the georinex.load function using line_profiler. This helps identify performance bottlenecks within the code. ```python %load_ext line_profiler %lprun -f gr.obs3._epoch gr.load('tests/CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz', use='E', meas='C1C') ``` -------------------------------- ### Extract All Timestamps from RINEX Files Source: https://context7.com/geospace-code/georinex/llms.txt Use `gr.gettime()` to retrieve all epoch timestamps from RINEX OBS or NAV files without loading the entire dataset. This is useful for quickly checking the time coverage of a file. ```python import georinex as gr # --- Get all times in a RINEX 2 OBS file --- times = gr.gettime('tests/demo.10o') print(times) # array(['2010-...', '2010-...', ...], dtype='datetime64[ms]') # --- Get times from a RINEX 3 NAV file --- times = gr.gettime('tests/CEDA00USA_R_20182100000_01D_MN.rnx.gz') print(f"First epoch: {times[0]}") print(f"Last epoch: {times[-1]}") print(f"Number of epochs: {len(times)}") ``` -------------------------------- ### Boolean Indexing for Satellite System Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Creates a boolean indexer to filter data for a specific satellite system (e.g., Galileo 'E') after the data has already been loaded. This method is useful for post-hoc filtering. ```python Eind = obs.sv.to_index().str.startswith('E') # returns a simple Numpy Boolean 1-D array Edata = obs.isel(sv=Eind) # any combination of other indices at same time or before/after also possible ``` -------------------------------- ### Inspect RINEX/SP3 File Metadata Source: https://context7.com/geospace-code/georinex/llms.txt Returns a dictionary of metadata (version, filetype, systems) for RINEX or SP3 files without reading all the data. Works for original files and NetCDF4 converted files. ```python import georinex as gr # --- Inspect a RINEX 3 OBS file --- info = gr.rinexinfo('tests/CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz') print(info) # {'version': 3.03, 'filetype': 'O', 'rinextype': 'obs', 'systems': 'M'} # --- Inspect a RINEX 2 GPS NAV file --- info = gr.rinexinfo('tests/demo.10n') print(info) # {'version': 2.1, 'filetype': 'N', 'rinextype': 'nav', 'systems': 'G'} # --- Inspect a NetCDF4 converted file --- info = gr.rinexinfo('tests/data/demo_nav3.17n.nc') print(info['rinextype']) # 'nav' or 'obs' or ['nav', 'obs'] ``` -------------------------------- ### Concatenate OBS Data from Multiple Files (Python) Source: https://github.com/geospace-code/georinex/blob/main/README.md Combine observation data from multiple xarray.Dataset objects along the 'time' dimension using xarray.concat. ```python import xarray # Assuming obs1 and obs2 are loaded xarray.Datasets obs = xarray.concat((obs1, obs2), dim='time') ``` -------------------------------- ### gr.batch_convert() — Batch RINEX to NetCDF4 Conversion Source: https://context7.com/geospace-code/georinex/llms.txt Converts all matching RINEX files in a directory to NetCDF4/HDF5 format in one call. Errors on individual files are logged and skipped so the batch continues. ```APIDOC ## `gr.batch_convert()` — Batch RINEX to NetCDF4 Conversion Converts all matching RINEX files in a directory to NetCDF4/HDF5 format in one call. Errors on individual files are logged and skipped so the batch continues. ### Parameters - **path** (Path): Directory containing RINEX files. - **glob** (str): Glob pattern to match RINEX files (e.g., '*o', '*.rnx.gz'). - **out** (Path): Directory to save converted NetCDF4 files. - **use** (set, optional): Set of satellite systems to use (e.g., {'G', 'R'}). Defaults to None (all systems). - **meas** (list, optional): List of measurements to include (e.g., ['C1C', 'L1C']). Defaults to None (all measurements). - **tlim** (tuple, optional): Time limit for reading data, as (start_time, end_time). - **verbose** (bool, optional): Whether to print verbose output. Defaults to False. ### Examples ```python import georinex as gr from pathlib import Path from datetime import datetime # Convert all RINEX 2 OBS files in ~/data to NetCDF4 in the same directory gr.batch_convert( path=Path('~/data'), glob='*o', out=Path('~/data'), ) # Convert only GPS+GLONASS, specific measurements, time-limited gr.batch_convert( path=Path('~/rinex'), glob='*.rnx.gz', out=Path('~/netcdf'), use={'G', 'R'}, meas=['C1C', 'L1C'], tlim=(datetime(2018, 1, 1), datetime(2018, 1, 2)), verbose=True, ) ``` ``` -------------------------------- ### Load RINEX OBS File Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Loads a RINEX 2 or 3 OBS file into an xarray.Dataset. Use .dropna(dim='time', how='all') to remove rows with no observable data. ```python import georinex as gr obs = gr.load('tests/demo_MO.rnx') ``` -------------------------------- ### Load RINEX Data with Time Limits (Python) Source: https://github.com/geospace-code/georinex/blob/main/README.md Load RINEX data within specified time bounds using the gr.load function. Time limits are formatted as 'YYYY-MM-DDTHH:MM'. ```python import georinex as gr dat = gr.load('my.rnx', tlim=['2017-02-23T12:59', '2017-02-23T13:13']) ``` -------------------------------- ### gr.rinexinfo() — File Metadata Inspector Source: https://context7.com/geospace-code/georinex/llms.txt Returns a dict of metadata about a RINEX/SP3 file (version, type, satellite systems) without reading all the data. ```APIDOC ## `gr.rinexinfo()` — File Metadata Inspector Returns a dict of metadata about a RINEX/SP3 file (version, type, satellite systems) without reading all the data. ### Parameters - **fn** (str or Path): Path to the RINEX or SP3 file. ### Returns - **dict**: A dictionary containing file metadata. ### Examples ```python import georinex as gr # Inspect a RINEX 3 OBS file info = gr.rinexinfo('tests/CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz') print(info) # {'version': 3.03, 'filetype': 'O', 'rinextype': 'obs', 'systems': 'M'} # Inspect a RINEX 2 GPS NAV file info = gr.rinexinfo('tests/demo.10n') print(info) # {'version': 2.1, 'filetype': 'N', 'rinextype': 'nav', 'systems': 'G'} # Inspect a NetCDF4 converted file info = gr.rinexinfo('tests/data/demo_nav3.17n.nc') print(info['rinextype']) # 'nav' or 'obs' or ['nav', 'obs'] ``` ``` -------------------------------- ### Read Converted NetCDF RINEX Data (Command Line) Source: https://github.com/geospace-code/georinex/blob/main/README.md Read RINEX data that has already been converted to NetCDF format using the command line. ```sh python -m georinex.read myrinex.nc ``` -------------------------------- ### gr.gettime() Source: https://context7.com/geospace-code/georinex/llms.txt Retrieves the array of all epoch timestamps present in a RINEX OBS or NAV file without loading the full dataset. ```APIDOC ## `gr.gettime()` — Extract All Timestamps Retrieves the array of all epoch timestamps present in a RINEX OBS or NAV file without loading the full dataset. ### Usage ```python import georinex as gr # --- Get all times in a RINEX 2 OBS file --- times = gr.gettime('tests/demo.10o') print(times) # array(['2010-...', '2010-...', ...], dtype='datetime64[ms]') # --- Get times from a RINEX 3 NAV file --- times = gr.gettime('tests/CEDA00USA_R_20182100000_01D_MN.rnx.gz') print(f"First epoch: {times[0]}") print(f"Last epoch: {times[-1]}") print(f"Number of epochs: {len(times)}") ``` ### Command-line equivalent ```bash python -m georinex.gtime ~/my.rnx python -m georinex.gtime ~/data "*.rnx" # batch over a directory ``` ``` -------------------------------- ### gr.globber() Source: https://context7.com/geospace-code/georinex/llms.txt Finds RINEX files in a directory matching a glob pattern, returning a sorted list of `Path` objects. ```APIDOC ## `gr.globber()` — RINEX File Glob Helper Finds RINEX files in a directory matching a glob pattern, returning a sorted list of `Path` objects. ### Usage ```python import georinex as gr from pathlib import Path # --- Find all RINEX OBS files in a directory --- files = gr.globber(Path('~/data'), '*o') for f in files: print(f) # --- Find all compressed RINEX files --- files = gr.globber(Path('~/data'), '*.rnx.gz') obs_list = [gr.load(f) for f in files] ``` ``` -------------------------------- ### Load Specific Satellite System Data Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Loads only data for a specified satellite system (e.g., Galileo 'E') directly during file loading. This can also be done via the command line using the -use parameter. ```python import georinex as gr obs = gr.load('myfile.o', use='E') ``` -------------------------------- ### Extract Times from RINEX File (Command Line) Source: https://github.com/geospace-code/georinex/blob/main/README.md Extract and display timestamps from a RINEX file using the georinex.gtime script. Useful for debugging file reading issues. ```sh python -m georinex.gtime myrinex.XXx ``` -------------------------------- ### gr.rinexnav() — NAV File Reader Source: https://context7.com/geospace-code/georinex/llms.txt Reads RINEX 2 or 3 Navigation/Ephemeris files and returns an xarray.Dataset with Keplerian and clock parameters indexed by (time, sv). ```APIDOC ## `gr.rinexnav()` — NAV File Reader Reads RINEX 2 or 3 Navigation/Ephemeris files and returns an `xarray.Dataset` with Keplerian and clock parameters indexed by `(time, sv)`. ### Parameters - **fn** (str or Path): Path to the RINEX NAV file. - **use** (set, optional): Set of satellite systems to use (e.g., {'G', 'E'}). Defaults to None (all systems). - **tlim** (tuple, optional): Time limit for reading data, as (start_time, end_time). - **outfn** (str or Path, optional): Path to save the converted data in NetCDF4 format. - **overwrite** (bool, optional): Whether to overwrite existing output file. Defaults to False. ### Returns - **xarray.Dataset**: Dataset containing Keplerian and clock parameters. ### Examples ```python import georinex as gr from datetime import datetime from pathlib import Path # Read RINEX 2 GPS NAV file nav = gr.rinexnav('tests/demo.10n') print(nav) # Read RINEX 3 mixed-constellation NAV file, GPS + Galileo only nav = gr.rinexnav( 'tests/CEDA00USA_R_20182100000_01D_MN.rnx.gz', use={'G', 'E'}, tlim=(datetime(2018, 7, 29, 0, 0), datetime(2018, 7, 29, 6, 0)), ) # Select specific satellite g13 = nav.sel(sv='G13') print(g13['M0']) # Access ionospheric correction coefficients (GPS Klobuchar) print(nav.attrs.get('ionospheric_corr_GPS')) # Save to NetCDF4 nav = gr.rinexnav('tests/demo.10n', outfn=Path('/tmp/demo_nav.nc'), overwrite=True) # Read back from NetCDF4 nav_nc = gr.rinexnav('/tmp/demo_nav.nc') ``` ``` -------------------------------- ### Batch Convert RINEX to NetCDF4 Source: https://context7.com/geospace-code/georinex/llms.txt Converts multiple RINEX files in a directory to NetCDF4 format. Allows filtering by file glob pattern, constellation, measurements, and time limits. Errors are logged and skipped. ```python import georinex as gr from pathlib import Path # --- Convert all RINEX 2 OBS files in ~/data to NetCDF4 in the same directory --- gr.batch_convert( path=Path('~/data'), glob='*o', # matches *.10o, *.18o, etc. out=Path('~/data'), ) # Each file "my.15o" produces "my.15o.nc" # --- Convert only GPS+GLONASS, specific measurements, time-limited --- from datetime import datetime gr.batch_convert( path=Path('~/rinex'), glob='*.rnx.gz', out=Path('~/netcdf'), use={'G', 'R'}, meas=['C1C', 'L1C'], tlim=(datetime(2018, 1, 1), datetime(2018, 1, 2)), verbose=True, ) ``` -------------------------------- ### Load Specific Measurements Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Increases reading speed by specifying only the desired measurements (e.g., 'C1C', 'L1C') to be loaded from the RINEX file. ```sh --meas C1C L1C ``` ```python dat = gr.load('my.rnx', meas=['C1C', 'L1C']) ``` -------------------------------- ### Plot L1C for All Satellites Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Generates a plot of L1C measurements for all satellites over time using matplotlib. Requires importing figure and show. ```python from matplotlib.pyplot import figure, show ax = figure().gca() ax.plot(obs.time, obs['L1C']) show() ``` -------------------------------- ### Select Measurement Data Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Selects a specific measurement type (e.g., 'L1') across all satellites and time. Can also be indexed by time and/or satellite. ```python obs['L1'].dropna(dim='time',how='all') ``` -------------------------------- ### geo.get_locations() Source: https://context7.com/geospace-code/georinex/llms.txt Reads a list of RINEX OBS files (or `.nc` files) and extracts the geodetic latitude, longitude, and sampling interval for each receiver into a Pandas DataFrame. ```APIDOC ## `geo.get_locations()` — Extract Receiver Geodetic Locations Reads a list of RINEX OBS files (or `.nc` files) and extracts the geodetic latitude, longitude, and sampling interval for each receiver into a Pandas DataFrame. ### Usage ```python from pathlib import Path from georinex.geo import get_locations # --- Extract lat/lon/interval from multiple RINEX OBS files --- files = list(Path('~/data').glob('*.rnx')) locs = get_locations(files) print(locs) # lat lon interval # site1.18o 37.42 -122.08 30.0 # site2.18o 51.50 -0.13 15.0 # --- Also works with pre-converted .nc files --- nc_files = list(Path('~/netcdf').glob('*.nc')) locs_nc = get_locations(nc_files) # Requires pymap3d to compute geodetic coordinates from ECEF APPROX POSITION XYZ # pip install pymap3d ``` ``` -------------------------------- ### gr.rinexheader() Source: https://context7.com/geospace-code/georinex/llms.txt Parses and returns the full RINEX file header as a Python dict without reading the data body. Useful for inspecting receiver model, approximate position, and time system. ```APIDOC ## `gr.rinexheader()` — Read RINEX Header Parses and returns the full RINEX file header as a Python dict without reading the data body. Useful for inspecting receiver model, approximate position, and time system. ### Usage ```python import georinex as gr # --- Read OBS file header --- hdr = gr.rinexheader('tests/demo.10o') print(hdr.keys()) # Receiver position (ECEF XYZ, optional field) print(hdr.get('position')) # [X, Y, Z] in meters (ECEF) print(hdr.get('position_geodetic')) # (lat_deg, lon_deg, alt_m) if pymap3d installed # Receiver model print(hdr.get('rxmodel')) # Sampling interval in seconds print(hdr.get('interval')) # Time of first observation print(hdr.get('t0')) # --- Read NAV file header --- hdr_nav = gr.rinexheader('tests/demo.10n') print(hdr_nav.get('version')) ``` ``` -------------------------------- ### Merge OBS Data from Multiple Files (Python) Source: https://github.com/geospace-code/georinex/blob/main/README.md Merge observation data from multiple xarray.Dataset objects using xarray.merge. This is a more general approach than concat and may handle different SV observation types. ```python import xarray # Assuming obs1 and obs2 are loaded xarray.Datasets obs = xarray.merge((obs1, obs2)) ``` -------------------------------- ### Read RINEX File Header Information Source: https://context7.com/geospace-code/georinex/llms.txt Use `gr.rinexheader()` to parse and return the RINEX file header as a Python dictionary. This is helpful for inspecting metadata like receiver model, approximate position, and time system without loading the data body. ```python import georinex as gr # --- Read OBS file header --- hdr = gr.rinexheader('tests/demo.10o') print(hdr.keys()) # Receiver position (ECEF XYZ, optional field) print(hdr.get('position')) # [X, Y, Z] in meters (ECEF) print(hdr.get('position_geodetic')) # (lat_deg, lon_deg, alt_m) if pymap3d installed # Receiver model print(hdr.get('rxmodel')) # Sampling interval in seconds print(hdr.get('interval')) # Time of first observation print(hdr.get('t0')) # --- Read NAV file header --- hdr_nav = gr.rinexheader('tests/demo.10n') print(hdr_nav.get('version')) ``` -------------------------------- ### Compute Median Sampling Interval from Data Source: https://context7.com/geospace-code/georinex/llms.txt Calculates the median sampling interval in seconds from observation time data. This is useful for understanding the data's temporal resolution. Assumes observation times are stored in a format compatible with numpy.diff and timedelta operations. ```python dt = np.median(np.diff(obs.time.values) / np.timedelta64(1, 's')) print(f"Sampling interval: {dt} seconds") ``` -------------------------------- ### Convert RINEX NAV to Pandas DataFrame Source: https://github.com/geospace-code/georinex/blob/main/README.md Convert RINEX navigation data into a Pandas DataFrame for easier manipulation and analysis. Supports multi-indexing for satellite selection. ```python df = nav.to_dataframe() # Select a specific satellite satellite_data = df.loc['G12'].dropna(0, 'all') ``` -------------------------------- ### Find RINEX Files with Glob Pattern Source: https://context7.com/geospace-code/georinex/llms.txt The `gr.globber()` function helps find RINEX files in a directory matching a glob pattern, returning a sorted list of `Path` objects. This is useful for batch processing or locating specific types of RINEX files. ```python import georinex as gr from pathlib import Path # --- Find all RINEX OBS files in a directory --- files = gr.globber(Path('~/data'), '*o') for f in files: print(f) # --- Find all compressed RINEX files --- files = gr.globber(Path('~/data'), '*.rnx.gz') obs_list = [gr.load(f) for f in files] ``` -------------------------------- ### Read RINEX Navigation Files Source: https://context7.com/geospace-code/georinex/llms.txt Reads RINEX 2 or 3 Navigation/Ephemeris files into an xarray.Dataset. Supports filtering by constellation and time limits. Can save to and load from NetCDF4. ```python import georinex as gr from datetime import datetime from pathlib import Path # --- Read RINEX 2 GPS NAV file --- nav = gr.rinexnav('tests/demo.10n') print(nav) # # Dimensions: (time: ..., sv: ...) # Data variables: # SVclockBias (time, sv) float64 ... # SVclockDrift (time, sv) float64 ... # Eccentricity (time, sv) float64 ... # sqrtA (time, sv) float64 ... # ... # --- Read RINEX 3 mixed-constellation NAV file, GPS + Galileo only --- nav = gr.rinexnav( 'tests/CEDA00USA_R_20182100000_01D_MN.rnx.gz', use={'G', 'E'}, tlim=(datetime(2018, 7, 29, 0, 0), datetime(2018, 7, 29, 6, 0)), ) # --- Select specific satellite --- g13 = nav.sel(sv='G13') print(g13['M0']) # Mean anomaly for G13 # --- Access ionospheric correction coefficients (GPS Klobuchar) --- print(nav.attrs.get('ionospheric_corr_GPS')) # array of 8 alpha/beta coefficients # --- Save to NetCDF4 --- nav = gr.rinexnav('tests/demo.10n', outfn=Path('/tmp/demo_nav.nc'), overwrite=True) # --- Read back from NetCDF4 --- nav_nc = gr.rinexnav('/tmp/demo_nav.nc') ``` -------------------------------- ### Save Processed Data to NetCDF4 (Python) Source: https://github.com/geospace-code/georinex/blob/main/README.md Save processed xarray.Dataset objects to NetCDF4 format for fast reloading and out-of-core processing. ```python obs.to_netcdf('process.nc', group='OBS') ``` -------------------------------- ### Read Location from NetCDF4/HDF5 using Xarray Source: https://github.com/geospace-code/georinex/blob/main/README.md Access ECEF and geodetic position data from a NetCDF4/HDF5 file using the xarray library. Assumes the file was created with georinex and potentially pymap3d. ```python obs = xarray.open_dataset('my.nc) ecef = obs.position latlon = obs.position_geodetic # only if pymap3d was used ``` -------------------------------- ### Select Satellite Data Source: https://github.com/geospace-code/georinex/blob/main/Readme_OBS.md Selects data for a specific satellite (e.g., 'G13') from a loaded xarray.Dataset. Ensure to drop time steps with no data. ```python obs.sel(sv='G13').dropna(dim='time',how='all') ``` -------------------------------- ### Access Navigation Parameter Source: https://github.com/geospace-code/georinex/blob/main/Readme_NAV.md Retrieves a specific navigation parameter (e.g., 'M0') across all satellites and times from the NAV xarray.Dataset. ```python nav['M0'] ```