GNSSIR (C library)#

struct arc#

Public Members

size_t len#
size_t nreserve#
arc_state state#
gnss_system system#
int prn#
enu_position site#
double *mjd#
float *elevation#
float *azimuth#
float *values#
struct arc_buffer#
#include <arcs.h>

Stuff for the arc buffer interface.

Public Members

arc *arcbuf[ARC_BUFFER_SIZE]#
int expiry_sec#

states associated with the buffer

int max_arclen_sec#
size_t narcs#
skymask *skymaskptr#
struct enu_position#

Public Members

float lat#
float lon#
float ortho_height#
float geoid_height#
double mjd#
struct gnss_system#

Public Members

const char system[12]#
const char rinexcode[1]#
double frequency#
double length#
double bandwidth#
struct gnssrstream#

Public Members

stream_type ftype#
void *fid#
struct lz4stream#

Public Members

LZ4_readFile_t *lz4_fid#
FILE *fid#
char *mbufPtr#
char *chunkbuf#
char *chunkPtr#
size_t buflen#
struct nmea_cycle#
#include <nmea.h>

holds the information of all the GSV messages in a cycle

Public Members

double mjd#
char status#
enu_position site#
int sats_in_view#
gnss_system system[NMEA_GSV_MAX_SATELLITES]#
int prn[NMEA_GSV_MAX_SATELLITES]#
float elevation[NMEA_GSV_MAX_SATELLITES]#
float azimuth[NMEA_GSV_MAX_SATELLITES]#
float cnr0[NMEA_GSV_MAX_SATELLITES]#
struct nmea_trans_cycle#
#include <nmea.h>

Cycle structure holding a paired nmea-cycle with a transmissivity cycle.

Public Members

double mjd[2]#
enu_position sites[2]#
int sats_in_view#
gnss_system system[NMEA_GSV_MAX_SATELLITES]#
int prn[NMEA_GSV_MAX_SATELLITES]#
float elevation[NMEA_GSV_MAX_SATELLITES]#
float azimuth[NMEA_GSV_MAX_SATELLITES]#
float cnr0[2][NMEA_GSV_MAX_SATELLITES]#
float gamma[NMEA_GSV_MAX_SATELLITES]#
struct skymask#

Public Members

int npoints#
float azimuth[SKYMASK_MAX_POINTS]#
float elevation[SKYMASK_MAX_POINTS]#
az_center center#
file arcs.c
#include <memory.h>
#include “arcs.h
#include “position.h

Functions

int init_arc(arc *data)#
int free_arc(arc *data)#
int realloc_and_copy(void **dvec, size_t currentlen, size_t sz)#
int append_to_arc(arc *data, double mjd, float elevation, float azimuth, float value)#
int init_arc_buffer(arc_buffer *arcbuf, int expiry_sec, int max_arclen_sec)#
int free_arc_buffer(arc_buffer *arcbuf)#
arc *find_arcptr(arc_buffer *arcbuf, int prn)#
int new_arc(arc **arcptr, arc_buffer *arcbuf, int prn, const gnss_system *sys, const enu_position *site)#
int check_finalization(arc_buffer *arcbuf, double mjdcurrent)#
int append_cycle_data(const nmea_cycle *cyc, arc_buffer *arcbuf)#
int next_finalized_arc(const arc_buffer *abuf)#
int insert_new_arc(arc_buffer *abuf, int itharc)#
int purge_arc(arc_buffer *abuf, int itharc)#
file arcs.h
#include “gnssir.h
#include “nmea.h
#include “skymask.h

Defines

ARC_DATA_CHUNK#
ARC_FILL_VALUE#
ARC_BUFFER_SIZE#
ARC_FULL_BUFFER#

Typedefs

typedef enum arc_state arc_state
typedef struct arc arc
typedef struct arc_buffer arc_buffer

Enums

enum arc_state#

Values:

enumerator FINAL#
enumerator OPEN#

Functions

