31
See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/303314368 Reading RINEX 2.11 Observation Data Files Technical Report · April 2015 DOI: 10.13140/RG.2.1.4888.4087 CITATION 1 READS 27,064 1 author: Some of the authors of this publication are also working on these related projects: Problemas de Decisão no Planeamento e Gestão do Território View project GNSS and accelerometers data fusion in large structures monitoring View project António Pestana Instituto Superior de Engenharia do Porto 18 PUBLICATIONS 3 CITATIONS SEE PROFILE All content following this page was uploaded by António Pestana on 18 May 2016. The user has requested enhancement of the downloaded file.

Reading RINEX 2.11 Observation Data Files

  • Upload
    others

  • View
    19

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Reading RINEX 2.11 Observation Data Files

See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/303314368

Reading RINEX 2.11 Observation Data Files

Technical Report · April 2015

DOI: 10.13140/RG.2.1.4888.4087

CITATION

1READS

27,064

1 author:

Some of the authors of this publication are also working on these related projects:

Problemas de Decisão no Planeamento e Gestão do Território View project

GNSS and accelerometers data fusion in large structures monitoring View project

António Pestana

Instituto Superior de Engenharia do Porto

18 PUBLICATIONS   3 CITATIONS   

SEE PROFILE

All content following this page was uploaded by António Pestana on 18 May 2016.

The user has requested enhancement of the downloaded file.

Page 2: Reading RINEX 2.11 Observation Data Files

Technical Report:

Reading RINEX 2.11 Observation Data Files

António Pestana

April 2015

Page 3: Reading RINEX 2.11 Observation Data Files

TABLE OF CONTENTS

1 MOTIVATION AND SCOPE .................................................................................. 1

2 BASIC DEFINITIONS ............................................................................................ 1

2.1 The observables .......................................................................................... 1

2.1.1 TIME ............................................................................................................ 2

2.1.2 PSEUDO-RANGE ............................................................................................ 2

2.1.3 PHASE .......................................................................................................... 2

2.1.4 DOPPLER ...................................................................................................... 2

2.1.5 SIGNAL STRENGTH (SS) ............................................................................... 2

2.1.6 LOSS OF LOCK INDICATOR (LLI) .................................................................. 3

2.2 Real-time adjustment of the receiver clock .............................................. 3

2.3 Satellite identifiers .................................................................................... 4

2.4 Observation codes ...................................................................................... 4

2.5 Number of characters in a line of the file ................................................. 5

2.6 File naming conventions ............................................................................ 5

2.7 Data formats used ...................................................................................... 6

3 GNSS OBSERVATION DATA FILE FORMAT DEFINITIONS ....................................... 7

3.1 Header Section structure and description ................................................ 7

3.2 Data Record structure and description ..................................................... 8

APPENDIX A: FULL RINEX 2.11 OBSERVATION DATA FILE DESCRIPTION

APPENDIX B: MATLAB CODE

Page 4: Reading RINEX 2.11 Observation Data Files

1

1 Motivation and Scope

RINEX1 version 2.11 is a de facto standard for storing all the data needed for all kinds

of GNSS2 positioning and navigation. This standard provides means to seamless store data

transmitted from GPS3, GLONASS4, GALILEO5 end GEO6/SBAS7 satellites, as well as

meteorological data and the fundamental observations made by GNSS receivers (code, phase,

Doppler and time). Its versatility and the good quality of its documentation made RINEX the

standard of choice for data input in all kinds a post processing techniques, both in real-world

production works as in research and development projects.

The format consists of seven ASCII file types:

1. Observation Data File

2. Navigation Message File

3. Meteorological Data File

4. GLONASS Navigation Message File

5. GEO Navigation Message File

6. Satellite and Receiver Clock Date File

7. SBAS Broadcast Data File

The scope of this report is the Observation Data File. This file allows to store the most

important data collected by GNSS receivers, including all the observations needed for GNSS

positioning and navigation.

This report is not intended to replace or complement the “RINEX: The Receiver

Independent Exchange Format Version 2.11”, by Werner Gurtner (Astronomical Institute,

University of Berne) and Lou Estey (UNAVCO, Boulder, Co.), available for downloading in

