geodezyx.files_rw package

Subpackages

Submodules

geodezyx.files_rw.geo_files_converter_lib module

@author: psakic

This sub-module of geodezyx.files_rw deals with file format conversion between different file standards .

it can be imported directly with: from geodezyx import files_rw

The geodezyx toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU LGPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (IPGP, sakic@ipgp.fr) GitHub repository : https://github.com/IPGP/geodezyx

geodezyx.files_rw.geo_files_converter_lib.convert_statinfo2eqfile(statinfoin, eqfileout)
geodezyx.files_rw.geo_files_converter_lib.header_from_ellipsoid(ellipsoid)
geodezyx.files_rw.geo_files_converter_lib.list_stat_in_statinfo(statinfoin)
geodezyx.files_rw.geo_files_converter_lib.plot_nmea(T, E, N, U, Q)

a quick and dirty fct to plot the NMEA

geodezyx.files_rw.geo_files_converter_lib.read_OTPS_tide_file(pathin, print_line=False, return_array=True)
Return :

latlis , lonlis , datlis , hlis

geodezyx.files_rw.geo_files_converter_lib.read_eqfile_as_dico(filein, delGPSfield=False)

for an eqfile return a dico dic[STAT] = [disc1 , disc2 …] where disc are the discont of the FIRST column

delGPSfield manage the elimination of the line of type _GPS which are not regular EDIT : 150817 WHY ???

geodezyx.files_rw.geo_files_converter_lib.read_eqfile_time_solo(filein, stat)

BROUILLON pour une station, donne les startdate et enddate d’une periode SORTIE : 2 x liste de dt

geodezyx.files_rw.geo_files_converter_lib.read_globk_vel_file(velfile_in)
geodezyx.files_rw.geo_files_converter_lib.read_lfile_solo(filein, stat)

WEAK : should be improved with discontinuites management

geodezyx.files_rw.geo_files_converter_lib.read_nmea(file_path, outtype='FLH', df_out=True, use_altitude=False, startdate=datetime.datetime(1980, 1, 1, 0, 0), enddate=datetime.datetime(2099, 1, 1, 0, 0), export_path='')

if export_path != ‘’, export a Matlab readable file to this path WARNING !!! la coord de ref est codée en dur, à coriger !!!!

geodezyx.files_rw.geo_files_converter_lib.read_pbo_vel_file_solo(velfilein, stat)

return a LIST of panda dataframe (corrsponding to different discontinuites), where the keywords of the pbo .vel can be used directly

exemple : ftp://data-out.unavco.org/pub/products/velocity/pbo.final_nam08.vel

geodezyx.files_rw.geo_files_converter_lib.read_rinex_2_dataobjts(rinex_path)
geodezyx.files_rw.geo_files_converter_lib.read_sinex_discontinuity_solo(snxfile, stat, PorV='p')
geodezyx.files_rw.geo_files_converter_lib.read_station_info_solo(filein, stat, column_type='ulr')
column_typestr

“ulr” or “sopac”

geodezyx.files_rw.geo_files_converter_lib.read_station_info_solo_date(filein, stat, date, column_type='ulr')
geodezyx.files_rw.geo_files_converter_lib.read_station_info_time_solo(filein, stat)

BROUILLON pour une station, donne les startdate et enddate d’une periode SORTIE : 2 x liste de dt

geodezyx.files_rw.geo_files_converter_lib.receptor_gins_corrector(inRec)
geodezyx.files_rw.geo_files_converter_lib.smart_elt_list(list_raw, n_elt, replacement='')
geodezyx.files_rw.geo_files_converter_lib.stat_file_gins_new_fmt(file_out_path, STAT='STAT', xyz=[0.0, 0.0, 0.0], ecc_une=[0.0, 0.0, 0.0], rec='NONE', ant='NONE', radom='NONE', ant_id='0000')
geodezyx.files_rw.geo_files_converter_lib.stat_list_in_station_info(filein)
geodezyx.files_rw.geo_files_converter_lib.statinfo_2_cats(statinfo_path, catsneu_path)
geodezyx.files_rw.geo_files_converter_lib.station_info_2_gins(statinfoin, coordfilein, outfile, coordfile_type='pbovelfile', specific_stats_lis=[], ellipsoid='GRS80', station_info_columns_type='sopac')

Convert a GAMIT station.info to a GINS stations files

Parameters:
  • statinfoin (str) – path of input station.info.

  • coordfilein (str) – path of input coordinates files.

  • outfile (str) – path of output GINS station file.

  • coordfile_type (str, optional) – GAMIT coordinates files type : ‘lfile’ or ‘pbovelfile’. The default is ‘pbovelfile’.

  • specific_stats_lis (list, optional) – list of specific stations. The default is [].

  • ellipsoid (str, optional) – ellipsoid. The default is ‘GRS80’.

  • station_info_columns_type (TYPE, optional) – it exists different subtypes of station.info … handles “sopac” or “ulr” yet. The default is “sopac”.

