Sinex¶
This module includes functions for dealing with sinex files.
Reading Sinex Files¶
- geodepy.gnss.list_sinex_blocks(file)[source]¶
This script lists the blocks in a SINEX file
- Parameters:
file (str) – the input SINEX file
- geodepy.gnss.read_sinex_comments(file)[source]¶
This function reads comments in a SINEX file.
- Parameters:
file (str) – the input SINEX file
- Returns:
comments block
- Return type:
list of strings
- geodepy.gnss.read_sinex_header_line(file)[source]¶
This function reads the header line of a SINEX file into a string
- Parameters:
file (str) – the input SINEX file
- Returns:
header_line
- Return type:
str
- geodepy.gnss.read_sinex_custom(fp, start_line, end_line)[source]¶
Read custom line range from SINEX. Useful for SINEX with irregular formatting or block that has not been accounted for.
- Parameters:
fp (str) – Path to SINEX file.
start_line (int) – Beginning line number.
end_line (int) – Finishing line number.
- Return list custom:
List of string(s).
- geodepy.gnss.read_sinex_estimate(file)[source]¶
This function reads in the SOLUTION/ESTIMATE block of a SINEX file. It returns estimate, a list of tuples:
estimate = [(code, soln, refEpoch, staX, staY, staZ, staX_sd, staY_sd, staZ_sd[, velX, velY, velZ, velX_sd, velY_sd, velZ_sd])…]
- where:
code is the stations’s 4-character ID
soln is the segment of the stations’s time series
refEpoch is the epoch of the solution in the form YY:DOY:SSSSS (YY is the two digit year, DOY is day of year, and SSSSS is the time of day in seconds
sta[XYZ] is the station coordinates in the Cartesian reference frame
sta[XYZ]_sd is the standard deviation of the station coordinates in the Cartesian reference frame
vel[XYZ] is the station velocity in the Cartesian reference frame
vel[XYZ]_sd is the standard deviation of the station velocity in the Cartesian reference frame
Velocities are not included in all SINEX files and so are only returned if present.
- Parameters:
file – the input SINEX file
- Returns:
Sinex estimates as list of lists
- geodepy.gnss.read_sinex_matrix(file)[source]¶
This function reads in the SOLUTION/MATRIX_ESTIMATE block of a SINEX file. It returns matrix, a list of tuples:
matrix = [(code, soln, var_x, covar_xy, covar_xz, var_y, covar_yz, var_z[, var_v_x, covar_v_xy, covar_v_xz, var_v_y, covar_v_yz, var_v_z])…]
- where:
code is the stations’s 4-character ID
soln is the segment of the stations’s time series
var_x is the variance in the X coordinate
covar_xy is the covariance between the X and the Y coordinates
covar_xz is the covariance between the X and the Z coordinates
var_y is the variance in the Y coordinate
covar_yz is the covariance between the Y and the Z coordinates
var_z is the variance in the Z coordinate
var_v_x is the variance in the X velocity
covar_v_xy is the covariance between the X and the Y velocities
covar_v_xz is the covariance between the X and the Z velocities
var_v_y is the variance in the Y velocity
covar_v_yz is the covariance between the Y and the Z velocities
var_v_z is the variance in the Z velocity
Velocities are not included in all SINEX files and so their VCV information is only returned if they are present.
- Parameters:
file – the input SINEX file
- Returns:
Sinex matrix as list of lists
- geodepy.gnss.read_sinex_sites(file)[source]¶
This function reads in the SITE/ID block of a SINEX file. It returns sites, a list of tuples:
sites = [(site, point, domes, obs, station_description, lon, lat, h)]
- where:
site is the site code
point is the site’s point code
domes is the site’s dome number
obs is the observation technique
station_description is a free format desciption of the site
lon is the approximate longitude of the site as a DMSAngle object
lat is the approximate latitude of the site as a DMSAngle object
h is the approximate height of the site
- Parameters:
file – the input SINEX file
- Returns:
sites
- geodepy.gnss.read_disconts(file)[source]¶
This function reads in the SOLUTION/DISCONTINUITY block of a SINEX file. It returns disconts , a list of tuples:
sites = [(site, code1, point, code2, start, end, type)]
- where:
site is the site code
code1 is unknown
point is the site’s point code
code2 is unknown
start is the start time for the point code in YY:DOY:SECOD
end is the end time for the point code in YY:DOY:SECOD
type is the type of discontinuity; P for position or V for velocity
I could not find the format description for this block.
- Parameters:
file – the input discontinuities file
- Returns:
disconts
- geodepy.gnss.read_solution_epochs(file)[source]¶
This function reads in the SOLUTION/EPOCHS block of a SINEX file. It returns epochs, a list of tuples:
epochs = [(site, point, sol, obs, start, end, mean)]
- where:
site is the site code
point is the site’s point code
sol is the solution number at a site/point
obs is the observation technique
start is the start time for the solution in YY:DOY:SECOD
end is the end time for the solution in YY:DOY:SECOD
mean is the mean time for the solution in YY:DOY:SECOD
- Parameters:
file – the input SINEX file
- Returns:
epochs
- geodepy.gnss.read_sinex_header_block(sinex)[source]¶
This function reads in the header block information of a SINEX file (All lines before the SITE/ID block).
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_file_reference_block(sinex)[source]¶
This function reads in the +FILE/REFERENCE block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_input_acknowledgments_block(sinex)[source]¶
This function reads in the +INPUT/ACKNOWLEDGMENTS block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_solution_statistics_block(sinex)[source]¶
This function reads in the +SOLUTION/STATISTICS block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_site_receiver_block(sinex)[source]¶
This function reads in the +SITE/RECEIVER block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_site_antenna_block(sinex)[source]¶
This function reads in the +SITE/ANTENNA block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_site_gps_phase_center_block(sinex)[source]¶
This function reads in the +SITE/GPS_PHASE_CENTER block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_site_eccentricity_block(sinex)[source]¶
This function reads in the +SITE/ECCENTRICITY block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_site_id_block(sinex)[source]¶
This function reads in the SITE/ID block of a SINEX file into list of strings.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_solution_epochs_block(sinex)[source]¶
This function reads in the SOLUTION/EPOCHS block of a SINEX file into list of strings.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_solution_estimate_block(sinex)[source]¶
This function reads in the SOLUTION/ESTIMATE block of a SINEX file into list of strings.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
- geodepy.gnss.read_sinex_solution_apriori_block(sinex)[source]¶
This function reads in the +SOLUTION/APRIORI block of a SINEX file.
- Parameters:
sinex (str) – input SINEX file
- Returns:
block
Writing Sinex Files¶
- geodepy.gnss.print_sinex_comments(file)[source]¶
This script prints comments in a SINEX file.
- Parameters:
file (str) – the input SINEX file
- geodepy.gnss.set_creation_time()[source]¶
This function sets the creation time, in format YY:DDD:SSSSS, for use in the SINEX header line
- Returns:
creation_time
- Return type:
str
- geodepy.gnss.dataframe2sinex_solution_estimate(df)[source]¶
This function reads in a dataframe of the SOLUTIONS/ESTIMATE block from a SINEX, then converts each row to a string in a list ready for writing to SINEX.
- Parameters:
df (dataframe) – dataframe of SOLUTION/ESTIMATE block
- Returns:
list of strings
- geodepy.gnss.dataframe2sinex_solution_apriori(df)[source]¶
This function reads in a dataframe of the SOLUTION/APRIORI block from a SINEX, then converts each row to a string in a list ready for writing to SINEX.
- Parameters:
df (dataframe) – dataframe of SOLUTION/APRIORI block
- Returns:
list of strings
- geodepy.gnss.dataframe2matrix_snx_vcv(df, numPar=3)[source]¶
This function converts a dataframe created from a SINEX VCV based from read_sinex_matrix(), and converts it to a full VCV without covariances between sites.
i.e. xx xy xz 0 0 0 xy yy yz . . . 0 0 0 xz yz zz 0 0 0 . . . . . . . . . 0 0 0 xx xy xz 0 0 0 . . . xy yy yz 0 0 0 xz yz zz- Parameters:
DataFrame – dataframe formed from read_sinex_matrix():
- Returns:
Numpy matrix of VCV with no covariances between sites.
- geodepy.gnss.dataframe2matrix_solution_matrix_estimate(df, tri='L')[source]¶
This function reads in a dataframe of the SINEX SOLUTION/MATRIX_ESTIMATE block formed from sinex2dataframe_solution_matrix_estimate(), and then forms the full VCV matrix from that dataframe.
- Parameters:
df (DataFrame) – dataframe from sinex2dataframe_solution_matrix_estimate().
tri (String) – String to indicate “upper” or “lower” triagle matrix.
- Returns:
Numpy matrix of full VCV.
- geodepy.gnss.dataframe2sinex_solution_matrix_estimate(df, tri='L')[source]¶
This function reads in a dataframe of the SOLUTIONS/MATRIX_ESTIMATE block from a SINEX, the converts each row to a string in a list ready for writing to SINEX.
- Parameters:
df (dataframe) – dataframe of SOLUTION/ESTIMATE block
- Returns:
list of strings
- geodepy.gnss.writeSINEX(fp, header=None, comment=None, siteID=None, solutionEpochs=None, solutionEstimate=None, solutionMatrixEstimate=None, fileReference=None, inputAcknowledgments=None, solutionStatistics=None, siteReceiver=None, siteAntenna=None, siteGpsPhaseCenter=None, siteEccentricity=None, solutionApriori=None, solutionMatrixApriori=None)[source]¶
This function writes out SINEX blocks to a new SINEX file. The SINEX blocks can be obtained from many of the
read_sinex_...()functions when writing the same input to output. Or can use thedataframe2sinex_...()functions when SINEX manipulations have occurred on that specific block. Input arguments are set to ‘None’ by default. This allows user to only write out the required blocks.- Parameters:
fp (str) – Full filepath to output SINEX.
header (str) – Single header line. Can get from read_sinex_header_line().
comment (list of str) – +FILE/COMMENT block. Can get from read_sinex_comments().
SiteID (list of str) – +SITE/ID block. Can get from read_sinex_site_id_block().
SolutionEpochs (list of str) – +SOLUTION/EPOCHS block. Can get from read_sinex_solution_epochs_block().
SolutionEstimate (list of str) – +SOLUTION/ESTIMATE block. Can get from read_sinex_solution_estimate_block().
SolutionMatricEstimate (list of str) – +SOLUTION/MATRIX_ESTIMATE block. Can get from read_sinex_solution_matrix_estimate_block().
fileReference (list of str) – +FILE/REFERENCE block. Can get from read_sinex_file_reference_block().
inputAcknowledgments (list of str) – +INPUT/ACKNOWLEDGEMENTS block. Can get from read_sinex_input_acknowledgments_block().
siteReceiver (list of str) – +SITE/RECEIVER block. Can get from read_sinex_site_receiver_block().
siteAntenna (list of str) – +SITE/ANTENNA block. Can get from read_sinex_site_antenna_block().
siteGpsPhaseCenter (list of str) – +SITE/GPS_PHASE_CENTER block. Can get from read_site_gps_phase_center_block().
siteEccentricity (list of str) – +SITE/ECCENTRICITY block. Can get from read_sinex_site_eccentricity_block().
solutionApriori (list of str) – +SOLUTION/APRIORI block. Can get from read_sinex_solution_apriori_block().
solutionMatrixApriori (list of str) – +SOLUTION/MATRIX_APRIORI block. Can get from read_sinex_solution_matric_apriori_block().
- Returns:
No return. But a new SINEX file will be written out to the file path (fp).
Converting Sinex Data to DataFrames¶
- geodepy.gnss.matrix2dataframe_solution_matrix_estimate(m, tri='L')[source]¶
This function reads a VCV in matrix format and writes it to dataframe for SINEX SOLUTION/MATRIX_ESTIMATE format. It is the format produced from sinex2dataframe_solution_matrix_estimate().
- Parameters:
m (numpy.array()) – A numpy array of the VCV matrix.
tri (str) – String to indicate “upper” or “lower” triagle matrix.
- Returns:
A dataframe of SOLUTION/MATRIX_ESTIMATE.
- Return type:
DataFrame
- geodepy.gnss.sinex2dataframe_solution_estimate(fp)[source]¶
This function reads in a SINEX file and returns a dataframe of SOLUTION/ESTIMATE block only.
- Parameters:
sinex (str) – path of input SINEX file
- Returns:
df
Specific Sinex Functions¶
- geodepy.gnss.remove_stns_sinex(sinex, sites)[source]¶
This function removes a list sites from a SINEX file
- Parameters:
sinex – input SINEX file
sites – list of the sites to be removed
- Returns:
SINEX file output.snx