int init_arc(arc *data)
int free_arc(arc *data)
int append_to_arc(arc *data, double mjd, float elevation, float azimuth, float cnr0)
int init_arc_buffer(arc_buffer *arcbuf, int expiry_sec, int max_arclen_sec)
int free_arc_buffer(arc_buffer *arcbuf)
int append_cycle_data(const nmea_cycle *cyc, arc_buffer *arcbuf)
int next_finalized_arc(const arc_buffer *abuf)
int purge_arc(arc_buffer *abuf, int itharc)
int insert_new_arc(arc_buffer *abuf, int itharc)
file gnssir.c
#include “gnssir.h
#include <string.h>

Variables

const gnss_system gnss_unknown = GNSS_UNKNOWN#
const gnss_system gnss_gpsl1 = GPSL1#
const gnss_system gnss_gpsl2 = GPSL2#
file gnssir.h
#include <stdio.h>
#include <stdlib.h>

Defines

GNSSIR_SUCCESS#

ERROR and SUCCESS CODES.

GNSSIR_MEMORY_ERROR#
ALLOC(s)#
ALLOC_AND_ZERO(s)#
FREEMEM(p)#
F_FILL_VALUE#
SPEED_OF_LIGHT#
GNSS_BAND(FREQ, WMHZ, NAME, RINEXCODE)#
GPSL1#
GPSL2#
GPSL5#
QZSSL5#
QZSSL2C#
QZSSE6#
QZSSL1#
GLONASSIL1#
GLONASSIL2#
GLONASSIIL1#
GLONASSIIL2#
GNSS_UNKNOWN#
LOGWARNING#
warn_print(fmt, ...)#

Typedefs

typedef struct gnss_system gnss_system

Functions

void copy_GNSS_as(gnss_system *sys, const gnss_system *sysfrom)#

Variables

const gnss_system gnss_gpsl1
const gnss_system gnss_gpsl2
const gnss_system gnss_glonassiil1#
const gnss_system gnss_unknown
file lz4stream.c
#include “lz4stream.h
#include <stdlib.h>
#include <string.h>

Functions

lz4stream *open_lz4stream(const char *filename)#
int decompress_lz4_chunk(lz4stream *lzid)#
int readline_lz4(lz4stream *lzid, char *buffer, size_t slen)#
void close_lz4stream(lz4stream *lzid)#
file lz4stream.h
#include “lz4static/lz4.h”
#include “lz4static/lz4file.h”
#include <stdio.h>

Defines

LZ4_MAX_MESSAGE#
LZ4_RING_BUFFER#
LZ4_CHUNK_SIZE#
LZ4_ERROR#
LZ4_EOF#
LZ4_SUCCESS#
LZ4_LINEBUF_TOO_SMALL#

Typedefs

typedef struct lz4stream lz4stream

Functions

lz4stream *open_lz4stream(const char *filename)
void close_lz4stream(lz4stream *lzid)
int readline_lz4(lz4stream *lzid, char *buffer, size_t slen)
int decompress_lz4_chunk(lz4stream *lzid)
file nmea.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include “nmea.h
#include “timeutil.h

Functions

unsigned char calculate_checksum(const char *nmea)#
int shift_to_komma(const char **nmeaPtr, const char **kommaPtr, int skip)#
float convert_deg(const float deg)#
void extract_time(const char *nmeaPtr, int *hr, int *min, double *sec)#
int init_nmea_cycle(nmea_cycle *data)#
int init_nmea_trans_cycle(nmea_trans_cycle *data)#
nmea_type check_nmea(char *nmea)#
int read_nmea_cycle(gnssrstream *sid, nmea_cycle *data)#
int pair_nmea_trans_cycle(const nmea_cycle *c_obstr, const nmea_cycle *c_clear, int delta_sec, nmea_trans_cycle *tc_out)#

