CheckSuite#

class compliance_checker.suite.CheckSuite(options=None)[source]#

Methods

add_plugin_args(parser)

Add command line arguments for external plugins that generate checker classes

build_structure(check_name, groups, source_name)

Compiles the checks, results and scores into an aggregate structure which looks like:

checker_html_output(check_name, groups, ...)

Renders the HTML output for a single test using Jinja2 and returns it as a string.

dict_output(check_name, groups, source_name, ...)

Builds the results into a JSON structure and writes it to the file buffer.

generate_dataset(cdl_path)

Use ncgen to generate a netCDF file from a .cdl file Returns the path to the generated netcdf file.

html_output(checkers_html)

Renders the HTML output for multiple tests and returns it as a string.

load_all_available_checkers()

Helper method to retrieve all sub checker classes derived from various base classes.

load_dataset(ds_str)

Returns an instantiated instance of either a netCDF file or an SOS mapped DS object.

load_generated_checkers(args)

Load checker classes from generator plugins

load_local_dataset(ds_str)

Returns a dataset instance for the local resource

load_remote_dataset(ds_str)

Returns a dataset instance for the remote resource, either OPeNDAP or SOS

process_doc(doc)

Attempt to parse an xml string conforming to either an SOS or SensorML dataset and return the results

reasoning_routine(groups, check[, ...])

print routine performed @param list groups: the Result groups @param str check: checker name @param int priority_flag: indicates the weight of the groups @param bool _top_level: indicates the level of the group so as to print out the appropriate header string

run_all(ds, checker_names[, include_checks, ...])

Runs this CheckSuite on the dataset with all the passed Checker instances.

scores(raw_scores)

Transforms raw scores from a single checker into a fully tallied and grouped scoreline.

serialize(o)

Returns a safe serializable object that can be serialized into JSON.

standard_output(ds, limit, check_name, groups)

Generates the Terminal Output for Standard cases

standard_output_generation(groups, limit, ...)

Generates the Terminal Output

check_remote_netcdf

get_points

passtree

run

Attributes Summary

checkers

templates_root

Methods Summary

__init__([options])

add_plugin_args(parser)

Add command line arguments for external plugins that generate checker classes

build_structure(check_name, groups, source_name)

Compiles the checks, results and scores into an aggregate structure which looks like:

check_remote_netcdf(ds_str)

checker_html_output(check_name, groups, ...)

Renders the HTML output for a single test using Jinja2 and returns it as a string.

dict_output(check_name, groups, source_name, ...)

Builds the results into a JSON structure and writes it to the file buffer.

generate_dataset(cdl_path)

Use ncgen to generate a netCDF file from a .cdl file Returns the path to the generated netcdf file.

get_points(groups, limit)

html_output(checkers_html)

Renders the HTML output for multiple tests and returns it as a string.

load_all_available_checkers()

Helper method to retrieve all sub checker classes derived from various base classes.

load_dataset(ds_str)

Returns an instantiated instance of either a netCDF file or an SOS mapped DS object.

load_generated_checkers(args)

Load checker classes from generator plugins

load_local_dataset(ds_str)

Returns a dataset instance for the local resource

load_remote_dataset(ds_str)

Returns a dataset instance for the remote resource, either OPeNDAP or SOS

passtree(groups, limit)

process_doc(doc)

Attempt to parse an xml string conforming to either an SOS or SensorML dataset and return the results

reasoning_routine(groups, check[, ...])

print routine performed @param list groups: the Result groups @param str check: checker name @param int priority_flag: indicates the weight of the groups @param bool _top_level: indicates the level of the group so as to print out the appropriate header string

run(ds, skip_checks, *checker_names)

run_all(ds, checker_names[, include_checks, ...])

Runs this CheckSuite on the dataset with all the passed Checker instances.

scores(raw_scores)

Transforms raw scores from a single checker into a fully tallied and grouped scoreline.

serialize(o)

Returns a safe serializable object that can be serialized into JSON.

standard_output(ds, limit, check_name, groups)