several Internet sites (e.g. ftp://igs.org/pub/data/format/rinex211.txt) and the unique true

documentation of RINEX version 2.11 Format. This report addresses only subjects that the

author considers to be the most significant in view of the experience he had acquired with the

development of software for reading RINEX version 2.11 Format files.

The second appendix of this report provides sample code (MatLAB programming

language) for reading RINEX 2.11 Observation Data files.

2 Basic definitions

2.1 The observables

The observations are the measurements made by a GNSS receiver using the signals

broadcasted by GNSS satellites. The observables include three fundamental quantities: Time,

Phase and Pseudo-range. RINEX 2.11 allows for a forth observable: the Signal Strength (or raw

SNR (signal-noise ratio). These quantities, which should not be corrected for external effects like

1 RINEX stands for “The Receiver Independent Exchange Format”. 2 GNSS stands for “Global Navigation Satellite Systems”. 3 GPS stands for “Global Positioning System”, the US satellite navigation system. 4 GLONASS is the Russian counterpart of GPS. 5 Galileo will be the European satellite navigation system. 6 GEO are geostationary satellites. 7 SBAS stands for Satellite-Based Augmentation Systems. At present time three SBAS

are fully functional: WAAS (for North-America), EGNOS (for Europe) and MSAS (for Japan).

Page 5: Reading RINEX 2.11 Observation Data Files

2

atmospheric refraction, satellite clock offsets, etc., are defined in the standard as follows in the

next subsections. Their values are stored in the Observation Data File.

2.1.1 Time

The time (𝑡) of the measurement is the receiver time of the received signals. The RINEX

2.11 documentation text states that “…the observation time being the reading of the receiver

clock at the instant of validity of the carrier-phase and/or the code measurements”.

The time of measurement is identical for the phase and range measurements and is

identical for all satellites observed at the same epoch. For single-system data files it is by default

expressed in the time system of the respective satellite system. Otherwise the actual time can

(for mixed files must) be indicated in the “TIME OF FIRST OBS” header record of the

Observation Data File. Obviously in both cases 𝑡 will be affected by the receiver clock offset

relative to the time system adopted.

IMPORTANT: when using GPS time system (GPST) the GPS week number in all

RINEX files must be a continuous number. Being so this number will be not affected by the 1024

roll-over, as it will run from 1023 over 1024 to 1025, etc.

2.1.2 Pseudo-range

The pseudo-range (𝜌𝑠) is the distance from the receiver antenna to the satellite antenna

including receiver and satellite clock offsets (and other biases, such as atmospheric delays). This

quantity equals the speed of light in vacuum (𝑐) times the apparent time travel of the code signal

received by the receiver’s antenna (Δ𝑡𝑠). The apparent time travel of the code signal is the

difference of the time of reception (expressed in the time frame of the receiver) and the time of

transmission (expressed in the time frame of the transmitting satellite).

Being 𝑑 the distance from the transmitting satellite’s position at the time of

transmission to the receiver’s antenna position at time of reception, 𝛿𝑡 the receiver clock offset

and 𝛿𝑡𝑠 the satellite clock offset, the pseudo-range is:

𝜌 = 𝑐 × Δ𝑡 = 𝑑 + 𝑐 × (𝛿𝑡 − 𝛿𝑡𝑠 + other biases)

The pseudo-range is stored in units of meters.

2.1.3 Phase

The phase (Φ) is the carrier-phase measured in whole cycles (actually being a

measurement on the beat frequency between the received carrier of the satellite signal and a

receiver generated reference frequency). The phase changes in the same sense as the range

(negative Doppler). The phase observations between epochs must be connected by including the

integer number of cycles.

2.1.4 Doppler

The sign of the Doppler shift is an additional observable defined positive for

approaching satellites.

2.1.5 Signal Strength (SS)

Raw signal strengths are the signal to noise ratio values as given by the receiver for

the respective phase observations. This observation is evaluated for each of the phase

observations and stored in the observation data file using the SS data record. This record can

be blank, 0, or store signal strength values projected into interval from 1 to 9. The meanings of

these values are:

Page 6: Reading RINEX 2.11 Observation Data Files

3

0 or blank: not known, don't care

1: minimum possible signal strength

5: threshold for good S/N ratio

9: maximum possible signal strength

2.1.6 Loss of Lock Indicator (LLI)

The Loss of Lock Indicator (LLI) can’t be considered an observable because it is not

measured. It carries valuable information regarding each observation so it is stored in the

observation data file immediately following each one of the observation values. The LLI values

are three-bit codes (binary 000-111) stored in a record of a RINEX observation files as decimals

0-7. Each bit has a special meaning:

Bit zero set: Loss-of-lock for this SV8 and this frequency, meaning that a cycle slip is

possible

Bit one set: Switch wavelength factor to opposite of last WAVELENGTH FACT L1/2

record setting for this SV and this frequency

Bit two set: Anti-spoofing9 (A/S) is on for this SV or some other signal

degradation/noise enhancement is in effect

The RINEX 2.11 standard states that: “Some receivers generate code (pseudorange)

delay differences between the first and second frequency using cross-correlation techniques

when AS is on and may recover the phase observations on L2 in full cycles. Using the C/A code

delay on L1 and the observed difference it is possible to generate a code delay observation for

the second frequency. Other receivers recover P code observations by breaking down the Y code

into P and W code. Most of these observations may suffer from an increased noise level. In order

to enable the postprocessing programs to take special actions, such AS-infected observations

have been flagged in RINEX Version 2 using bit number 2 of the Loss of Lock Indicators (i.e.

their current values are increased by 4).”

IMPORTANT: a blank or zero Loss of Lock Indicator means “OK or not known”

2.2 Real-time adjustment of the receiver clock

If the receiver or the converter software adjusts the measurements using the real-time-

derived receiver clock offsets 𝛿𝑡(𝑟), the consistency of the three fundamental quantities must be

maintained, i.e. the receiver clock correction should be applied to all 3 observables. Being 𝑓 the

frequency:

𝑡 = 𝑡(𝑟) − 𝛿𝑡(𝑟)

𝜌𝑠 = 𝜌(𝑟) − 𝑐 × 𝛿𝑡(𝑟)

8 SV stands for “space vehicle”; the same as satellite. 9 Anti-spoofing (AS) is a protection against “fake” transmissions by encrypting a GNSS

range code. GPS encrypts P-code (precise code) to form the Y-code. This procedure aims to ensure

that the GPS signals cannot be disturbed (spoofed) by a GPS-like transmitter. The anti-spoofing

procedure converts the P-code to the Y-code which is only usable when a secret conversion

algorithm is available to the receiver. The Y-code is the “modulo two sum” of the P-code and the

encryption code, also referred to as the W-code. Only selected GPS users have access to the

conversion algorithm.

Page 7: Reading RINEX 2.11 Observation Data Files

4

Φ = Φ(𝑟) − 𝑓 × 𝛿𝑡(𝑟)

2.3 Satellite identifiers

Satellites are identified by three-character codes: two-digit satellite numbers preceded

by a one-character system identifier. The systems’ identifiers are:

G or blank : GPS ((lank identifiers are only allowed in pure GPS files)

R : GLONASS

S : geostationary GPS signal payloads (GEO)

E : Galileo

The satellite two-digit numbers are the PRN10 (for GPS and Galileo), the slot number

(for GLONASS) and PRN−100 for GEO (e.g. the identifier S20 refers to a GEO satellite having

PRN=120).

2.4 Observation codes

Each observation type (pseudo-range, phase, Doppler and signal strength) has a

unique RINEX 2.11 identifier named observation code. An observation code is a two-character

string: the first one (a capital letter) is an observation identifier and the second one (a digit) is

a frequency code. These codes are listed in the following figure (SBAS11 satellites are GEO

satellites):

Figure 1: Components of the observation codes

For example, any phase observation on the 1176.45 MHz carrier will be coded as L5.

Important: observations collected under anti-spoofing must be converted to "L2" or "P2"

and flagged with bit 2 of loss of lock indicator (LLI). At present time GPS is the only fully

operational system using anti-spoofing.

10 PRN stands for “pseudo-random noise”. 11 SBAS stands for Satellite-Based Augmentation Systems. At present time three

SBAS are fully functional: WAAS (for North-America), EGNOS (for Europe) and MSAS (for

Japan).

Page 8: Reading RINEX 2.11 Observation Data Files

5

Figure 2: Full set of RINEX 2.11 observations codes

2.5 Number of characters in a line of the file

Each line of an Observation Data File has no more than 80 characters long.

2.6 File naming conventions

RINEX 2.11 proposes the file naming conventions presented in the next figure:

Figure 3: RINEX 2.11 file naming conventions

Page 9: Reading RINEX 2.11 Observation Data Files

6

2.7 Data formats used

All the data must be written in a RINEX 2.11 ASCII text files using the formats (these

formats are similar to the FORTRAN formats) defined in the standard. Each data element will

occupy a field. The formats define the inner structure of each field.

A format always begins with an uppercase letter defining the type of the data to be

stored in the field followed by the definition of the structure of the field.

A sequence of identical fields is coded by inserting the number of repetitions before the

format of the field to be repeated. A sequence of distinct fields uses commas to separate fields.

If a sequence of distinct fields is to be repeated, then the sequence is enclosed using curved

brackets and the number of repetitions is written before the opening bracket. A number before

a sequence defines the number of repetitions of that sequence. The following two tables may

clarify the concepts:

Table 1: Data Format examples for single variables;

# is used to identify blanks and the variables are enclosed by single quotes

(adapted from http://gage14.upc.es/gLAB/HTML/LaunchHTML.html)

Variable

Type Format Examples Description

Integer In

I4: '2010'

I5: '#2010'

I3.3: '010'

A 'n' positions integer.

Note it can be specified the minimum length of the

integer by including a number after the floating point

symbol. This forces the number to be padded, even

with zeros.

Float Fn.m

F8.2: '−1402.50'

F8.2: '#1402.50'

F7.3: '#44.000'

A 'n' positions double with 'm' decimal positions.

Note 'n' includes sign space and the floating point

symbol.

Exponential Dn.m

D12.2: '−1402.50D+02'

D12.4: '#−0.1966D+06'

E12.3: '#44.000E+006'

e12.3: '−44.000E+006'

A 'n' positions exponential double with 'm' decimal

positions.

Note 'n' is the total length of the exponential number,

this includes sign space, the floating point symbol and

the exponent itself.

In order to account for the various compilers, E, e, D,

and d are allowed letters between the fraction and

exponent of all floating point numbers in the

navigation message files of RINEX 2.11. Zero-padded

two-digit exponents are required, however (the last

two examples are not possible in RINEX 2.11).

Characters An A7: 'GLONASS'

A2: '#E'

A 'n' positions character.

Note this includes empty characters.

Empty

Fields nX 1X: '#'

A 'n' empty (blank) characters.

The fields that are defined as blanks are reserved

fields which must remain blank as may be used in

future versions.

Table 2: RINEX 2.11 Data Format examples for sequences of variables

Sequence Examples

I2,1X,A3,1X,F8.2 '14#G18#−1402.50'

2D12.2 '−1402.50D+02#1234.56D+03'

2(I2,1X,A3,1X,F8.2) '14#G18#−1402.5013#R02##1402.50'

Page 10: Reading RINEX 2.11 Observation Data Files

7

3 GNSS Observation Data File format definitions

The RINEX 2.11 GNSS Observation Data File is an ASCII file composed by a Header

Section followed by a Data Section. The Header Section must be placed at the beginning of the

file and is metadata, that is to say, “data about data”: it contains global information for the

entire file. The Data Section basically contain the observations made by a receiver during one

observation session.

3.1 Header Section structure and description

The Header Section is composed of Header Records. Each Header Record is one or more

lines of the Header Section. Each line of the Header Section must contain a header label in

columns 61-80 of the line; this header label identifies the Header Record the line belongs to.

These labels are mandatory and must appear exactly as given in RINEX 2.11 standard. The last

record of the Header Section must be labelled “END OF HEADER”.

Free ordering of the header records is allowed, with the following exceptions:

a) The "RINEX VERSION / TYPE" record must be the first record in a file

b) The default "WAVELENGTH FACT L1/2" record must precede all records defining

wavelength factors for individual satellites

c) The "# OF SATELLITES" record (if present) should be immediately followed by the

corresponding number of "PRN / # OF OBS" records.

The full RINEX 2.11 Header Section description is presented in Table A 1 of Appendix

A. MatLAB code for reading the Header Section (function rinexReadsObsFileHeader211) is

provided in Appendix B.

Page 11: Reading RINEX 2.11 Observation Data Files

8

Figure 4: Example of a “mixed” GPS+GLONASS RINEX 2.11 Observation Data File Header

3.2 Data Record structure and description

The Data Section of the Observation Data File is composed of Data Records. All the

data stored in one Data Record must be collected at one site and at the same epoch. Each Data

Record has multiple lines of ASCII text.

The first line(s) of a Data Record stores data regarding all the observations made at a

given epoch: it is metadata about the observations stored in the Data Record. This metadata

section of the Data Record includes the date/time stamp (the epoch) of the record, a one character

“epoch flag”, the number of observed satellites at this epoch and the list of respective three-

character satellite identifiers. If the number of satellites is greater than 12 this list spans to the

next line.

After the Data Record metadata, the Data Record observations section follow. The

observations section can be thought as a table having so many lines as satellites in the satellites

list, and one column for each of the “n” observation codes stored in the “# / TYPES OF OBSERV”

record of the Header Section. Each observation can be a pseudo-range, a phase or a Doppler

observation, followed by a loss of lock indicator (LLI) and signal-strength value (SS), by this

order. Each cell of the table will store only one observation and the respective LLI and SS using

2.11 OBSERVATION DATA M RINEX VERSION / TYPE

Spider V4,0,0,3554 2015 03 07 15:00 PGM / RUN BY / DATE

Antena_3 MARKER NAME

Ant3 MARKER NUMBER

Antonio Pestana ISEP-LabTopografia OBSERVER / AGENCY

LEICA GMX902GNSS 4.005 REC # / TYPE / VERS

LEIAS10 NONE ANT # / TYPE

4753836.3636 -718468.9092 4177370.7279 APPROX POSITION XYZ

0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N

1 1 WAVELENGTH FACT L1/2

7 C1 L1 S1 P2 L2 S2 C2 # / TYPES OF OBSERV

0.050 INTERVAL

2015 03 07 14 00 0.0000000 GPS TIME OF FIRST OBS

2015 03 07 14 59 59.9500000 GPS TIME OF LAST OBS

16 LEAP SECONDS

17 # OF SATELLITES

G 5 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

G12 16157 16073 16157 16028 16028 16028 0 PRN / # OF OBS

G13 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

G15 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

G17 24532 24472 24532 24413 24398 24413 0 PRN / # OF OBS

G18 35487 35487 35487 34172 33930 34172 0 PRN / # OF OBS

G21 27801 27801 27801 27801 27801 27801 0 PRN / # OF OBS

G24 70618 70264 70618 70052 69951 70052 0 PRN / # OF OBS

G28 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

G30 21001 21001 21001 21001 21001 21001 0 PRN / # OF OBS

R 3 22578 22578 22578 20656 19980 20656 0 PRN / # OF OBS

R 4 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

R 5 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

R13 18801 18801 18801 18801 18801 18801 0 PRN / # OF OBS

R14 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

R15 72000 72000 72000 72000 72000 72000 0 PRN / # OF OBS

R16 30534 30534 30534 29521 29335 29521 0 PRN / # OF OBS

BIT 2 OF LLI FLAGS DATA COLLECTED UNDER A/S CONDITION COMMENT

SNR is mapped to RINEX snr flag value [2-9] COMMENT

Lx: = 25dBHz -> 1; 26-27dBHz -> 2; 28-31dBHz -> 3 COMMENT

32-35dBHz -> 4; 36-38dBHz -> 5; 39-41dBHz -> 6 COMMENT

42-44dBHz -> 7; 45-48dBHz -> 8; >=49dBHz -> 9 COMMENT

END OF HEADER

Page 12: Reading RINEX 2.11 Observation Data Files

9

the format 'F14.3,I1,I1'. No more than 5 of this sequences can be stored in a line of text as

each line of the Observation Data File is only 80-character long. So, if “n” is greater than 5, each

line of the table will span multiple lines of the text file.

The full RINEX 2.11 Observation Data Record Description is presented in Table A 3 of

Appendix A. MatLAB code for reading all the data stored in a Data Record (functions

rinexReadsObsBlockHead211 and rinexReadsObsBlock211) is provided in Appendix B.

Figure 5: Example of a “mixed” GPS+GLONASS RINEX 2.11 Observation Data Record. This Data Record

belongs to the Observation Data File whose File Header is shown in Figure 4. The first two lines of text

are the Data Record metadata. Each line of the observations table has two lines of text (seven cells, the

last one being always blank in this example).

15 03 07 14 00 0.0000000 0 13G05G13G15G21G24G28G30R03R04R05R13R14

R15

21752028.780 114307648.68909 49.650 21752031.320 89070886.61248

45.050

20339096.640 106882674.53909 49.900 20339096.500 83285200.21948

46.250

21193622.660 111373268.06409 49.000 21193624.520 86784381.08048

45.750

24802156.440 130336200.07306 39.250 24802162.340 101560673.46345

37.800

23154480.240 121677613.26204 35.700 23154486.000 94813735.70144

35.200

22109086.960 116184042.77608 48.750 22109087.460 90533034.98047

42.050

24059695.260 126434498.30006 39.800 24059703.680 98520387.60845

38.750

22289931.520 119319672.06506 40.850 22289941.280 92804193.34807

44.050

19189656.100 102759732.07708 47.800 19189660.760 79924251.82008

46.050

20709366.500 110703447.77707 42.100 20709374.380 86102730.12007

44.600

23051974.580 123096198.42705 38.500 23051984.020 95741503.69106

41.850

19390246.180 103360924.14507 44.750 19390255.460 80391868.93106

40.950

20069883.180 107247438.46008 46.100 20069892.380 83414749.05908

45.900

Page 13: Reading RINEX 2.11 Observation Data Files

Appendix A: Full RINEX 2.11 Observation Data File description

Page 14: Reading RINEX 2.11 Observation Data Files

A1

Table A 1: RINEX 2.11 GNSS Observation Data File Header Description

+----------------------------------------------------------------------------+

| TABLE A1 |

| GNSS OBSERVATION DATA FILE - HEADER SECTION DESCRIPTION |

+--------------------+------------------------------------------+------------+

| HEADER LABEL | DESCRIPTION | FORMAT |

| (Columns 61-80) | | |

+--------------------+------------------------------------------+------------+

|RINEX VERSION / TYPE| - Format version (2.11) | F9.2,11X, |

| | - File type ('O' for Observation Data) | A1,19X, |

| | - Satellite System: blank or 'G': GPS | A1,19X |

| | 'R': GLONASS | |

| | 'S': Geostationary | |

| | signal payload | |

| | 'E': Galileo | |

| | 'M': Mixed | |

+--------------------+------------------------------------------+------------+

|PGM / RUN BY / DATE | - Name of program creating current file | A20, |

| | - Name of agency creating current file | A20, |

| | - Date of file creation | A20 |

+--------------------+------------------------------------------+------------+

*|COMMENT | Comment line(s) | A60 |*

+--------------------+------------------------------------------+------------+

|MARKER NAME | Name of antenna marker | A60 |

+--------------------+------------------------------------------+------------+

*|MARKER NUMBER | Number of antenna marker | A20 |*

+--------------------+------------------------------------------+------------+

|OBSERVER / AGENCY | Name of observer / agency | A20,A40 |

+--------------------+------------------------------------------+------------+

|REC # / TYPE / VERS | Receiver number, type, and version | 3A20 |

| | (Version: e.g. Internal Software Version)| |

+--------------------+------------------------------------------+------------+

|ANT # / TYPE | Antenna number and type | 2A20 |

+--------------------+------------------------------------------+------------+

|APPROX POSITION XYZ | Approximate marker position (WGS84) | 3F14.4 |

+--------------------+------------------------------------------+------------+

|ANTENNA: DELTA H/E/N| - Antenna height: Height of bottom | 3F14.4 |

| | surface of antenna above marker | |

| | - Eccentricities of antenna center | |

| | relative to marker to the east | |

| | and north (all units in meters) | |

+--------------------+------------------------------------------+------------+

*|WAVELENGTH FACT L1/2| - Default wavelength factors for | |*

| | L1 and L2 (GPS only) | 2I6, |

| | 1: Full cycle ambiguities | |

| | 2: Half cycle ambiguities (squaring) | |

| | 0 (in L2): Single frequency instrument | |

| | - zero or blank | I6 |

| | | |

| | The wavelength factor record is optional | |

| | for GPS and obsolete for other systems. | |

| | Wavelength factors default to 1. | |

| | If the record exists it must precede any | |

| | satellite-specific records (see below). | |

+--------------------+------------------------------------------+------------+

*|WAVELENGTH FACT L1/2| - Wavelength factors for L1 and L2 (GPS) | 2I6, |*

| | 1: Full cycle ambiguities | |

| | 2: Half cycle ambiguities (squaring) | |

| | 0 (in L2): Single frequency instrument | |

| | - Number of satellites to follow in list | I6, |

| | for which these factors are valid. | |

| | - List of PRNs (satellite numbers with | 7(3X,A1,I2)|

| | system identifier) | |

| | | |

| | These optional satellite specific lines | |

| | may follow, if they identify a state | |

| | different from the default values. | |

| | | |

| | Repeat record if necessary. | |

+--------------------+------------------------------------------+------------+

|# / TYPES OF OBSERV | - Number of different observation types | I6, |

| | stored in the file | |

| | - Observation types | |

| | - Observation code | 9(4X,A1, |

| | - Frequency code | A1)|

| | If more than 9 observation types: | |

| | Use continuation line(s) (including |6X,9(4X,2A1)|

| | the header label in cols. 61-80!) | |

| | | |

| | The following observation types are | |

| | defined in RINEX Version 2.11: | |

| | | |

| | Observation code (use uppercase only): | |

| | C: Pseudorange GPS: C/A, L2C | |

| | Glonass: C/A | |

| | Galileo: All | |

| | P: Pseudorange GPS and Glonass: P code| |

| | L: Carrier phase | |

| | D: Doppler frequency | |

| | S: Raw signal strengths or SNR values | |

| | as given by the receiver for the | |

| | respective phase observations | |

| | | |

| | Frequency code | |

| | GPS Glonass Galileo SBAS | |

| | 1: L1 G1 E2-L1-E1 L1 | |

| | 2: L2 G2 -- -- | |

| | 5: L5 -- E5a L5 | |

| | 6: -- -- E6 -- | |

| | 7: -- -- E5b -- | |

| | 8: -- -- E5a+b -- | |

| | | |

| | Observations collected under Antispoofing| |

| | are converted to "L2" or "P2" and flagged| |

| | with bit 2 of loss of lock indicator | |

| | (see Table A2). | |

| | | |

| | Units : Phase : full cycles | |

| | Pseudorange : meters | |

| | Doppler : Hz | |

| | SNR etc : receiver-dependent | |

| | | |

| | The sequence of the types in this record | |

| | has to correspond to the sequence of the | |

| | observations in the observation records | |

+--------------------+------------------------------------------+------------+

Records marked with * are optional

Page 15: Reading RINEX 2.11 Observation Data Files

A2

Table A 2: RINEX 2.11 GNSS Observation Data File Header Description

(continuation)

+----------------------------------------------------------------------------+

| TABLE A1 (Cont.) |

| GNSS OBSERVATION DATA FILE - HEADER SECTION DESCRIPTION |

+--------------------+------------------------------------------+------------+

| HEADER LABEL | DESCRIPTION | FORMAT |

| (Columns 61-80) | | |

+--------------------+------------------------------------------+------------+

*|INTERVAL | Observation interval in seconds | F10.3 |*

+--------------------+------------------------------------------+------------+

|TIME OF FIRST OBS | - Time of first observation record | 5I6,F13.7, |

| | (4-digit-year, month,day,hour,min,sec) | |

| | - Time system: GPS (=GPS time system) | 5X,A3 |

| | GLO (=UTC time system) | |

| | GAL (=Galileo System Time)| |

| | Compulsory in mixed GPS/GLONASS files | |

| | Defaults: GPS for pure GPS files | |

| | GLO for pure GLONASS files | |

| | GAL for pure Galileo files | |

+--------------------+------------------------------------------+------------+

*|TIME OF LAST OBS | - Time of last observation record | 5I6,F13.7, |*

| | (4-digit-year, month,day,hour,min,sec) | |

| | - Time system: Same value as in | 5X,A3 |

| | TIME OF FIRST OBS record | |

+--------------------+------------------------------------------+------------+

*|RCV CLOCK OFFS APPL | Epoch, code, and phase are corrected by | I6 |*

| | applying the realtime-derived receiver | |

| | clock offset: 1=yes, 0=no; default: 0=no | |

| | Record required if clock offsets are | |

| | reported in the EPOCH/SAT records | |

+--------------------+------------------------------------------+------------+

*|LEAP SECONDS | Number of leap seconds since 6-Jan-1980 | I6 |*

| | Recommended for mixed files | |

+--------------------+------------------------------------------+------------+

*|# OF SATELLITES | Number of satellites, for which | I6 |*

| | observations are stored in the file | |

+--------------------+------------------------------------------+------------+

*|PRN / # OF OBS | PRN (sat.number), number of observations |3X,A1,I2,9I6|*

| | for each observation type indicated | |

| | in the "# / TYPES OF OBSERV" - record. | |

| | | |

| | If more than 9 observation types: | |

| | Use continuation line(s) including | 6X,9I6 |

| | the header label in cols. 61-80! | |

| | | |

| | This record is (these records are) | |

| | repeated for each satellite present in | |

| | the data file | |

+--------------------+------------------------------------------+------------+

|END OF HEADER | Last record in the header section. | 60X |

+--------------------+------------------------------------------+------------+

Records marked with * are optional

Page 16: Reading RINEX 2.11 Observation Data Files

A3

Table A 3: RINEX 2.11 GNSS Observation Data Record Description

+----------------------------------------------------------------------------+

| TABLE A2 |

| GNSS OBSERVATION DATA FILE - DATA RECORD DESCRIPTION |

+-------------+-------------------------------------------------+------------+

| OBS. RECORD | DESCRIPTION | FORMAT |

+-------------+-------------------------------------------------+------------+

| EPOCH/SAT | - Epoch : | |

| or | - year (2 digits, padded with 0 if necessary) | 1X,I2.2, |

| EVENT FLAG | - month,day,hour,min, | 4(1X,I2), |

| | - sec | F11.7, |

| | | |

| | - Epoch flag 0: OK | 2X,I1, |

| | 1: power failure between | |

| | previous and current epoch | |

| | >1: Event flag | |

| | - Number of satellites in current epoch | I3, |

| | - List of PRNs (sat.numbers with system | 12(A1,I2), |

| | identifier, see 5.1) in current epoch | |

| | - receiver clock offset (seconds, optional) | F12.9 |

| | | |

| | If more than 12 satellites: Use continuation | 32X, |

| | line(s) | 12(A1,I2) |

| | | |

| | If epoch flag 2-5: | |

| | | |

| | - Event flag: | [2X,I1,] |

| | 2: start moving antenna | |

| | 3: new site occupation (end of kinem. data) | |

| | (at least MARKER NAME record follows) | |

| | 4: header information follows | |

| | 5: external event (epoch is significant, | |

| | same time frame as observation time tags)| |

| | | |

| | - "Number of satellites" contains number of | [I3] |

| | special records to follow. | |

| | Maximum number of records: 999 | |

| | | |

| | - For events without significant epoch the | |

| | epoch fields can be left blank | |

| | | |

| | If epoch flag = 6: | |

| | 6: cycle slip records follow to optionally | |

| | report detected and repaired cycle slips | |

| | (same format as OBSERVATIONS records; | |

| | slip instead of observation; LLI and | |

| | signal strength blank or zero) | |

+-------------+-------------------------------------------------+------------+

|OBSERVATIONS | - Observation | rep. within record for | m(F14.3, |

| | - LLI | each obs.type (same seq | I1, |

| | - Signal strength | as given in header) | I1) |

| | | |

| | If more than 5 observation types (=80 char): | |

| | continue observations in next record. | |

| | | |

| | This record is (these records are) repeated for | |

| | each satellite given in EPOCH/SAT - record. | |

| | | |

| | Observations: | |

| | Phase : Units in whole cycles of carrier | |

| | Code : Units in meters | |

| | Missing observations are written as 0.0 | |

| | or blanks. | |

| | | |

| | Phase values overflowing the fixed format F14.3 | |

| | have to be clipped into the valid interval (e.g.| |

| | add or subtract 10**9), set LLI indicator. | |

| | | |

| | Loss of lock indicator (LLI). Range: 0-7 | |

| | 0 or blank: OK or not known | |

| | Bit 0 set : Lost lock between previous and | |

| | current observation: cycle slip | |

| | possible | |

| | Bit 1 set : Opposite wavelength factor to the | |

| | one defined for the satellite by a | |

| | previous WAVELENGTH FACT L1/2 line | |

| | or opposite to the default. | |

| | Valid for the current epoch only. | |

| | Bit 2 set : Observation under Antispoofing | |

| | (may suffer from increased noise) | |

| | | |

| | Bits 0 and 1 for phase only. | |

| | | |

| | Signal strength projected into interval 1-9: | |

| | 1: minimum possible signal strength | |

| | 5: threshold for good S/N ratio | |

| | 9: maximum possible signal strength | |

| | 0 or blank: not known, don't care | |

+-------------+-------------------------------------------------+------------+

Page 17: Reading RINEX 2.11 Observation Data Files

Appendix B: MatLAB code

Functions:

rinexReadsObsFileHeader211

rinexReadsObsBlockHead211

rinexReadsObsBlock211

Page 18: Reading RINEX 2.11 Observation Data Files

B1

function [success, warnings, rinexHeader, gnssType, markerName,

antDelta,...

numOfObsTypes, typesOfObs, tFirstObs, tLastObs, tInterval, ...

timeSystem, numHeaderLines, clockOffsetsON, leapSec, eof] = ...

rinexReadsObsFileHeader211(file)

% Extracts relevant data from the header of a RINEX GNSS

observations file.

%

% Analyzes the header of a RINEX GNSS observation file and extracts

% relevant data.

%

% Limited tests have been done using RINEX 2.11 observation files.

%

%

% Input:

% file: RINEX observation file

%

% Outputs:

% success: 1 if the reading of the RINEX observations file seems

to be

% successful, 0 otherwise

% warnings: 1 if the reading of the RINEX observations was done

with

% warnings, 0 otherwise

% rHeader: cell column-vector containing the following data:

% rinexVersion: RINEX version number; string: '' if not

specified

% rinexType: RINEX file type; char

% gnssType: GNSS system of the satellites observed; can be

'G', 'R',

% 'S', 'E' or 'M' that stand for GPS, GLONASS, Geostationary

% signal payload, GALILEO or Mixed (satellites from

various of

% the previous systems); char

% rinexProgr: name of the software used to produce de RINEX

GPS nav

% file; '' if not specified

% rinexDate: date/time of the RINEX file creation; '' if not

% specified

% markerName: name of the antenna marker; '' if not specified

% antDelta: column vector ot the three components of the distance

from

% the marker to the antenna, in the following order - up,

east and

% north; reals; null vector by default

% numOfObsTypes: number of different observation types stored in

the

% RINEX file; THIS IS CRITICAL DATA!

% typesOfObs: cell column-vector containing the observation types;

each

Page 19: Reading RINEX 2.11 Observation Data Files

B2

% observation type is a two-character string, the first one

(a

% capital letter) is an observation code and the second one

(a digit)

% is a frequency code. THIS IS CRITICAL DATA!

%

% According to RINEX 2.11 these codes are:

%

% C: Pseudorange GPS: C/A, L2C

% Glonass: C/A

% Galileo: All

% P: Pseudorange GPS and Glonass: P code

% L: Carrier phase

% D: Doppler frequency

% S: Raw signal strengths or SNR values

% as given by the receiver for the

% respective phase observations (see

comments of

% function rinexReadsObsBlock211)

%

% Frequency code

% GPS Glonass Galileo SBAS

% 1: L1 G1 E2-L1-E1 L1

% 2: L2 G2 -- --

% 5: L5 -- E5a L5

% 6: -- -- E6 --

% 7: -- -- E5b --

% 8: -- -- E5a+b --

%

% Observations collected under Antispoofing

% are converted to "L2" or "P2" and flagged

% with bit 2 of loss of lock indicator (LLI);

% read comments of function rinexReadsObsBlock211

%

% tFirstObs: time stamp of the first observation record in the

RINEX

% observations file; column vector of reals [YYYY; MM; DD;

hh; mm;

% ss.sssssss]; THIS IS CRITICAL DATA

% tLastObs: time stamp of the last observation record in the RINEX

% observations file; column vector of reals [YYYY; MM; DD;

hh; mm;

% ss.sssssss]. NaN by default. THIS IS RINEX 2.11 OPTIONAL

DATA

% tInterval: observations interval; seconds. NaN by default.

THIS IS

% RINEX 2.11 OPTIONAL DATA

% timeSystem: three-character code string of the time system used

for

% expressing tfirstObs; can be GPS, GLO or GAL; THIS IS

CRITICAL DATA

% numHeaderLines: total number of lines of the header

Page 20: Reading RINEX 2.11 Observation Data Files

B3

% clockOffsetsON: receiver clock offsets flag. O if no realtime-

derived

% receiver clock offset was applied to epoch, code and phase

data (in

% other words, if the file only has raw data), 1 otherwise.

% 0 by default. THIS IS RINEX 2.11 OPTIONAL DATA

% leapSec: number of leap seconds since 6-Jan-1980. UTC=GPST-

leapSec.

% NaN by default. THIS IS RINEX 2.11 OPTIONAL DATA

% eof: end-of-file flag; 1 if end-of-file was reached, 0 otherwise

%

% Based in the work of Kai Borre

% António Pestana, March 2015

% Copyright (c) António Pestana

fid = fopen(file,'rt');

eof = 0;

success = 1;

warnings = 0;

got_info = 0;

numHeaderLines = 0;

antDelta = [0; 0; 0];

clockOffsetsON = 0;

numLinTypObs = 0;

timeSystem = '';

tFirstObs = [0; 0; 0; 0; 0; 0];

tLastObs = NaN;

tInterval = NaN;

typesOfObs = {};

leapSec = NaN;

numOfObsTypes = 0;

rinexHeader = {};

while 1 % Gobbling the header

numHeaderLines = numHeaderLines + 1;

line = fgetl(fid); % returns -1 if only reads EOF

if line == -1

eof = 1;

if got_info > 5

success = 1;

else

fprintf(['Some important data regarding the GNSS '...

'observations may be missing...\nProceed with

caution.'])

warnings = 1;

end

break

end;

Page 21: Reading RINEX 2.11 Observation Data Files

B4

answer = strfind(line,'END OF HEADER'); % [] if the string isn't

found

if ~isempty(answer) % the end of the header was found

if got_info > 5

success = 1;

break

else

fprintf(['Some important data regarding the GNSS '...

'observations may be missing...\nProceed with

caution.'])

warnings = 1;

end;

break

end

if numHeaderLines == 1

rinexVersion = strtrim(line(1:9));

rinexType = line(21);

if rinexType ~= 'O'

disp('ERROR: the file is not a RINEX observations data

file!')

success = 0;

fclose(fid);

return

end

gnssType = line(41); % reads the GNSS system type

if ~ismember(gnssType, [' ' 'G' 'R' 'S' 'E' 'M'])

disp(['ERROR: "' gnssType '"' ' is an unrecognized

satellite '...

'system type.'])

success = 0;

fclose(fid);

return

end

if strcmp(gnssType,' ')

gnssType = 'G';

end

got_info = got_info + 1;

end

answer = strfind(line,'PGM / RUN BY / DATE');

if ~isempty(answer)

rinexProgr = strtrim(line(1:20));

rinexDate = strtrim(line(41:60));

got_info = got_info + 1;

end

answer = strfind(line,'MARKER NAME');

if ~isempty(answer)

markerName = strtok(line);

got_info = got_info + 1;

end

Page 22: Reading RINEX 2.11 Observation Data Files

B5

answer = strfind(line,'ANTENNA: DELTA H/E/N');

if ~isempty(answer)

for k = 1:3

[number, line] = strtok(line); % finds the substring

containing

% the deltas of the antenna

% relative to the marker

antDelta (k,1) = str2num(number);

end

got_info = got_info + 1;

end;

answer = strfind(line,'# / TYPES OF OBSERV');

if ~isempty(answer)

numLinTypObs = numLinTypObs + 1; % one more line of

observations types

line = strtrim(line(1:60)); % deletes '# / TYPES OF OBSERV'

if numLinTypObs == 1

[nObs, line] = strtok(line);

numOfObsTypes = str2num(nObs);

for k = 1:min(9,numOfObsTypes)

[obsType, line] = strtok(line);

if size(obsType,2) ~= 2 || ~ismember(obsType(1),['C'

'P'...

'L' 'D' 'S']) || ~ismember(obsType(2),['1'

'2' '3'...

'4' '5' '6' '7' '8'])

disp(['ERROR (rinexReadsObsHeader211): '

obsType...

' is a not a standard RINEX 2.11 observation

type!'])

success = 0;

fclose(fid);

return

end

typesOfObs = [typesOfObs; obsType];

got_info = got_info + 1;

end

else

for k = 1:min(9,numOfObsTypes-(numLinTypObs-1)*9)

[obsType, line] = strtok(line);

if size(obsType,2) ~= 2 || ~ismember(obsType(1),['C'

'P'...

'L' 'D' 'S']) || ~ismember(obsType(2),['1'

'2' '3'...

'4' '5' '6' '7' '8'])

disp(['ERROR (rinexReadsObsHeader211): '

obsType...

' is a not a standard RINEX 2.11 observation

type!'])

success = 0;

Page 23: Reading RINEX 2.11 Observation Data Files

B6

fclose(fid);

return

end

typesOfObs = [typesOfObs; obsType];

end

end

end

answer = strfind(line,'TIME OF FIRST OBS');

if ~isempty(answer)

line = strtrim(line(1:60)); % deletes 'TIME OF FIRST OBS'

for k = 1:6

[tok, line] = strtok(line); % finds the substrings

containing

% the components of the time

of the

% first observation (YYYY;

MM; DD;

% hh; mm; ss.sssssss) and

specifies

% the Time System used in

the

% observations file (GPST,

GLOT or

% GALT)

switch k

case 1

yyyy = str2num(tok);

case 2

mm = str2num(tok);

case 3

dd = str2num(tok);

case 4

hh = str2num(tok);

case 5

mnt = str2num(tok);

otherwise

ss = str2num(tok);

end

end

tFirstObs = [yyyy; mm; dd; hh; mnt; ss];

got_info = got_info + 1;

aux = strtok(line);

switch aux

case 'GPS'

timeSystem = 'GPST';

case 'GLO'

timeSystem = 'GLOT';

case 'GAL'

timeSystem = 'GALT';

Page 24: Reading RINEX 2.11 Observation Data Files

B7

otherwise

switch gnssType

case 'G'

timeSystem = 'GPST';

case 'R'

timeSystem = 'GLOT';

case 'E'

timeSystem = 'GALT'

otherwise

fprintf(['CRITICAL ERROR

(rinexReadsObsHeader211):\n'...

'The Time System of the RINEX

observations file '...

'isn''t correctly specified!\n'])

success = 0;

fclose(fid);

return

end

end

end

answer = strfind(line,'TIME OF LAST OBS'); % This is an optional

record

if ~isempty(answer)

for k = 1:6

[tok, line] = strtok(line); % finds the substrings

containing

% the components of the time

of the

% first observation (YYYY;

MM; DD;

% hh; mm; ss.sssssss)

switch k

case 1

yyyy = str2num(tok);

case 2

mm = str2num(tok);

case 3

dd = str2num(tok);

case 4

hh = str2num(tok);

case 5

mnt = str2num(tok);

otherwise

ss = str2num(tok);

end

end

tLastObs = [yyyy; mm; dd; hh; mnt; ss];

end

Page 25: Reading RINEX 2.11 Observation Data Files

B8

answer = strfind(line,'INTERVAL'); % This is an optional record

if ~isempty(answer)

tInterval = str2num(strtok(line));

end

answer = strfind(line,'RCV CLOCK OFFS APPL'); % This is an

optional record!

if ~isempty(answer)

if (strtok(line)=='0')

clockOffsetsON = 0;

elseif (strtok(line)=='1')

clockOffsetsON = 1;

else

success = 0;

disp(['ERROR (rinexReadsObsHeader211): unrecognized

'...

'receiver clock offsets flag!'])

fclose(fid);

return

end

end

answer = strfind(line,'LEAP SECONDS'); % This is an optional

record

if ~isempty(answer)

leapSec = str2num(strtok(line));

end

end

if numOfObsTypes == 0||sum(tFirstObs) == 0

success = 0;

fprintf(['CRITICAL ERROR (rinexReadsObsHeader211)!\nTake a look

'...

'at the RINEX observations file %s'], file);

fclose(fid);

return

end

rinexHeader = {rinexVersion; rinexType; gnssType; rinexProgr;

rinexDate};

fclose(fid);

%%%%%%%%% end rinexReadsObsFileHeader211 %%%%%%%%%

Page 26: Reading RINEX 2.11 Observation Data Files

B9

function [success,epochflag,clockOffset,date,numSV,SVlist,eof] =

...

rinexReadsObsBlockHead211(fid)

% Reads the metadata of a RINEX 2.11 observations block.

%

% ATTENTION: Ignores all data regarding events flagged with numbers

% greater than 1!!!

%

% Positioned in a RINEX 2.11 GNSS observations text file at the

beginning

% of an observation record of type "EPOCH/SAT OR EVENT FLAG", reads

its

% contents (the metadata - one or more lines - of a block of

observations)

%

% Inputs:

% fid: Matlab identifier of an open RINEX 2.11 GNSS observations

text file

%

% Outputs:

% success: 1 if function performs successfully, 0 otherwise

% epochflag: Rinex observations epoch flag, as follows:

% 0: OK

% 1: power failure between previous and current epoch

% From now on the "event flags":

% 2: start moving antenna

% 3: new site occupation

% 4: header information follows

% 5: external event (epoch is significant)

% clockOffset: value of the receiver clock offset. If not present

in the

% metadata of the observations block (it's optional RINEX

2.10

% data)it is assumed to be zero. If not zero implies that

epoch,

% code, and phase data have been corrected by applying

% realtime-derived receiver clock offset

% date: time stamp of the observations block. Six-elements column-

vector

% as follows:

% year: four-digits year (eg: 1959)

% month: integers 1..12

% day: integers 1..31

% hour: integers 0..24

% minute: integers 0..60

% second: reals 0..60

% numSV: number of satellites for which observations were made

and are

% stored in the observations block

% SVlist: cell column-vector of the observed satellites three-

characters

Page 27: Reading RINEX 2.11 Observation Data Files

B10

% strings (system identifier + one or two-digits prn code);

it has as

% many elements as the number of the satellites observed. The

system

% identifiers are: 'G', 'R', 'S' and 'E' (note that blank

system

% identifiers are stored in SVlist as 'G')

%

% António Pestana, November 2012 and March 2015

% Copyright (c) by António Pestana

success = 1;

eof = 0;

gotData = 0;

epochflag = [];

clockOffset = [];

date = [];

numSV = 0;

SVlist = {};

line = fgetl(fid); % returns -1 if only reads EOF

if line == -1

eof = 1;

disp(['INFO (rinexReadsObsBlockHead211): End of observations

'...

'text file reached'])

return

end;

% The first thing to do: the reading of the epoch flag

epochflag = str2num(line(29));

gotData = gotData + 1;

while epochflag > 1 % case of an event flag

linejump = str2num(line(30:32));

disp(['WARNING (rinexReadsObsBlockHead211): observations event

'...

'flag encountered; ' num2str(linejump) ...

' lines were ignored.'])

for count=1:linejump + 1

line = fgetl(fid);

end

epochflag = str2num(line(29));

end

% Reads the time stamp of the observations block (6 numerical

values)

date = cell2mat(textscan(line,'%f', 6));

year = date(1,1);

if (year > 79)&&(year <= 99)

year = year + 1900;

Page 28: Reading RINEX 2.11 Observation Data Files

B11

elseif (year >= 0)&&(year <= 79)

year = year + 2000;

else

success = 0;

disp(['ERROR (rinexReadsObsBlockHead211): observations block

time '...

'stamp format unrecognized (not RINEX 2.11)!'])

return

end

date(1,1) = year;

% Gets the number of used satellites

numSV = str2num(line(30:32)); % number of used SV

% Gets the receiver clock offset. It's optional data!

clockOffset = 0;

if size(line,2) == 80

clockOffset = str2num(line(69:80));

end

% Creats the list of the satellites used in the observations block

col = 33;

for sat=1:numSV

if ismember(sat,13:13:999)

line = fgetl(fid);

col = 33;

end

aux = line(col:col+2);

if aux(1) == ' ' % Case of blanks for GPS identifiers

aux(1) = 'G';

end

SVlist = [SVlist; aux];

col = col + 3;

end

%%%%%%%%%%%%%%%%%%%%%%%% end rinexReadsObsBlockHead211

%%%%%%%%%%%%%%%%%%%%%%%%

Page 29: Reading RINEX 2.11 Observation Data Files

B12

function [success, Obs, LLI, SS, eof] =...

rinexReadsObsBlock211(fid, numSV, numOfObsTypes)

% Reads all the observations from a RINEX observations block.

%

% Positioned at the beginning of the line immediately after the

header of the

% observations block, reads all the observations in this block of

a RINEX

% observations file. This function is to be used after using

function

% rinexReadsObsFileHeader211.

%

% Inputs:

% fid: Matlab file identifier of a Rinex observations text file

% numSV: number of satellites observed at the selected epoch

% numOfObsTypes: number of different observation types stored in

the

% Rinex observations text file (obtained from the header of

the RINEX

% observations file using function rinexReadsObsFileHeader211)

%

% Outputs:

% Obs: array [numSV x numObs] of observations; reals. Uses 0 for

missing

% observations

% LLI: array [numSV x numObs] of "loss of lock indicator" numeric

codes

% (binary 000 - 111, decimal 0 - 7, see RINEX standard).

According to

% http://facility.unavco.org/software/teqc/faqs.html and the

RINEX

% standard the following decimal values have the meaning:

% 0 - binary 000: OK

% 1 - binary 001: loss-of-lock for this SV and this frequency

(L1 or

% L2) (cycle slip possible, original meaning of the LLI

flag)

% 2 - binary 010: switch wavelength factor to opposite of

last

% WAVELENGTH FACT L1/2 record setting for this SV and

this

% frequency (L1 or L2)

% 4 - binary 100: anti-spoofing (A/S) is on for this SV or

some other

% signal degradation/noise enhancement is in effect

%

% I think that all the 3-bits possible combinations can be

used. For

% example, binary 101 (decimal 5) should flag A/S and loss-

of-lock;

% 111 (decimal 7) should flag A/S and loss-of-lock and switch

Page 30: Reading RINEX 2.11 Observation Data Files

B13

% wavelength factor

%

% IMPORTANT: this function assigns -999 to this indicator

when it is

% blank in the file (RINEX 2.11 standard states that blank

% means "not known")

%

% SS: array [numSV x numObs] of RINEX signal strength "normalized"

% values. Integer values from 1 to 9 plus 0 meaning "not

known". The

% RINEX 2.11 standard states:

%

% Signal strength projected into interval 1-9:

% 1: minimum possible signal strength

% 5: threshold for good S/N ratio

% 9: maximum possible signal strength

% 0 or blank: not known, don't care

%

% IMPORTANT: this function assigns -999 to this indicator

when it is

% blank in the file (RINEX 2.11 standard states that blank

% means "don't care")

%

%

% Based in the work of Kai Borre

% António Pestana, March 2015

% Copyright (c) António Pestana

success = 1;

eof = 0;

Obs = zeros(numSV, numOfObsTypes);

LLI = zeros(numSV, numOfObsTypes);

SS = zeros(numSV, numOfObsTypes);

for sat = 1:numSV

lineNum = 0;

for obsNum = 1:numOfObsTypes

if ismember(obsNum,[1:5:numOfObsTypes])

line = fgetl(fid); % reads one line of text

if line == -1

eof = 1;

disp(['ERROR (rinexReadsObsBlock211): the end of

the '...

'observations text file was reached

unexpectedly'])

success = 0;

return

end

lineNum = lineNum + 1;

end

charPos = ((obsNum -(lineNum - 1)*5)-1)*16 + 1;

Page 31: Reading RINEX 2.11 Observation Data Files

B14

newObs = str2num(line(charPos:charPos+13)); % reads one

observation

if isempty(newObs)

newObs = 0;

end

newLLI = str2num(line(charPos+14)); % loss of lock

indicator

if isempty(newLLI)

newLLI = -999;

end

newSS = str2num(line (charPos+15)); % signal strength

if isempty(newSS)

newSS = -999;

end

% Stores the data

Obs(sat,obsNum) = newObs;

LLI(sat,obsNum) = newLLI;

SS(sat,obsNum) = newSS;

end

end

%%%%%%%%% end rinexReadsObsBlock211.m %%%%%%%%%

View publication statsView publication stats