Create a transmissivity cycle from two individual cycles (no checks on matching time will be done!! (this is a user choice)

int update_nmea_RMC(const char *nmea, nmea_cycle *data)#
void get_gnss_system(const char *nmea, gnss_system *system)#
int update_nmea_GSV(const char *nmea, nmea_cycle *data)#
int update_nmea_GGA(const char *nmea, nmea_cycle *data)#
file nmea.h
#include <stdio.h>
#include <zlib.h>
#include <string.h>
#include “gnssir.h
#include “stream.h
#include “position.h

Defines

NMEA_BUFFER_SIZE#
NMEA_GSV_MAX_SATELLITES#
NMEA_FILL#

Typedefs

typedef enum nmea_type nmea_type
typedef struct nmea_trans_cycle nmea_trans_cycle
typedef struct nmea_cycle nmea_cycle

Enums

enum nmea_type#

Values:

enumerator NMEA_GGA#
enumerator NMEA_GSV#
enumerator NMEA_GLL#
enumerator NMEA_GSA#
enumerator NMEA_RMC#
enumerator NMEA_VTG#
enumerator NMEA_GNS#
enumerator NMEA_UNSUPPORTED#
enumerator NMEA_INVALID#

Functions

unsigned char calculate_checksum(const char *nmea)
int update_nmea_RMC(const char *nmea, nmea_cycle *data)
int update_nmea_GSV(const char *nmea, nmea_cycle *data)
int update_nmea_GGA(const char *nmea, nmea_cycle *data)
nmea_type check_nmea(char *nmea)
int init_nmea_cycle(nmea_cycle *data)
int init_nmea_trans_cycle(nmea_trans_cycle *data)
int read_nmea_cycle(gnssrstream *sid, nmea_cycle *data)
int pair_nmea_trans_cycle(const nmea_cycle *c_clear, const nmea_cycle *c_obstr, int delta_sec, nmea_trans_cycle *tc_out)

Create a transmissivity cycle from two individual cycles (no checks on matching time will be done!! (this is a user choice)

file position.c
#include “gnssir.h
#include “position.h

Functions

int init_enu_position(enu_position *data)#
int copy_enu_position(const enu_position *in, enu_position *out)#
int set_enu_position(enu_position *data, float lat, float lon, float ortho_height, float geoid_height, double mjd)#
file position.h

Typedefs

typedef struct enu_position enu_position

Functions

int init_enu_position(enu_position *data)
int copy_enu_position(const enu_position *in, enu_position *out)
int set_enu_position(enu_position *data, float lat, float lon, float ortho_height, float geoid_height, double mjd)
file skymask.c
#include “skymask.h

Functions

int within_mask(const skymask *skymsk, float azimuth, float elevation)#

Tests whether a point (azimuth, elevation) lies within a skymask polygon.

Uses a fast point-in-polygon test algorithm based on ray casting to determine if a given sky coordinate falls within the polygon defined by the skymask vertices.

See also

skymask

See also

az_center

Note

The azimuth value is automatically wrapped to match the skymask’s coordinate system center

Parameters:
  • skymsk – Pointer to the skymask structure containing polygon vertices

  • azimuth – The azimuth angle in degrees of the point to test

  • elevation – The elevation angle in degrees of the point to test

Returns:

1 if the point is inside the polygon, 0 if outside, 2 if on the edge

int init_skymask(skymask *skymsk)#
int add_polypoint(skymask *skymsk, float azimuth, float elevation)#
int close_poly(skymask *skymsk)#
int setup_simple_skymask(skymask *skymsk, float min_az, float max_az, float min_el, float max_el)#
float wrap_azimuth(float azimuth, az_center center)#

Wraps azimuth angle to match the specified azimuth center (0 or 180 degrees).

Converts azimuth angles between two coordinate systems:

  • D180 center: Range [0, 360) degrees

  • D0 center: Range [-180, 180) degrees

Note

If azimuth is negative and center is D180, adds 360 to convert to [0,360) range

Note

If azimuth is greater than 180 and center is D0, subtracts 360 to convert to [-180,180) range

Note

If no conversion is needed, returns the original azimuth value

Parameters:
  • azimuth – The azimuth angle in degrees to be wrapped

  • center – The target coordinate system center (see az_center enum in skymask.h)

Returns:

The wrapped azimuth angle in the target coordinate system

file skymask.h
#include “gnssir.h

Defines

SKYMASK_MAX_POINTS#
SKYMASK_FULL#
SKYMASK_INVALID#

Typedefs

typedef enum az_center az_center
typedef struct skymask skymask

Enums

enum az_center#

Defines the azimuthal center point for a skymask polygon.

This enumeration specifies different coordinate system conventions for representing azimuth angles, determining whether angles are centered around 0° or 180°.

Values:

enumerator D0#

Center at 0°: Azimuth range is [-180°, 180°)

enumerator D180#

Center at 180°: Azimuth range is [0°, 360°)

enumerator DUNK#

Unknown or unspecified center (value: 1)

Functions

int init_skymask(skymask *skymsk)
int within_mask(const skymask *skymsk, float azimuth, float elevation)

Tests whether a point (azimuth, elevation) lies within a skymask polygon.

Uses a fast point-in-polygon test algorithm based on ray casting to determine if a given sky coordinate falls within the polygon defined by the skymask vertices.

See also

skymask

See also

az_center

Note

The azimuth value is automatically wrapped to match the skymask’s coordinate system center

Parameters:
  • skymsk – Pointer to the skymask structure containing polygon vertices

  • azimuth – The azimuth angle in degrees of the point to test

  • elevation – The elevation angle in degrees of the point to test

Returns:

1 if the point is inside the polygon, 0 if outside, 2 if on the edge

int add_polypoint(skymask *skymsk, float azimuth, float elevation)
int close_poly(skymask *skymsk)
int setup_simple_skymask(skymask *skymsk, float min_az, float max_az, float min_el, float max_el)
float wrap_azimuth(float azimuth, az_center center)

Wraps azimuth angle to match the specified azimuth center (0 or 180 degrees).

Converts azimuth angles between two coordinate systems:

  • D180 center: Range [0, 360) degrees

  • D0 center: Range [-180, 180) degrees

Note

If azimuth is negative and center is D180, adds 360 to convert to [0,360) range

Note

If azimuth is greater than 180 and center is D0, subtracts 360 to convert to [-180,180) range

Note

If no conversion is needed, returns the original azimuth value

Parameters:
  • azimuth – The azimuth angle in degrees to be wrapped

  • center – The target coordinate system center (see az_center enum in skymask.h)

Returns:

The wrapped azimuth angle in the target coordinate system

file stream.c
#include <stdio.h>
#include <string.h>
#include “gnssir.h
#include “stream.h

Functions

int open_stream(const char *filename, gnssrstream *sid)#
void close_stream(gnssrstream *sid)#
int readline(gnssrstream *sid, char *buffer, size_t slen)#
file stream.h
#include <string.h>
#include <stdio.h>

Defines

GNSSR_IO_ERROR#
GNSSR_EOF#
GNSSR_SUCCESS#
GNSSR_NOMATCH#

Typedefs

typedef struct gnssrstream gnssrstream

Enums

enum stream_type#

Values:

enumerator UNCOMPRESSED#

Functions

int open_stream(const char *filename, gnssrstream *strid)
int readline(gnssrstream *strid, char *buffer, size_t slen)
void close_stream(gnssrstream *strid)
int eof(gnssrstream *strid)#
file timeutil.c

Functions

double mjd(const int year, const int month, const int day, const int hour, const int minute, const double second)#
void mjd_to_datetime(double mjd, int *year, int *month, int *day, int *hour, int *minute, double *second)#
file timeutil.h

Functions

double mjd(const int year, const int month, const int day, const int hour, const int minute, const double seccond)
void mjd_to_datetime(double mjd, int *year, int *month, int *day, int *hour, int *minute, double *second)
dir /home/docs/checkouts/readthedocs.org/user_builds/gnssr4water/envs/latest/lib/python3.12/site-packages/gnssir/src