.. _tutorials/sinex: Sinex Files ============ Geodepy has the ability to read and write sinex files. Below we will explore how to read certain parts of a sinex file and ultimately how to write a new sinex file. In this tutorial the sinex file "STR1AUSPOS.SNX" found in the docs folder will be used. This was generated using AUSPOS. Reading Sinex Files ------------------- Sinex files are split into different blocks all containing different types of information. These blocks are deliniated by a starting line that uses a "+BLOCKNAME" and an ending line using a "-BLOCKNAME". The blocks found in a sinex file can be printed using the read_sinex_blocks function as seen below. .. code:: python import geodepy.gnss geodepy.gnss.read_sinex_blocks("GeodePy/docs/tutorials/STR1AUSPOS.SNX") >>FILE/REFERENCE >>INPUT/ACKNOWLEDGMENTS >>SOLUTION/STATISTICS >>... Particular blocks can be read using other GeodePy functions. Below the acknowledgments block will be read. .. code:: python print(geodepy.gnss.read_sinex_input_acknowledgments_block("GeodePy/docs/tutorials/STR1AUSPOS.SNX")) >>['+INPUT/ACKNOWLEDGMENTS', '*AGY DESCRIPTION________________________________________________________________', ' XYZ My agency/institute and its address', ' IGS International GNSS Service', '-INPUT/ACKNOWLEDGMENTS'] All blocks that can be read by GeodePy can be found in the :ref:`sinex features ` page. If a certain block is needed that can't be found here, any lines can be read using the read_sinex_custom function as seen below. .. code:: python print(geodepy.gnss.read_sinex_custom( "GeodePy/docs/tutorials/STR1AUSPOS.SNX", #file name 5, #start line 6 #end line )) >>['DESCRIPTION My agency/institute', 'OUTPUT One-session solution generated by RNX2SNX BPE'] Writing Sinex Files ------------------- GeodePy can also be used to write new sinex files. This is done using the writeSINEX function. This function uses many of the read sinex functions to create blocks. Below we will explore the process of taking a sinex file and writing a new sinex file with only a select few blocks. .. code:: python import geodepy.gnss #The blocks in new file will be header, site ID and solution epochs headerSTR1 = geodepy.gnss.read_sinex_header_block("GeodePy/docs/tutorials/STR1AUSPOS.SNX") siteIDSTR1 = geodepy.gnss.read_sinex_site_id_block("GeodePy/docs/tutorials/STR1AUSPOS.SNX") epochSTR1 = geodepy.gnss.read_sinex_solution_epochs_block("GeodePy/docs/tutorials/STR1AUSPOS.SNX") geodepy.gnss.writeSINEX( "GeodePy/docs/tutorials/STR1AUSPOS_new.SNX", #new file path header=headerSTR1, #header str siteID=siteIDSTR1, #siteID str solutionEpochs=epochSTR1 #solution Epochs str ) This file can also be found in the docs folder.