obsinfo.main package
obsinfo.main.makeStationXML module
obsinfo.main.print module
obsinfo.main.setupObsinfo module
Application to configure variables used by obsinfo in file .obsinforc and to copy examples and templates out of the distribution directories
- obsinfo.main.setupObsinfo.build_datapath_list(args, remote_repository)
Build datapath as a list of directories to search, similar to the PATH environment variable.
Add working_directory as first option if it exists
Next add local repository first if it exists (wll be first if no working directory specified)
Finally add destination, where standard examples lie. This won’t be used if -x is on
Final directory will be the remote one unless -v (invert) is specified
- obsinfo.main.setupObsinfo.retrieve_arguments()
Parse command line arguments
- Returns
arguments, both status and directory names
- Return type
parse_args (dict)
- obsinfo.main.setupObsinfo.setup_obsinfo()
Entry point to configure variables in file .obsinforc
and to copy examples and templates out of the distribution directories
- obsinfo.main.setupObsinfo.validate_arguments(args)
Validate that directories in command line arguments exist. Raise an exception if not.
- Parameters
args (dictionary of strings) – directory with command line argument, but status and directories
:raises OSError, ValueError
obsinfo.main.validate module
Main functions for obsinfo-validate.
obsinfo strongly follows the hierarchy of StationXML files.
Module contains both class ValidateObsinfo and a main entry point for obsinfo-validate
- class obsinfo.main.validate.ValidateObsinfo
Bases:
object
Contains methods to validate each level of information files.
- datapath
Store datapath list(s)
- Type
/.Datapath
- verbose
Prints progress messages
- Type
bool
- remote
Indicates file in command line argument is to be found using datapath
- Type
bool
- debug
Print more detailed messages.
- Type
bool
- assertTextFilesEqual(first, second, msg=None)
Compares two text files
- Parameters
first (str) – First file to compare
second (str) – Second file to compare
msg (str) – Message to print in case of failure
- setUp(verbose=True, remote=False, debug=False)
Set up status variables according to .obsinforc and command line arguments.
- Parameters
verbose (bool) – Print several progress messages
remote (bool) – Find file in command line argument using datapath
debug (bool) – Print more detailed messages and enable traceback of exceptions
Returns: self
- validate_all_components()
Validate all information files in each components (sensor, preamplifier, datalogger) subdirectory as given by datapath
- validate_all_filters()
Validate all filter files in datapath/<component>/responses/filters/”
- validate_all_instrumentations()
Validate all instrumentation files in datapath/instrumentation/
- validate_all_networks()
Validate all network files in datapath/network/
- validate_all_stages()
Validate all stage files in datapath/<component>/responses/
- validate_files(files, filetype)
Validate all files of a given type
- Parameters
files (
Path
) – Full paths of files (including wildcards)filetype (str) – information file type
- validate_filters_in_directory(dir)
Validate all information files in filter directory.
- Parameters
dir (str) – directory where filter files reside
- validate_single_file(info_file, filetype)
Validate a single obsinfo file.
- Parameters
info_file (str) – info file to validate. No assumptions made about path.
filetype (str) – the information file type
- validate_stages_in_directory(dir)
Validate all information files in stage directory as given by datapath.
- Parameters
1dir (str) – directory where stage files reside
- obsinfo.main.validate.init_logging()
Create or open a rotating logging file and add it to ObsinfoConfiguration
- Returns
object of Logger class
- obsinfo.main.validate.main()
Entry point for obsinfo-validate.
Setups status variables from command line arguments.
Validates file according to file type contained in name
Manages all uncaught exceptions
- obsinfo.main.validate.retrieve_arguments()
Retrieve arguments from command line. Setup several status variables and get information file name
- Returns
dictionary object with all status variables and information file name.