rinex.c File Reference


Detailed Description

GNSS core 'c' function library: RINEX VERSION 2.11 related functions.

Author:
Glenn D. MacGougan (GDM)
Date:
2007-12-03
Since:
2007-12-02
REFERENCES

"LICENSE INFORMATION"
Copyright (c) 2007, refer to 'author' doxygen tags
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file rinex.c.

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <memory.h>
#include <math.h>
#include "rinex.h"
#include "time_conversion.h"
#include "constants.h"

Go to the source code of this file.

Data Structures

struct  struct_RINEX_obs
 A container for a single RINEX data observation. More...
struct  struct_RINEX_satellite
 A container for a single RINEX satellite descriptor. More...

Defines

#define RINEX_HEADER_SIZE   (32768)
 The maximum size of a RINEX header buffer [bytes].
#define RINEX_LINEBUF_SIZE   (8192)
 The maximum size of a string used in RINEX decoding [bytes].
#define RINEX_MAX_NR_SATS   (64)
 The maximum array size for "struct_RINEX_satellite RINEX_sat[RINEX_MAX_NR_SATS]".
#define RINEX_MAX_NR_OBS   (64)
 The maximum array size for "struct_RINEX_obs RINEX_obs[RINEX_MAX_NR_OBS]".

Functions

BOOL RINEX_GetHeader (const char *filepath, char *buffer, const unsigned buffer_max_size, unsigned *buffer_size, double *version, RINEX_enumFileType *file_type)
 RINEX VERSION 2.11: Get the RINEX header, as a buffer, from the specified file path. Determine the RINEX version and file type.
BOOL RINEX_DecodeHeader_ObservationFile (const char *header_buffer, const unsigned header_buffer_size, RINEX_structDecodedHeader *header)
 RINEX VERSION 2.11: Decode the parts of the RINEX Observation file header that are essential to.
BOOL RINEX_GetNextObservationSet (FILE *fid, RINEX_structDecodedHeader *RINEX_header, BOOL *wasEndOfFileReached, BOOL *wasObservationFound, unsigned *filePosition, GNSS_structMeasurement *obsArray, const unsigned char maxNrObs, unsigned *nrObs, unsigned short *rx_gps_week, double *rx_gps_tow)
 RINEX VERSION 2.11: Decode the next set of observations from the RINEX Observation file. Deal with any header information changes that arise from special records.
BOOL RINEX_DecodeGPSNavigationFile (const char *filepath, GNSS_structKlobuchar *iono_model, GPS_structEphemeris *ephemeris_array, const unsigned int max_length_ephemeris_array, unsigned int *length_ephemeris_array)
 RINEX VERSION 2.11: Completely decode a RINEX GPS Navigation file into an array of GPS ephemeris structs.
BOOL RINEX_DecodeFileName (const char *filepath, char *station_name, unsigned short *dayofyear, unsigned char *file_sequence_nr, unsigned short *year, RINEX_enumFileType *filetype)
 RINEX VERSION 2.11: Decode a RINEX file name.
BOOL RINEX_GetKlobucharIonoParametersFromNavFile (const char *filepath, GNSS_structKlobuchar *iono_model)
 RINEX VERSION 2.11: Decode the ionospheric parameters from a RINEX GPS Navigation file.


Define Documentation

#define RINEX_HEADER_SIZE   (32768)

The maximum size of a RINEX header buffer [bytes].

Definition at line 48 of file rinex.c.

#define RINEX_LINEBUF_SIZE   (8192)

The maximum size of a string used in RINEX decoding [bytes].

Definition at line 49 of file rinex.c.

#define RINEX_MAX_NR_OBS   (64)

The maximum array size for "struct_RINEX_obs RINEX_obs[RINEX_MAX_NR_OBS]".

Definition at line 51 of file rinex.c.

#define RINEX_MAX_NR_SATS   (64)

The maximum array size for "struct_RINEX_satellite RINEX_sat[RINEX_MAX_NR_SATS]".

Definition at line 50 of file rinex.c.


Function Documentation

BOOL RINEX_DecodeFileName ( const char *  filepath,
char *  station_name,
unsigned short *  dayofyear,
unsigned char *  file_sequence_nr,
unsigned short *  year,
RINEX_enumFileType filetype 
)

RINEX VERSION 2.11: Decode a RINEX file name.

Author:
Glenn D. MacGougan
Date:
2007-12-06
Since:
2007-12-06
char *filepath = "c:\\data\\CGIM3280.07N";
char station_name[5];
unsigned short dayofyear = 0;
unsigned char file_sequence_nr = 0;
unsigned short year = 0;
RINEX_enumFileType filetype = RINEX_FILE_TYPE_UNKNOWN;
BOOL result = FALSE;

result = RINEX_DecodeFileName( filepath, station_name, &dayofyear, &file_sequence_nr, &year, &filetype );
// The results are
// station_name == CGIM
// dayofyear == 328
// file_sequence_nr == 0
// year == 2007
// filetype == RINEX_FILE_TYPE_OBS

Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
filepath  (input) A full filepath.
station_name  (output) A 5 character C string. char station_name[5]. In which to place the 4-character station name designator. This must be at least 5 characters.
dayofyear  (output) The day of year.
file_sequence_nr  (output) file sequence number within day. 0: file contains all the existing data of the current day.
year  (output) The full year. e.g. 1999, 2001.
filetype  (output) The RINEX file type.

