Package: bas-gloria
gloriaThis project enables GLORIA .dat files to be read, rewritten, and converted.The gloria packageTheGLORIAFileclass is a context manager for GLORIA files.  The class contains methods for reading the scan header and data in the .dat file, rewriting the scan header and subsetting the data, and converting the file to netCDF4.InstallThe package can be installed from PyPI (note the package distribution name):$pipinstallbas-gloriaSimple utility scriptsThe package contains a number of scripts for converting from/to netCDF, plotting the data etc.  When installing the package (e.g., viapip install) then these scripts are available as commands and added to thePATH.  So for instance, you can just callgloria_to_nc.  If running the scripts from acloneof the source code repository, then they need to be run as modules, e.g.python -m gloria.gloria_to_nc.gloria_to_nc.pyThis script converts a GLORIA .dat file to netCDF4.  The default output netCDF filename has the same name as the input .dat file, but with a .nc file suffix.  Optionally an alternative output netCDF filename can be explicitly given.python3-mgloria.gloria_to_ncinfile.dat[outfile.nc]Each scan (header and data) appears as a netCDF4 group in the output file.  The group is namedscan<n>, where<n>is the scan number.  The scan header items become attributes of the group in the netCDF file, and the data are stored as asonar_samples-long 1D data array.gloria_to_txt.pyThis script converts a GLORIA .dat file to a simple ASCII text file.  The output text filename has the same name as the input .dat file, but with a .txt file suffix.  Optionally an alternative output text filename can be explicitly given.python3-mgloria.gloria_to_txtinfile.dat[outfile.txt]The format of the text file is a straightforward rendering of the binary .dat format to text, i.e. for each scan, the header items are output followed by the data.plot_gloria.pyThis script will plot the scans from the given file as a sonargram, in its default mode (--sonargram).  In its other mode (--scans), it will plot samples from the firstnrowsxncolsscans, in annrowsbyncolsgrid of plots.  By defaultnrows=ncols= 1, hence only the first scan is plotted.  The file can be either a GLORIA .dat file, or a converted netCDF file.python3-mgloria.plot_gloria[-h][-r|-s][-gNROWSNCOLS][-cCONTRAST][-mCMAP][-oout_file.{png,tiff,pdf}]in_file.{dat,nc}[out_file.{png,tiff,pdf}]Alternatively, instead of displaying the plot, the script can save the plot to an output file.  This can be speficied byeitherthe--output-fileoption,orsimply as a second, optional positional argument, for example to save as a PNG:python3-mgloria.plot_gloriain_file.datout_file.pngWhen saving the plot, any of the formats supported by matplotlib can be specified by using the appropriate file suffix.  For example, an output file namedout_file.tiffwill save as a TIFF file,out_file.pdfwill save as a PDF etc.read_gloria.pyThis script will read the given GLORIA .dat file, and print the number of scans in the file, and a summary of the first scan.  This summary contains the length of the sonar samples array, the scan header, and theheadof the data array (by default the first 10 samples), to give an initial simple look at the data.The script's primary purpose is as a simple example of how to use theGLORIAFileclass to read a GLORIA .dat data file.python3-mgloria.read_gloriafilename.datwrite_gloria.pyThis script will read the given input GLORIA .dat file, and write the scans (header and data) to the given output GLORIA .dat file.  Optionally a subset of the input data can be written out, specified as the firstscansscans, and the firstsamplessamples of these scans.  Ifscansandsamplesare not specified, then the output file is identical to the input file.  Note that as the GLORIA record format is fixed-width, when subsetting samples the unwanted samples are actually set to zero, to preserve the correct record length.The script's primary purpose is as a simple example of how to use theGLORIAFileclass to rewrite a GLORIA .dat data file.python3-mgloria.write_gloria[-sSCANS][-aSAMPLES]infile.datoutfile.dat