1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-15 03:35:46 +00:00

Add ability to read compressed RINEX navigation files

This commit is contained in:
Carles Fernandez 2018-11-25 12:29:56 +01:00
parent b755f4a895
commit 7008e601a9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 56 additions and 6 deletions

View File

@ -26,6 +26,8 @@ endif()
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GPSTK_INCLUDE_DIR}/gpstk)
find_package(Boost COMPONENTS iostreams serialization REQUIRED)
include_directories(
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${GFlags_INCLUDE_DIRS}

View File

@ -1,7 +1,7 @@
Rinex2assist
------------
This program generates ephemeris XML files from RINEX navigation data files. The usage is as follows:
This program reads data from RINEX navigation files and generates XML files that can be read by GNSS-SDR as Assisted GNSS data. The usage is as follows:
```
$ rinex2assist /path/to/RINEX_nav_file
@ -9,16 +9,34 @@ $ rinex2assist /path/to/RINEX_nav_file
The argument is mandatory (the name of the RINEX navigation file). The name `gps_ephemeris.xml` is given to the output if GPS NAV data is fould. If the RINEX file contains Galileo data, the corresponding `gal_ephemeris.xml` file will be generated. The program is also able to extract parameters of the UTC and the Ionospheric models from the RINEX header, if available. They will be called `gps_utc_model.xml`, `gps_iono.xml`, `gal_utc_model.xml` and `gal_iono.xml`.
The program accepts either versions 2.xx or 3.xx for the RINEX navigation data file.
There are some servers available for downloading RINEX navigation files. For instance:
* NASA: [ftp://cddis.gsfc.nasa.gov/pub/gnss/data/hourly/](ftp://gssc.esa.int/gnss/data/hourly/)
* ESA: [ftp://gssc.esa.int/gnss/data/hourly/](ftp://gssc.esa.int/gnss/data/hourly/)
Just make sure to pick up a [station near you](http://gpspp.sakura.ne.jp/gmap/igsnet.htm).
An example of GNSS-SDR configuration using ephemeris and UTC and ionospheric model parameters for GPS L1 and Galileo signals is shown below:
The program accepts either versions 2.xx or 3.xx for the RINEX navigation data file, as well as compressed files (ending in `.gz`).
Examples:
```
$ rinex2assist EBRE00ESP_R_20183290400_01H_GN.rnx.gz
Generated file: gps_ephemeris.xml
Generated file: gps_utc_model.xml
Generated file: gps_iono.xml
```
and
```
$ rinex2assist EBRE00ESP_R_20183290000_01H_EN.rnx.gz
Generated file: gal_ephemeris.xml
Generated file: gal_utc_model.xml
Generated file: gal_iono.xml
```
An example of GNSS-SDR configuration using ephemeris, UTC and ionospheric model parameters for GPS L1 and Galileo signals is shown below:
```
GNSS-SDR.AGNSS_XML_enabled=true

View File

@ -42,6 +42,9 @@
#include <gpstk/Rinex3NavStream.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/serialization/map.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <iostream>
@ -70,6 +73,33 @@ int main(int argc, char** argv)
}
std::string xml_filename;
// Uncompress if RINEX file is gzipped
std::string rinex_filename(argv[1]);
std::size_t found = rinex_filename.find_last_of(".");
if (found != std::string::npos)
{
if ((rinex_filename.substr(found + 1, found + 3).compare("gz") == 0))
{
std::cerr << "Hello" << std::endl;
std::ifstream file(rinex_filename, std::ios_base::in | std::ios_base::binary);
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
try
{
in.push(boost::iostreams::gzip_decompressor());
}
catch (const boost::exception& e)
{
std::cerr << "Could not decompress file " << rinex_filename << std::endl;
return 1;
}
in.push(file);
std::string rinex_filename_unzipped = rinex_filename.substr(0, found);
std::ofstream output_file(rinex_filename_unzipped.c_str(), std::ios_base::out | std::ios_base::binary);
boost::iostreams::copy(in, output_file);
rinex_filename = rinex_filename_unzipped;
}
}
std::map<int, Gps_Ephemeris> eph_map;
std::map<int, Galileo_Ephemeris> eph_gal_map;
@ -83,7 +113,7 @@ int main(int argc, char** argv)
try
{
// Read nav file
gpstk::Rinex3NavStream rnffs(argv[1]); // Open navigation data file
gpstk::Rinex3NavStream rnffs(rinex_filename.c_str()); // Open navigation data file
gpstk::Rinex3NavData rne;
gpstk::Rinex3NavHeader hdr;