Definition at line 3050 of file rinex.c.

BOOL RINEX_DecodeGPSNavigationFile ( const char *  filepath,
GNSS_structKlobuchar iono_model,
GPS_structEphemeris ephemeris_array,
const unsigned int  max_length_ephemeris_array,
unsigned int *  length_ephemeris_array 
)

RINEX VERSION 2.11: Completely decode a RINEX GPS Navigation file into an array of GPS ephemeris structs.

Author:
Glenn D. MacGougan
Date:
2007-12-06
Since:
2007-12-06
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
filepath  (input) The file path to the GPS Navigation message file.
iono_model  (input/output) A pointer to the ionospheric parameters struct.
ephemeris_array  (input/output) A pointer to the GPS ephemeris array.
max_length_ephemeris_array  (input) The maximum size of the GPS ephemeris array.
length_ephemeris_array  (input/output) The length of the GPS ephemeris array after decoding. The number of valid items.

Definition at line 2348 of file rinex.c.

BOOL RINEX_DecodeHeader_ObservationFile ( const char *  header_buffer,
const unsigned  header_buffer_size,
RINEX_structDecodedHeader header 
)

RINEX VERSION 2.11: Decode the parts of the RINEX Observation file header that are essential to.

Author:
Glenn D. MacGougan
Date:
2007-12-03
Since:
2007-12-03
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
header_buffer  (input) The character buffer containing the RINEX header.
header_buffer_size  (input) The size of the character buffer containing the RINEX header [bytes]. Not the maximum size, the size of the valid data in the buffer.
header  (output) The decoded header data.

Definition at line 1189 of file rinex.c.

BOOL RINEX_GetHeader ( const char *  filepath,
char *  buffer,
const unsigned  buffer_max_size,
unsigned *  buffer_size,
double *  version,
RINEX_enumFileType file_type 
)

RINEX VERSION 2.11: Get the RINEX header, as a buffer, from the specified file path. Determine the RINEX version and file type.

Author:
Glenn D. MacGougan
Date:
2007-12-03
Since:
2007-12-03
remarks

Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
filepath  Path to the RINEX file.
buffer  (input/output) A character buffer in which to place the RINEX header.
buffer_max_size  (input) The maximum size of the buffer [bytes]. This value should be large enough to hold the entire header, (8192 to 16384).
buffer_size  (output) The length of the header data placed in the buffer [bytes].
version  (output) The RINEX version number. e.g. 1.0, 2.0, 2.2, 3.0, etc.
file_type  (output) The RINEX file type.

Definition at line 1118 of file rinex.c.

BOOL RINEX_GetKlobucharIonoParametersFromNavFile ( const char *  filepath,
GNSS_structKlobuchar iono_model 
)

RINEX VERSION 2.11: Decode the ionospheric parameters from a RINEX GPS Navigation file.

Author:
Glenn D. MacGougan
Date:
2007-12-07
Since:
2007-12-07
char *filepath = "c:\\data\\brdc3400.07n";
GNSS_structKlobuchar iono;
BOOL result;

result = RINEX_GetKlobucharIonoParametersFromNavFile( filepath, &iono );

Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
filepath  (input) The file path to the GPS Navigation message file.
iono_model  (input/output) A pointer to the ionospheric parameters struct.

Definition at line 3158 of file rinex.c.

BOOL RINEX_GetNextObservationSet ( FILE *  fid,
RINEX_structDecodedHeader RINEX_header,
BOOL *  wasEndOfFileReached,
BOOL *  wasObservationFound,
unsigned *  filePosition,
GNSS_structMeasurement obsArray,
const unsigned char  maxNrObs,
unsigned *  nrObs,
unsigned short *  rx_gps_week,
double *  rx_gps_tow 
)

RINEX VERSION 2.11: Decode the next set of observations from the RINEX Observation file. Deal with any header information changes that arise from special records.

Author:
Glenn D. MacGougan
Date:
2007-12-06
Since:
2007-12-03
Returns:
TRUE(1) if successful, FALSE(0) otherwise.
Parameters:
fid  (input) An open (not NULL) file pointer to the RINEX data.
RINEX_header  (input/output) The decoded RINEX header information. The wavelength markers can change as data is decoded.
wasEndOfFileReached  Has the end of the file been reached (output).
wasObservationFound  Was a valid observation found (output).
filePosition  The file position for the start of the message found (output).
obsArray  A pointer to a user provided array of GNSS_structMeasurement (input/output).
maxNrObs  The maximum number of elements in the array provided (input).
nrObs  The number of valid elements set in the array (output).
rx_gps_week  The receiver GPS week (0-1024+) [weeks].
rx_gps_tow  The receiver GPS time of week (0-603799.99999) [s].

Definition at line 1392 of file rinex.c.