Generates the Terminal Output for Standard cases

standard_output_generation(groups, limit, ...)

Generates the Terminal Output

Attributes Documentation

checkers = {}#
templates_root = 'compliance_checker'#

Methods Documentation

__init__(options=None)[source]#
classmethod add_plugin_args(parser)[source]#

Add command line arguments for external plugins that generate checker classes

build_structure(check_name, groups, source_name, limit=1)[source]#

Compiles the checks, results and scores into an aggregate structure which looks like:

{

“scored_points”: 396, “low_count”: 0, “possible_points”: 400, “testname”: “gliderdac”, “medium_count”: 2, “source_name”: “.//rutgers/ru01-20140120T1444/ru01-20140120T1649.nc”, “high_count”: 0, “all_priorities” : […], “high_priorities”: […], “medium_priorities” : […], “low_priorities” : […]

}

@param check_name The test which was run @param groups List of results from compliance checker @param source_name Source of the dataset, used for title

check_remote_netcdf(ds_str)[source]#
checker_html_output(check_name, groups, source_name, limit)[source]#

Renders the HTML output for a single test using Jinja2 and returns it as a string.

@param check_name The test which was run @param groups List of results from compliance checker @param source_name Source of the dataset, used for title @param limit Integer value for limiting output

dict_output(check_name, groups, source_name, limit)[source]#

Builds the results into a JSON structure and writes it to the file buffer.

@param check_name The test which was run @param groups List of results from compliance checker @param output_filename Path to file to save output @param source_name Source of the dataset, used for title @param limit Integer value for limiting output

generate_dataset(cdl_path)[source]#

Use ncgen to generate a netCDF file from a .cdl file Returns the path to the generated netcdf file. If ncgen fails, uses sys.exit(1) to terminate program so a long stack trace is not reported to the user.

Parameters:

cdl_path (str) – Absolute path to cdl file that is used to generate netCDF file

get_points(groups, limit)[source]#
html_output(checkers_html)[source]#

Renders the HTML output for multiple tests and returns it as a string.

@param checkers_html List of HTML for single tests as returned by

checker_html_output

classmethod load_all_available_checkers()[source]#

Helper method to retrieve all sub checker classes derived from various base classes.

load_dataset(ds_str)[source]#

Returns an instantiated instance of either a netCDF file or an SOS mapped DS object.

Parameters:

ds_str (str) – URL of the resource to load

classmethod load_generated_checkers(args)[source]#

Load checker classes from generator plugins

load_local_dataset(ds_str)[source]#

Returns a dataset instance for the local resource

Parameters:

ds_str – Path to the resource

load_remote_dataset(ds_str)[source]#

Returns a dataset instance for the remote resource, either OPeNDAP or SOS

Parameters:

ds_str (str) – URL to the remote resource

classmethod passtree(groups, limit)[source]#
process_doc(doc)[source]#

Attempt to parse an xml string conforming to either an SOS or SensorML dataset and return the results

reasoning_routine(groups, check, priority_flag=3, _top_level=True)[source]#

print routine performed @param list groups: the Result groups @param str check: checker name @param int priority_flag: indicates the weight of the groups @param bool _top_level: indicates the level of the group so as to

print out the appropriate header string

run(ds, skip_checks, *checker_names)[source]#
run_all(ds, checker_names, include_checks=None, skip_checks=None)[source]#

Runs this CheckSuite on the dataset with all the passed Checker instances.

Returns a dictionary mapping checker names to a 2-tuple of their grouped scores and errors/exceptions while running checks.

scores(raw_scores)[source]#

Transforms raw scores from a single checker into a fully tallied and grouped scoreline.

serialize(o)[source]#

Returns a safe serializable object that can be serialized into JSON.

@param o Python object to serialize

standard_output(ds, limit, check_name, groups)[source]#

Generates the Terminal Output for Standard cases

Returns the dataset needed for the verbose output, as well as the failure flags.

standard_output_generation(groups, limit, points, out_of, check)[source]#

Generates the Terminal Output