Returns:

outfile – path of GINS outfile.

Return type:

str

geodezyx.files_rw.geo_files_converter_lib.statname_of_catsfile(catsneu_path)
geodezyx.files_rw.geo_files_converter_lib.unzip_gz(inp_gzip_file, out_gzip_dir=None, out_gzip_fname=None, remove_inp=False, force=False, verbose=True)

unzip a gzip file

Parameters:
  • inp_gzip_file (str) – the path of the input gzip file.

  • out_gzip_dir (str, optional) – output directory. If not precised, file will be extracted in the same folder as inp_gzip_file. The default is None.

  • out_gzip_fname (str, optional) – output filename. If not precised, file will be extracted with the same name as inp_gzip_file without the .gz extension. The default is None.

  • remove_inp (bool, optional) – remove the input file. The default is False.

  • force (bool, optional) – force the decompression. The default is False.

geodezyx.files_rw.geo_files_converter_lib.unzip_gz_z(inp_gzip_file, out_gzip_file='', remove_inp=False, force=False, out_gzip_dir=None)

frontend function to unzip files (gzip and legacy Z compression)

This function is complex and should be used with care, especially for .Z files. Prefer using new function unzip_gz for .gz files and avoid .Z files if possible.

Parameters:
  • inp_gzip_file (str) – the path of the input file.

  • out_gzip_file (str, optional) – if out_gzip_file AND out_gzip_dir not precised file will be extracted in the same folder as inp_gzip_file. The default is ‘’.

  • remove_inp (bool, optional) – remove the input file. The default is False.

  • force (bool, optional) – force the decompression. The default is False.

  • out_gzip_dir (str, optional) – output directory. will be used only if out_gzip_file == ‘’ unzipped file will keep the same

Returns:

path of the uncompressed file.

Return type:

out_gzip_file

Warning

.Z decompression is implemented, but is very unstable (avoid .Z, prefer .gz)

geodezyx.files_rw.geo_files_converter_lib.write_eqfile_from_dico(dicoin, outdir, outfilename)
geodezyx.files_rw.geo_files_converter_lib.write_latlontime_file_4_OTPS_tide(outfilepath, lat, lon, strt, end=None, sec_step=1, generate_inp_file=True, tide_model_path='./DATA/Model_atlas', set_relative_path_in_inp_file=True)
Parameters:
  • outfilepath (TYPE) – DESCRIPTION.

  • lat (TYPE) – DESCRIPTION.

  • lon (TYPE) – DESCRIPTION.

  • strt (datetime) – start as a datetime.

  • end (TYPE, optional) – length of the period in sec (integer) OR if None, strt is a list. The default is None.

  • sec_step (TYPE, optional) – DESCRIPTION. The default is 1.

  • generate_inp_file (TYPE, optional) – DESCRIPTION. The default is True.

  • tide_model_path (TYPE, optional) – DESCRIPTION. The default is ‘./DATA/Model_atlas’.

  • set_relative_path_in_inp_file (TYPE, optional) – DESCRIPTION. The default is True.

Returns:

outdir – DESCRIPTION.

Return type:

TYPE

Note

lat>0 - degrees North, lon>0 - degrees East lat<0 - degrees South, lon<0 - degrees West

lat/lon can be a list, with the same size as dates_lis

geodezyx.files_rw.geo_files_converter_lib.write_lfile_from_datalists(site_lis, location_lis, lfile_out_path)

datalists (period_lis_lis , stat_lis , loc_lis ) are produced by : * mono_logsheet_read * multi_logsheet_read

geodezyx.files_rw.geo_files_converter_lib.write_station_file_gins_from_datalists(period_lis_lis, site_lis, location_lis, station_info_out_path, ellipsoid='GRS80')

datalists (period_lis_lis , stat_lis , loc_lis ) are produced by : * mono_logsheet_read * multi_logsheet_read

geodezyx.files_rw.geo_files_converter_lib.write_station_file_gins_from_rinex(rinex_path, station_file_out, stat_code_filename_prioritary=True)
geodezyx.files_rw.geo_files_converter_lib.write_station_info_from_datalists(period_lis_lis, site_lis, location_lis, station_info_out_path)

Write station information from data lists to station.info file.

Parameters:
  • period_lis_lis (list of lists) – list of lists of periods.

  • site_lis (list) – list of sites.

  • location_lis (list) – list of locations.

  • station_info_out_path (str) – the full path (directory+name) of the generated station.info.

Return type:

None

Notes

The different data lists (i.e. period_lis_lis , stat_lis , loc_lis) are produced by:

  • mono_logsheet_read do not forget to activate return_lists = True

  • multi_logsheet_read do not forget to activate return_dico = False