repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ioos/compliance-checker | compliance_checker/cfutil.py | is_timeseries_profile_single_station | def is_timeseries_profile_single_station(nc, variable):
'''
Returns true if the variable is a time-series profile that represents a
single station and each profile is the same length.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
#... | python | def is_timeseries_profile_single_station(nc, variable):
'''
Returns true if the variable is a time-series profile that represents a
single station and each profile is the same length.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
#... | [
"def",
"is_timeseries_profile_single_station",
"(",
"nc",
",",
"variable",
")",
":",
"dims",
"=",
"nc",
".",
"variables",
"[",
"variable",
"]",
".",
"dimensions",
"cmatrix",
"=",
"coordinate_dimension_matrix",
"(",
"nc",
")",
"for",
"req",
"in",
"(",
"'x'",
... | Returns true if the variable is a time-series profile that represents a
single station and each profile is the same length.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check | [
"Returns",
"true",
"if",
"the",
"variable",
"is",
"a",
"time",
"-",
"series",
"profile",
"that",
"represents",
"a",
"single",
"station",
"and",
"each",
"profile",
"is",
"the",
"same",
"length",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1114-L1145 | train |
ioos/compliance-checker | compliance_checker/cfutil.py | is_timeseries_profile_ortho_depth | def is_timeseries_profile_ortho_depth(nc, variable):
'''
Returns true if the variable is a time-series profile with orthogonal depth
only.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
# x(i), y(i), z(z), t(i, j)
# X(i, j, z)
... | python | def is_timeseries_profile_ortho_depth(nc, variable):
'''
Returns true if the variable is a time-series profile with orthogonal depth
only.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
# x(i), y(i), z(z), t(i, j)
# X(i, j, z)
... | [
"def",
"is_timeseries_profile_ortho_depth",
"(",
"nc",
",",
"variable",
")",
":",
"dims",
"=",
"nc",
".",
"variables",
"[",
"variable",
"]",
".",
"dimensions",
"cmatrix",
"=",
"coordinate_dimension_matrix",
"(",
"nc",
")",
"for",
"req",
"in",
"(",
"'x'",
","... | Returns true if the variable is a time-series profile with orthogonal depth
only.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check | [
"Returns",
"true",
"if",
"the",
"variable",
"is",
"a",
"time",
"-",
"series",
"profile",
"with",
"orthogonal",
"depth",
"only",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1262-L1299 | train |
ioos/compliance-checker | compliance_checker/cfutil.py | is_trajectory_profile_orthogonal | def is_trajectory_profile_orthogonal(nc, variable):
'''
Returns true if the variable is a trajectory profile with orthogonal
depths.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
# x(i, o), y(i, o), z(z), t(i, o)
# X(i, o, z)
... | python | def is_trajectory_profile_orthogonal(nc, variable):
'''
Returns true if the variable is a trajectory profile with orthogonal
depths.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
# x(i, o), y(i, o), z(z), t(i, o)
# X(i, o, z)
... | [
"def",
"is_trajectory_profile_orthogonal",
"(",
"nc",
",",
"variable",
")",
":",
"dims",
"=",
"nc",
".",
"variables",
"[",
"variable",
"]",
".",
"dimensions",
"cmatrix",
"=",
"coordinate_dimension_matrix",
"(",
"nc",
")",
"for",
"req",
"in",
"(",
"'x'",
",",... | Returns true if the variable is a trajectory profile with orthogonal
depths.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check | [
"Returns",
"true",
"if",
"the",
"variable",
"is",
"a",
"trajectory",
"profile",
"with",
"orthogonal",
"depths",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1344-L1376 | train |
ioos/compliance-checker | compliance_checker/cfutil.py | is_mapped_grid | def is_mapped_grid(nc, variable):
'''
Returns true if the feature-type of variable corresponds to a mapped grid
type. Characterized by Appedix F of CF-1.6
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
# x(j, i), y(j, i), z?, t?
... | python | def is_mapped_grid(nc, variable):
'''
Returns true if the feature-type of variable corresponds to a mapped grid
type. Characterized by Appedix F of CF-1.6
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
# x(j, i), y(j, i), z?, t?
... | [
"def",
"is_mapped_grid",
"(",
"nc",
",",
"variable",
")",
":",
"dims",
"=",
"nc",
".",
"variables",
"[",
"variable",
"]",
".",
"dimensions",
"variable_coordinates",
"=",
"getattr",
"(",
"nc",
".",
"variables",
"[",
"variable",
"]",
",",
"'coordinates'",
",... | Returns true if the feature-type of variable corresponds to a mapped grid
type. Characterized by Appedix F of CF-1.6
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check | [
"Returns",
"true",
"if",
"the",
"feature",
"-",
"type",
"of",
"variable",
"corresponds",
"to",
"a",
"mapped",
"grid",
"type",
".",
"Characterized",
"by",
"Appedix",
"F",
"of",
"CF",
"-",
"1",
".",
"6"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1575-L1628 | train |
ioos/compliance-checker | compliance_checker/cfutil.py | is_reduced_grid | def is_reduced_grid(nc, variable):
'''
Returns True if the feature-type of the variable corresponds to a reduced
horizontal grid.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
axis_map = get_axis_map(nc, variable)
if 'X' not in... | python | def is_reduced_grid(nc, variable):
'''
Returns True if the feature-type of the variable corresponds to a reduced
horizontal grid.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
axis_map = get_axis_map(nc, variable)
if 'X' not in... | [
"def",
"is_reduced_grid",
"(",
"nc",
",",
"variable",
")",
":",
"axis_map",
"=",
"get_axis_map",
"(",
"nc",
",",
"variable",
")",
"if",
"'X'",
"not",
"in",
"axis_map",
":",
"return",
"False",
"if",
"'Y'",
"not",
"in",
"axis_map",
":",
"return",
"False",
... | Returns True if the feature-type of the variable corresponds to a reduced
horizontal grid.
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check | [
"Returns",
"True",
"if",
"the",
"feature",
"-",
"type",
"of",
"the",
"variable",
"corresponds",
"to",
"a",
"reduced",
"horizontal",
"grid",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1631-L1655 | train |
ioos/compliance-checker | compliance_checker/cfutil.py | guess_feature_type | def guess_feature_type(nc, variable):
'''
Returns a string describing the feature type for this variable
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
if is_point(nc, variable):
return 'point'
if is_timeseries(nc, variable):... | python | def guess_feature_type(nc, variable):
'''
Returns a string describing the feature type for this variable
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check
'''
if is_point(nc, variable):
return 'point'
if is_timeseries(nc, variable):... | [
"def",
"guess_feature_type",
"(",
"nc",
",",
"variable",
")",
":",
"if",
"is_point",
"(",
"nc",
",",
"variable",
")",
":",
"return",
"'point'",
"if",
"is_timeseries",
"(",
"nc",
",",
"variable",
")",
":",
"return",
"'timeseries'",
"if",
"is_multi_timeseries_... | Returns a string describing the feature type for this variable
:param netCDF4.Dataset nc: An open netCDF dataset
:param str variable: name of the variable to check | [
"Returns",
"a",
"string",
"describing",
"the",
"feature",
"type",
"for",
"this",
"variable"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1658-L1708 | train |
ioos/compliance-checker | compliance_checker/cfutil.py | units_convertible | def units_convertible(units1, units2, reftimeistime=True):
"""
Return True if a Unit representing the string units1 can be converted
to a Unit representing the string units2, else False.
:param str units1: A string representing the units
:param str units2: A string representing the units
"""
... | python | def units_convertible(units1, units2, reftimeistime=True):
"""
Return True if a Unit representing the string units1 can be converted
to a Unit representing the string units2, else False.
:param str units1: A string representing the units
:param str units2: A string representing the units
"""
... | [
"def",
"units_convertible",
"(",
"units1",
",",
"units2",
",",
"reftimeistime",
"=",
"True",
")",
":",
"try",
":",
"u1",
"=",
"Unit",
"(",
"units1",
")",
"u2",
"=",
"Unit",
"(",
"units2",
")",
"except",
"ValueError",
":",
"return",
"False",
"return",
"... | Return True if a Unit representing the string units1 can be converted
to a Unit representing the string units2, else False.
:param str units1: A string representing the units
:param str units2: A string representing the units | [
"Return",
"True",
"if",
"a",
"Unit",
"representing",
"the",
"string",
"units1",
"can",
"be",
"converted",
"to",
"a",
"Unit",
"representing",
"the",
"string",
"units2",
"else",
"False",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cfutil.py#L1711-L1724 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.setup | def setup(self, ds):
"""
Initialize various special variable types within the class.
Mutates a number of instance variables.
:param netCDF4.Dataset ds: An open netCDF dataset
"""
self._find_coord_vars(ds)
self._find_aux_coord_vars(ds)
self._find_ancillary... | python | def setup(self, ds):
"""
Initialize various special variable types within the class.
Mutates a number of instance variables.
:param netCDF4.Dataset ds: An open netCDF dataset
"""
self._find_coord_vars(ds)
self._find_aux_coord_vars(ds)
self._find_ancillary... | [
"def",
"setup",
"(",
"self",
",",
"ds",
")",
":",
"self",
".",
"_find_coord_vars",
"(",
"ds",
")",
"self",
".",
"_find_aux_coord_vars",
"(",
"ds",
")",
"self",
".",
"_find_ancillary_vars",
"(",
"ds",
")",
"self",
".",
"_find_clim_vars",
"(",
"ds",
")",
... | Initialize various special variable types within the class.
Mutates a number of instance variables.
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Initialize",
"various",
"special",
"variable",
"types",
"within",
"the",
"class",
".",
"Mutates",
"a",
"number",
"of",
"instance",
"variables",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L138-L152 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._find_cf_standard_name_table | def _find_cf_standard_name_table(self, ds):
'''
Parse out the `standard_name_vocabulary` attribute and download that
version of the cf standard name table. If the standard name table has
already been downloaded, use the cached version. Modifies `_std_names`
attribute to store s... | python | def _find_cf_standard_name_table(self, ds):
'''
Parse out the `standard_name_vocabulary` attribute and download that
version of the cf standard name table. If the standard name table has
already been downloaded, use the cached version. Modifies `_std_names`
attribute to store s... | [
"def",
"_find_cf_standard_name_table",
"(",
"self",
",",
"ds",
")",
":",
"standard_name_vocabulary",
"=",
"getattr",
"(",
"ds",
",",
"'standard_name_vocabulary'",
",",
"''",
")",
"version",
"=",
"None",
"try",
":",
"if",
"'cf standard name table'",
"in",
"standard... | Parse out the `standard_name_vocabulary` attribute and download that
version of the cf standard name table. If the standard name table has
already been downloaded, use the cached version. Modifies `_std_names`
attribute to store standard names. Returns True if the file exists and
Fals... | [
"Parse",
"out",
"the",
"standard_name_vocabulary",
"attribute",
"and",
"download",
"that",
"version",
"of",
"the",
"cf",
"standard",
"name",
"table",
".",
"If",
"the",
"standard",
"name",
"table",
"has",
"already",
"been",
"downloaded",
"use",
"the",
"cached",
... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L154-L215 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._find_ancillary_vars | def _find_ancillary_vars(self, ds, refresh=False):
'''
Returns a list of variable names that are defined as ancillary
variables in the dataset ds.
An ancillary variable generally is a metadata container and referenced
from other variables via a string reference in an attribute.
... | python | def _find_ancillary_vars(self, ds, refresh=False):
'''
Returns a list of variable names that are defined as ancillary
variables in the dataset ds.
An ancillary variable generally is a metadata container and referenced
from other variables via a string reference in an attribute.
... | [
"def",
"_find_ancillary_vars",
"(",
"self",
",",
"ds",
",",
"refresh",
"=",
"False",
")",
":",
"if",
"self",
".",
"_ancillary_vars",
".",
"get",
"(",
"ds",
",",
"None",
")",
"and",
"refresh",
"is",
"False",
":",
"return",
"self",
".",
"_ancillary_vars",
... | Returns a list of variable names that are defined as ancillary
variables in the dataset ds.
An ancillary variable generally is a metadata container and referenced
from other variables via a string reference in an attribute.
- via ancillary_variables (3.4)
- "grid mapping var" (... | [
"Returns",
"a",
"list",
"of",
"variable",
"names",
"that",
"are",
"defined",
"as",
"ancillary",
"variables",
"in",
"the",
"dataset",
"ds",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L259-L300 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._find_metadata_vars | def _find_metadata_vars(self, ds, refresh=False):
'''
Returns a list of netCDF variable instances for those that are likely metadata variables
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
inva... | python | def _find_metadata_vars(self, ds, refresh=False):
'''
Returns a list of netCDF variable instances for those that are likely metadata variables
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
inva... | [
"def",
"_find_metadata_vars",
"(",
"self",
",",
"ds",
",",
"refresh",
"=",
"False",
")",
":",
"if",
"self",
".",
"_metadata_vars",
".",
"get",
"(",
"ds",
",",
"None",
")",
"and",
"refresh",
"is",
"False",
":",
"return",
"self",
".",
"_metadata_vars",
"... | Returns a list of netCDF variable instances for those that are likely metadata variables
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
invalidated.
:rtype: list
:return: List of variable name... | [
"Returns",
"a",
"list",
"of",
"netCDF",
"variable",
"instances",
"for",
"those",
"that",
"are",
"likely",
"metadata",
"variables"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L302-L332 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._find_geophysical_vars | def _find_geophysical_vars(self, ds, refresh=False):
'''
Returns a list of geophysical variables. Modifies
`self._geophysical_vars`
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
invali... | python | def _find_geophysical_vars(self, ds, refresh=False):
'''
Returns a list of geophysical variables. Modifies
`self._geophysical_vars`
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
invali... | [
"def",
"_find_geophysical_vars",
"(",
"self",
",",
"ds",
",",
"refresh",
"=",
"False",
")",
":",
"if",
"self",
".",
"_geophysical_vars",
".",
"get",
"(",
"ds",
",",
"None",
")",
"and",
"refresh",
"is",
"False",
":",
"return",
"self",
".",
"_geophysical_v... | Returns a list of geophysical variables. Modifies
`self._geophysical_vars`
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
invalidated.
:rtype: list
:return: A list containing strings wi... | [
"Returns",
"a",
"list",
"of",
"geophysical",
"variables",
".",
"Modifies",
"self",
".",
"_geophysical_vars"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L334-L351 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._find_boundary_vars | def _find_boundary_vars(self, ds, refresh=False):
'''
Returns dictionary of boundary variables mapping the variable instance
to the name of the variable acting as a boundary variable.
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to Tru... | python | def _find_boundary_vars(self, ds, refresh=False):
'''
Returns dictionary of boundary variables mapping the variable instance
to the name of the variable acting as a boundary variable.
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to Tru... | [
"def",
"_find_boundary_vars",
"(",
"self",
",",
"ds",
",",
"refresh",
"=",
"False",
")",
":",
"if",
"self",
".",
"_boundary_vars",
".",
"get",
"(",
"ds",
",",
"None",
")",
"and",
"refresh",
"is",
"False",
":",
"return",
"self",
".",
"_boundary_vars",
"... | Returns dictionary of boundary variables mapping the variable instance
to the name of the variable acting as a boundary variable.
:param netCDF4.Dataset ds: An open netCDF dataset
:param bool refresh: if refresh is set to True, the cache is
invalidated.
:rty... | [
"Returns",
"dictionary",
"of",
"boundary",
"variables",
"mapping",
"the",
"variable",
"instance",
"to",
"the",
"name",
"of",
"the",
"variable",
"acting",
"as",
"a",
"boundary",
"variable",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L374-L390 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_data_types | def check_data_types(self, ds):
'''
Checks the data type of all netCDF variables to ensure they are valid
data types under CF.
CF §2.2 The netCDF data types char, byte, short, int, float or real, and
double are all acceptable
:param netCDF4.Dataset ds: An open netCDF da... | python | def check_data_types(self, ds):
'''
Checks the data type of all netCDF variables to ensure they are valid
data types under CF.
CF §2.2 The netCDF data types char, byte, short, int, float or real, and
double are all acceptable
:param netCDF4.Dataset ds: An open netCDF da... | [
"def",
"check_data_types",
"(",
"self",
",",
"ds",
")",
":",
"fails",
"=",
"[",
"]",
"total",
"=",
"len",
"(",
"ds",
".",
"variables",
")",
"for",
"k",
",",
"v",
"in",
"ds",
".",
"variables",
".",
"items",
"(",
")",
":",
"if",
"(",
"v",
".",
... | Checks the data type of all netCDF variables to ensure they are valid
data types under CF.
CF §2.2 The netCDF data types char, byte, short, int, float or real, and
double are all acceptable
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: compliance_checker.base.Result | [
"Checks",
"the",
"data",
"type",
"of",
"all",
"netCDF",
"variables",
"to",
"ensure",
"they",
"are",
"valid",
"data",
"types",
"under",
"CF",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L398-L419 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_naming_conventions | def check_naming_conventions(self, ds):
'''
Checks the variable names to ensure they are valid CF variable names under CF.
CF §2.3 Variable, dimension and attribute names should begin with a letter
and be composed of letters, digits, and underscores.
:param netCDF4.Dataset ds: ... | python | def check_naming_conventions(self, ds):
'''
Checks the variable names to ensure they are valid CF variable names under CF.
CF §2.3 Variable, dimension and attribute names should begin with a letter
and be composed of letters, digits, and underscores.
:param netCDF4.Dataset ds: ... | [
"def",
"check_naming_conventions",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"variable_naming",
"=",
"TestCtx",
"(",
"BaseCheck",
".",
"MEDIUM",
",",
"self",
".",
"section_titles",
"[",
"'2.3'",
"]",
")",
"dimension_naming",
"=",
"TestCtx",... | Checks the variable names to ensure they are valid CF variable names under CF.
CF §2.3 Variable, dimension and attribute names should begin with a letter
and be composed of letters, digits, and underscores.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: compliance_checker.ba... | [
"Checks",
"the",
"variable",
"names",
"to",
"ensure",
"they",
"are",
"valid",
"CF",
"variable",
"names",
"under",
"CF",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L462-L522 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_names_unique | def check_names_unique(self, ds):
'''
Checks the variable names for uniqueness regardless of case.
CF §2.3 names should not be distinguished purely by case, i.e., if case
is disregarded, no two names should be the same.
:param netCDF4.Dataset ds: An open netCDF dataset
... | python | def check_names_unique(self, ds):
'''
Checks the variable names for uniqueness regardless of case.
CF §2.3 names should not be distinguished purely by case, i.e., if case
is disregarded, no two names should be the same.
:param netCDF4.Dataset ds: An open netCDF dataset
... | [
"def",
"check_names_unique",
"(",
"self",
",",
"ds",
")",
":",
"fails",
"=",
"[",
"]",
"total",
"=",
"len",
"(",
"ds",
".",
"variables",
")",
"names",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"k",
"in",
"ds",
".",
"variables",
":",
"names",
"[",... | Checks the variable names for uniqueness regardless of case.
CF §2.3 names should not be distinguished purely by case, i.e., if case
is disregarded, no two names should be the same.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: compliance_checker.base.Result | [
"Checks",
"the",
"variable",
"names",
"for",
"uniqueness",
"regardless",
"of",
"case",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L524-L542 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_dimension_names | def check_dimension_names(self, ds):
'''
Checks variables contain no duplicate dimension names.
CF §2.4 A variable may have any number of dimensions, including zero,
and the dimensions must all have different names.
:param netCDF4.Dataset ds: An open netCDF dataset
:rty... | python | def check_dimension_names(self, ds):
'''
Checks variables contain no duplicate dimension names.
CF §2.4 A variable may have any number of dimensions, including zero,
and the dimensions must all have different names.
:param netCDF4.Dataset ds: An open netCDF dataset
:rty... | [
"def",
"check_dimension_names",
"(",
"self",
",",
"ds",
")",
":",
"fails",
"=",
"[",
"]",
"total",
"=",
"len",
"(",
"ds",
".",
"variables",
")",
"for",
"k",
",",
"v",
"in",
"ds",
".",
"variables",
".",
"items",
"(",
")",
":",
"dims",
"=",
"defaul... | Checks variables contain no duplicate dimension names.
CF §2.4 A variable may have any number of dimensions, including zero,
and the dimensions must all have different names.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: compliance_checker.base.Result | [
"Checks",
"variables",
"contain",
"no",
"duplicate",
"dimension",
"names",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L544-L566 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._get_coord_axis_map | def _get_coord_axis_map(self, ds):
'''
Returns a dictionary mapping each coordinate to a letter identifier
describing the _kind_ of coordinate.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: dict
:return: A dictionary with variable names mapped to axis abbrev... | python | def _get_coord_axis_map(self, ds):
'''
Returns a dictionary mapping each coordinate to a letter identifier
describing the _kind_ of coordinate.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: dict
:return: A dictionary with variable names mapped to axis abbrev... | [
"def",
"_get_coord_axis_map",
"(",
"self",
",",
"ds",
")",
":",
"expected",
"=",
"[",
"'T'",
",",
"'Z'",
",",
"'Y'",
",",
"'X'",
"]",
"coord_vars",
"=",
"self",
".",
"_find_coord_vars",
"(",
"ds",
")",
"coord_axis_map",
"=",
"{",
"}",
"time_variables",
... | Returns a dictionary mapping each coordinate to a letter identifier
describing the _kind_ of coordinate.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: dict
:return: A dictionary with variable names mapped to axis abbreviations,
i.e. {'longitude': 'X', ... '... | [
"Returns",
"a",
"dictionary",
"mapping",
"each",
"coordinate",
"to",
"a",
"letter",
"identifier",
"describing",
"the",
"_kind_",
"of",
"coordinate",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L613-L696 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._get_instance_dimensions | def _get_instance_dimensions(self, ds):
'''
Returns a list of dimensions marked as instance dimensions
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:returns: A list of variable dimensions
'''
ret_val = []
for variable in ds.get_variable... | python | def _get_instance_dimensions(self, ds):
'''
Returns a list of dimensions marked as instance dimensions
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:returns: A list of variable dimensions
'''
ret_val = []
for variable in ds.get_variable... | [
"def",
"_get_instance_dimensions",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"variable",
"in",
"ds",
".",
"get_variables_by_attributes",
"(",
"cf_role",
"=",
"lambda",
"x",
":",
"isinstance",
"(",
"x",
",",
"basestring",
")",
")",
... | Returns a list of dimensions marked as instance dimensions
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:returns: A list of variable dimensions | [
"Returns",
"a",
"list",
"of",
"dimensions",
"marked",
"as",
"instance",
"dimensions"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L698-L711 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._get_pretty_dimension_order | def _get_pretty_dimension_order(self, ds, name):
'''
Returns a comma seperated string of the dimensions for a specified
variable
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: A string with a valid NetCDF variable name for the
dataset... | python | def _get_pretty_dimension_order(self, ds, name):
'''
Returns a comma seperated string of the dimensions for a specified
variable
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: A string with a valid NetCDF variable name for the
dataset... | [
"def",
"_get_pretty_dimension_order",
"(",
"self",
",",
"ds",
",",
"name",
")",
":",
"dim_names",
"=",
"[",
"]",
"for",
"dim",
"in",
"ds",
".",
"variables",
"[",
"name",
"]",
".",
"dimensions",
":",
"dim_name",
"=",
"dim",
"if",
"ds",
".",
"dimensions"... | Returns a comma seperated string of the dimensions for a specified
variable
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: A string with a valid NetCDF variable name for the
dataset
:rtype: str
:return: A comma separated string of the... | [
"Returns",
"a",
"comma",
"seperated",
"string",
"of",
"the",
"dimensions",
"for",
"a",
"specified",
"variable"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L713-L730 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._get_dimension_order | def _get_dimension_order(self, ds, name, coord_axis_map):
'''
Returns a list of strings corresponding to the named axis of the dimensions for a variable.
Example::
self._get_dimension_order(ds, 'temperature', coord_axis_map)
--> ['T', 'Y', 'X']
:param netCDF4.Da... | python | def _get_dimension_order(self, ds, name, coord_axis_map):
'''
Returns a list of strings corresponding to the named axis of the dimensions for a variable.
Example::
self._get_dimension_order(ds, 'temperature', coord_axis_map)
--> ['T', 'Y', 'X']
:param netCDF4.Da... | [
"def",
"_get_dimension_order",
"(",
"self",
",",
"ds",
",",
"name",
",",
"coord_axis_map",
")",
":",
"retval",
"=",
"[",
"]",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"for",
"dim",
"in",
"variable",
".",
"dimensions",
":",
"retval",
"... | Returns a list of strings corresponding to the named axis of the dimensions for a variable.
Example::
self._get_dimension_order(ds, 'temperature', coord_axis_map)
--> ['T', 'Y', 'X']
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: Name of the variable... | [
"Returns",
"a",
"list",
"of",
"strings",
"corresponding",
"to",
"the",
"named",
"axis",
"of",
"the",
"dimensions",
"for",
"a",
"variable",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L732-L752 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_convention_globals | def check_convention_globals(self, ds):
'''
Check the common global attributes are strings if they exist.
CF §2.6.2 title/history global attributes, must be strings. Do not need
to exist.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: Li... | python | def check_convention_globals(self, ds):
'''
Check the common global attributes are strings if they exist.
CF §2.6.2 title/history global attributes, must be strings. Do not need
to exist.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: Li... | [
"def",
"check_convention_globals",
"(",
"self",
",",
"ds",
")",
":",
"attrs",
"=",
"[",
"'title'",
",",
"'history'",
"]",
"valid_globals",
"=",
"TestCtx",
"(",
"BaseCheck",
".",
"MEDIUM",
",",
"self",
".",
"section_titles",
"[",
"'2.6'",
"]",
")",
"for",
... | Check the common global attributes are strings if they exist.
CF §2.6.2 title/history global attributes, must be strings. Do not need
to exist.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of Results | [
"Check",
"the",
"common",
"global",
"attributes",
"are",
"strings",
"if",
"they",
"exist",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L850-L871 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._split_standard_name | def _split_standard_name(self, standard_name):
'''
Returns a tuple of the standard_name and standard_name modifier
Nones are used to represent the absence of a modifier or standard_name
:rtype: tuple
:return: 2-tuple of standard_name and modifier as strings
'''
... | python | def _split_standard_name(self, standard_name):
'''
Returns a tuple of the standard_name and standard_name modifier
Nones are used to represent the absence of a modifier or standard_name
:rtype: tuple
:return: 2-tuple of standard_name and modifier as strings
'''
... | [
"def",
"_split_standard_name",
"(",
"self",
",",
"standard_name",
")",
":",
"if",
"isinstance",
"(",
"standard_name",
",",
"basestring",
")",
"and",
"' '",
"in",
"standard_name",
":",
"return",
"standard_name",
".",
"split",
"(",
"' '",
",",
"1",
")",
"else"... | Returns a tuple of the standard_name and standard_name modifier
Nones are used to represent the absence of a modifier or standard_name
:rtype: tuple
:return: 2-tuple of standard_name and modifier as strings | [
"Returns",
"a",
"tuple",
"of",
"the",
"standard_name",
"and",
"standard_name",
"modifier"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L994-L1009 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_valid_cf_units | def _check_valid_cf_units(self, ds, variable_name):
'''
Checks that the variable contains units attribute, the attribute is a
string and the value is not deprecated by CF
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be check... | python | def _check_valid_cf_units(self, ds, variable_name):
'''
Checks that the variable contains units attribute, the attribute is a
string and the value is not deprecated by CF
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be check... | [
"def",
"_check_valid_cf_units",
"(",
"self",
",",
"ds",
",",
"variable_name",
")",
":",
"deprecated",
"=",
"[",
"'level'",
",",
"'layer'",
",",
"'sigma_level'",
"]",
"variable",
"=",
"ds",
".",
"variables",
"[",
"variable_name",
"]",
"units",
"=",
"getattr",... | Checks that the variable contains units attribute, the attribute is a
string and the value is not deprecated by CF
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be checked
:rtype:
:return: List of results | [
"Checks",
"that",
"the",
"variable",
"contains",
"units",
"attribute",
"the",
"attribute",
"is",
"a",
"string",
"and",
"the",
"value",
"is",
"not",
"deprecated",
"by",
"CF"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1011-L1053 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_valid_udunits | def _check_valid_udunits(self, ds, variable_name):
'''
Checks that the variable's units are contained in UDUnits
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be checked
'''
variable = ds.variables[variable_name]
... | python | def _check_valid_udunits(self, ds, variable_name):
'''
Checks that the variable's units are contained in UDUnits
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be checked
'''
variable = ds.variables[variable_name]
... | [
"def",
"_check_valid_udunits",
"(",
"self",
",",
"ds",
",",
"variable_name",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"variable_name",
"]",
"units",
"=",
"getattr",
"(",
"variable",
",",
"'units'",
",",
"None",
")",
"standard_name",
"=",
"ge... | Checks that the variable's units are contained in UDUnits
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be checked | [
"Checks",
"that",
"the",
"variable",
"s",
"units",
"are",
"contained",
"in",
"UDUnits"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1055-L1078 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_valid_standard_units | def _check_valid_standard_units(self, ds, variable_name):
'''
Checks that the variable's units are appropriate for the standard name
according to the CF standard name table and coordinate sections in CF
1.6
:param netCDF4.Dataset ds: An open netCDF dataset
:param str var... | python | def _check_valid_standard_units(self, ds, variable_name):
'''
Checks that the variable's units are appropriate for the standard name
according to the CF standard name table and coordinate sections in CF
1.6
:param netCDF4.Dataset ds: An open netCDF dataset
:param str var... | [
"def",
"_check_valid_standard_units",
"(",
"self",
",",
"ds",
",",
"variable_name",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"variable_name",
"]",
"units",
"=",
"getattr",
"(",
"variable",
",",
"'units'",
",",
"None",
")",
"standard_name",
"="... | Checks that the variable's units are appropriate for the standard name
according to the CF standard name table and coordinate sections in CF
1.6
:param netCDF4.Dataset ds: An open netCDF dataset
:param str variable_name: Name of the variable to be checked | [
"Checks",
"that",
"the",
"variable",
"s",
"units",
"are",
"appropriate",
"for",
"the",
"standard",
"name",
"according",
"to",
"the",
"CF",
"standard",
"name",
"table",
"and",
"coordinate",
"sections",
"in",
"CF",
"1",
".",
"6"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1080-L1149 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_standard_name | def check_standard_name(self, ds):
'''
Check a variables's standard_name attribute to ensure that it meets CF
compliance.
CF §3.3 A standard name is associated with a variable via the attribute
standard_name which takes a string value comprised of a standard name
optiona... | python | def check_standard_name(self, ds):
'''
Check a variables's standard_name attribute to ensure that it meets CF
compliance.
CF §3.3 A standard name is associated with a variable via the attribute
standard_name which takes a string value comprised of a standard name
optiona... | [
"def",
"check_standard_name",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"coord_vars",
"=",
"self",
".",
"_find_coord_vars",
"(",
"ds",
")",
"aux_coord_vars",
"=",
"self",
".",
"_find_aux_coord_vars",
"(",
"ds",
")",
"axis_vars",
"=",
"cfu... | Check a variables's standard_name attribute to ensure that it meets CF
compliance.
CF §3.3 A standard name is associated with a variable via the attribute
standard_name which takes a string value comprised of a standard name
optionally followed by one or more blanks and a standard name ... | [
"Check",
"a",
"variables",
"s",
"standard_name",
"attribute",
"to",
"ensure",
"that",
"it",
"meets",
"CF",
"compliance",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1151-L1240 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_ancillary_variables | def check_ancillary_variables(self, ds):
'''
Checks the ancillary_variable attribute for all variables to ensure
they are CF compliant.
CF §3.4 It is a string attribute whose value is a blank separated list
of variable names. The nature of the relationship between variables
... | python | def check_ancillary_variables(self, ds):
'''
Checks the ancillary_variable attribute for all variables to ensure
they are CF compliant.
CF §3.4 It is a string attribute whose value is a blank separated list
of variable names. The nature of the relationship between variables
... | [
"def",
"check_ancillary_variables",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"ncvar",
"in",
"ds",
".",
"get_variables_by_attributes",
"(",
"ancillary_variables",
"=",
"lambda",
"x",
":",
"x",
"is",
"not",
"None",
")",
":",
"name",... | Checks the ancillary_variable attribute for all variables to ensure
they are CF compliant.
CF §3.4 It is a string attribute whose value is a blank separated list
of variable names. The nature of the relationship between variables
associated via ancillary_variables must be determined by... | [
"Checks",
"the",
"ancillary_variable",
"attribute",
"for",
"all",
"variables",
"to",
"ensure",
"they",
"are",
"CF",
"compliant",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1242-L1281 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_flags | def check_flags(self, ds):
'''
Check the flag_values, flag_masks and flag_meanings attributes for
variables to ensure they are CF compliant.
CF §3.5 The attributes flag_values, flag_masks and flag_meanings are
intended to make variables that contain flag values self describing.
... | python | def check_flags(self, ds):
'''
Check the flag_values, flag_masks and flag_meanings attributes for
variables to ensure they are CF compliant.
CF §3.5 The attributes flag_values, flag_masks and flag_meanings are
intended to make variables that contain flag values self describing.
... | [
"def",
"check_flags",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"name",
"in",
"cfutil",
".",
"get_flag_variables",
"(",
"ds",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"flag_values",
"=",
"getattr",
... | Check the flag_values, flag_masks and flag_meanings attributes for
variables to ensure they are CF compliant.
CF §3.5 The attributes flag_values, flag_masks and flag_meanings are
intended to make variables that contain flag values self describing.
Status codes and Boolean (binary) condi... | [
"Check",
"the",
"flag_values",
"flag_masks",
"and",
"flag_meanings",
"attributes",
"for",
"variables",
"to",
"ensure",
"they",
"are",
"CF",
"compliant",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1283-L1351 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_flag_values | def _check_flag_values(self, ds, name):
'''
Checks a variable's flag_values attribute for compliance under CF
- flag_values exists as an array
- unique elements in flag_values
- flag_values si the same dtype as the variable
- flag_values is the same length as flag_meanin... | python | def _check_flag_values(self, ds, name):
'''
Checks a variable's flag_values attribute for compliance under CF
- flag_values exists as an array
- unique elements in flag_values
- flag_values si the same dtype as the variable
- flag_values is the same length as flag_meanin... | [
"def",
"_check_flag_values",
"(",
"self",
",",
"ds",
",",
"name",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"flag_values",
"=",
"variable",
".",
"flag_values",
"flag_meanings",
"=",
"getattr",
"(",
"variable",
",",
"'flag_meanings'... | Checks a variable's flag_values attribute for compliance under CF
- flag_values exists as an array
- unique elements in flag_values
- flag_values si the same dtype as the variable
- flag_values is the same length as flag_meanings
:param netCDF4.Dataset ds: An open netCDF datase... | [
"Checks",
"a",
"variable",
"s",
"flag_values",
"attribute",
"for",
"compliance",
"under",
"CF"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1353-L1396 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_flag_masks | def _check_flag_masks(self, ds, name):
'''
Check a variable's flag_masks attribute for compliance under CF
- flag_masks exists as an array
- flag_masks is the same dtype as the variable
- variable's dtype can support bit-field
- flag_masks is the same length as flag_mean... | python | def _check_flag_masks(self, ds, name):
'''
Check a variable's flag_masks attribute for compliance under CF
- flag_masks exists as an array
- flag_masks is the same dtype as the variable
- variable's dtype can support bit-field
- flag_masks is the same length as flag_mean... | [
"def",
"_check_flag_masks",
"(",
"self",
",",
"ds",
",",
"name",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"flag_masks",
"=",
"variable",
".",
"flag_masks",
"flag_meanings",
"=",
"getattr",
"(",
"ds",
",",
"'flag_meanings'",
",",... | Check a variable's flag_masks attribute for compliance under CF
- flag_masks exists as an array
- flag_masks is the same dtype as the variable
- variable's dtype can support bit-field
- flag_masks is the same length as flag_meanings
:param netCDF4.Dataset ds: An open netCDF dat... | [
"Check",
"a",
"variable",
"s",
"flag_masks",
"attribute",
"for",
"compliance",
"under",
"CF"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1398-L1440 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_flag_meanings | def _check_flag_meanings(self, ds, name):
'''
Check a variable's flag_meanings attribute for compliance under CF
- flag_meanings exists
- flag_meanings is a string
- flag_meanings elements are valid strings
:param netCDF4.Dataset ds: An open netCDF dataset
:para... | python | def _check_flag_meanings(self, ds, name):
'''
Check a variable's flag_meanings attribute for compliance under CF
- flag_meanings exists
- flag_meanings is a string
- flag_meanings elements are valid strings
:param netCDF4.Dataset ds: An open netCDF dataset
:para... | [
"def",
"_check_flag_meanings",
"(",
"self",
",",
"ds",
",",
"name",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"flag_meanings",
"=",
"getattr",
"(",
"variable",
",",
"'flag_meanings'",
",",
"None",
")",
"valid_meanings",
"=",
"Tes... | Check a variable's flag_meanings attribute for compliance under CF
- flag_meanings exists
- flag_meanings is a string
- flag_meanings elements are valid strings
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: Variable name
:rtype: compliance_checker.b... | [
"Check",
"a",
"variable",
"s",
"flag_meanings",
"attribute",
"for",
"compliance",
"under",
"CF"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1442-L1478 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_coordinate_types | def check_coordinate_types(self, ds):
'''
Check the axis attribute of coordinate variables
CF §4 The attribute axis may be attached to a coordinate variable and
given one of the values X, Y, Z or T which stand for a longitude,
latitude, vertical, or time axis respectively. Alter... | python | def check_coordinate_types(self, ds):
'''
Check the axis attribute of coordinate variables
CF §4 The attribute axis may be attached to a coordinate variable and
given one of the values X, Y, Z or T which stand for a longitude,
latitude, vertical, or time axis respectively. Alter... | [
"def",
"check_coordinate_types",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"variable",
"in",
"ds",
".",
"get_variables_by_attributes",
"(",
"axis",
"=",
"lambda",
"x",
":",
"x",
"is",
"not",
"None",
")",
":",
"name",
"=",
"vari... | Check the axis attribute of coordinate variables
CF §4 The attribute axis may be attached to a coordinate variable and
given one of the values X, Y, Z or T which stand for a longitude,
latitude, vertical, or time axis respectively. Alternatively the
standard_name attribute may be used f... | [
"Check",
"the",
"axis",
"attribute",
"of",
"coordinate",
"variables"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1486-L1527 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_axis | def _check_axis(self, ds, name):
'''
Checks that the axis attribute is a string and an allowed value, namely
one of 'T', 'X', 'Y', or 'Z'.
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: Name of the variable
:rtype: compliance_checker.base.Result
... | python | def _check_axis(self, ds, name):
'''
Checks that the axis attribute is a string and an allowed value, namely
one of 'T', 'X', 'Y', or 'Z'.
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: Name of the variable
:rtype: compliance_checker.base.Result
... | [
"def",
"_check_axis",
"(",
"self",
",",
"ds",
",",
"name",
")",
":",
"allowed_axis",
"=",
"[",
"'T'",
",",
"'X'",
",",
"'Y'",
",",
"'Z'",
"]",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"axis",
"=",
"variable",
".",
"axis",
"valid_a... | Checks that the axis attribute is a string and an allowed value, namely
one of 'T', 'X', 'Y', or 'Z'.
:param netCDF4.Dataset ds: An open netCDF dataset
:param str name: Name of the variable
:rtype: compliance_checker.base.Result | [
"Checks",
"that",
"the",
"axis",
"attribute",
"is",
"a",
"string",
"and",
"an",
"allowed",
"value",
"namely",
"one",
"of",
"T",
"X",
"Y",
"or",
"Z",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1529-L1555 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_dimensional_vertical_coordinate | def check_dimensional_vertical_coordinate(self, ds):
'''
Check units for variables defining vertical position are valid under
CF.
CF §4.3.1 The units attribute for dimensional coordinates will be a string
formatted as per the udunits.dat file.
The acceptable units for v... | python | def check_dimensional_vertical_coordinate(self, ds):
'''
Check units for variables defining vertical position are valid under
CF.
CF §4.3.1 The units attribute for dimensional coordinates will be a string
formatted as per the udunits.dat file.
The acceptable units for v... | [
"def",
"check_dimensional_vertical_coordinate",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"z_variables",
"=",
"cfutil",
".",
"get_z_variables",
"(",
"ds",
")",
"for",
"name",
"in",
"z_variables",
":",
"variable",
"=",
"ds",
".",
"variables"... | Check units for variables defining vertical position are valid under
CF.
CF §4.3.1 The units attribute for dimensional coordinates will be a string
formatted as per the udunits.dat file.
The acceptable units for vertical (depth or height) coordinate variables
are:
- uni... | [
"Check",
"units",
"for",
"variables",
"defining",
"vertical",
"position",
"are",
"valid",
"under",
"CF",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1746-L1800 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_dimensionless_vertical_coordinate | def check_dimensionless_vertical_coordinate(self, ds):
'''
Check the validity of dimensionless coordinates under CF
CF §4.3.2 The units attribute is not required for dimensionless
coordinates.
The standard_name attribute associates a coordinate with its definition
from ... | python | def check_dimensionless_vertical_coordinate(self, ds):
'''
Check the validity of dimensionless coordinates under CF
CF §4.3.2 The units attribute is not required for dimensionless
coordinates.
The standard_name attribute associates a coordinate with its definition
from ... | [
"def",
"check_dimensionless_vertical_coordinate",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"z_variables",
"=",
"cfutil",
".",
"get_z_variables",
"(",
"ds",
")",
"deprecated_units",
"=",
"[",
"'level'",
",",
"'layer'",
",",
"'sigma_level'",
"... | Check the validity of dimensionless coordinates under CF
CF §4.3.2 The units attribute is not required for dimensionless
coordinates.
The standard_name attribute associates a coordinate with its definition
from Appendix D, Dimensionless Vertical Coordinates. The definition
prov... | [
"Check",
"the",
"validity",
"of",
"dimensionless",
"coordinates",
"under",
"CF"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1802-L1850 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_formula_terms | def _check_formula_terms(self, ds, coord):
'''
Checks a dimensionless vertical coordinate contains valid formula_terms
- formula_terms is a non-empty string
- formula_terms matches regx
- every variable defined in formula_terms exists
:param netCDF4.Dataset ds: An open ... | python | def _check_formula_terms(self, ds, coord):
'''
Checks a dimensionless vertical coordinate contains valid formula_terms
- formula_terms is a non-empty string
- formula_terms matches regx
- every variable defined in formula_terms exists
:param netCDF4.Dataset ds: An open ... | [
"def",
"_check_formula_terms",
"(",
"self",
",",
"ds",
",",
"coord",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"coord",
"]",
"standard_name",
"=",
"getattr",
"(",
"variable",
",",
"'standard_name'",
",",
"None",
")",
"formula_terms",
"=",
"ge... | Checks a dimensionless vertical coordinate contains valid formula_terms
- formula_terms is a non-empty string
- formula_terms matches regx
- every variable defined in formula_terms exists
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: compliance_checker.base.Result | [
"Checks",
"a",
"dimensionless",
"vertical",
"coordinate",
"contains",
"valid",
"formula_terms"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1852-L1906 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_time_coordinate | def check_time_coordinate(self, ds):
'''
Check variables defining time are valid under CF
CF §4.4 Variables representing time must always explicitly include the
units attribute; there is no default value.
The units attribute takes a string value formatted as per the
rec... | python | def check_time_coordinate(self, ds):
'''
Check variables defining time are valid under CF
CF §4.4 Variables representing time must always explicitly include the
units attribute; there is no default value.
The units attribute takes a string value formatted as per the
rec... | [
"def",
"check_time_coordinate",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"name",
"in",
"cfutil",
".",
"get_time_variables",
"(",
"ds",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"name",
"]",
"has_units",
"=",
"has... | Check variables defining time are valid under CF
CF §4.4 Variables representing time must always explicitly include the
units attribute; there is no default value.
The units attribute takes a string value formatted as per the
recommendations in the Udunits package.
The accepta... | [
"Check",
"variables",
"defining",
"time",
"are",
"valid",
"under",
"CF"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1908-L1967 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_aux_coordinates | def check_aux_coordinates(self, ds):
'''
Chapter 5 paragraph 3
The dimensions of an auxiliary coordinate variable must be a subset of
the dimensions of the variable with which the coordinate is associated,
with two exceptions. First, string-valued coordinates (Section 6.1,
... | python | def check_aux_coordinates(self, ds):
'''
Chapter 5 paragraph 3
The dimensions of an auxiliary coordinate variable must be a subset of
the dimensions of the variable with which the coordinate is associated,
with two exceptions. First, string-valued coordinates (Section 6.1,
... | [
"def",
"check_aux_coordinates",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"geophysical_variables",
"=",
"self",
".",
"_find_geophysical_vars",
"(",
"ds",
")",
"for",
"name",
"in",
"geophysical_variables",
":",
"variable",
"=",
"ds",
".",
"v... | Chapter 5 paragraph 3
The dimensions of an auxiliary coordinate variable must be a subset of
the dimensions of the variable with which the coordinate is associated,
with two exceptions. First, string-valued coordinates (Section 6.1,
"Labels") have a dimension for maximum string length. ... | [
"Chapter",
"5",
"paragraph",
"3"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2074-L2126 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_duplicate_axis | def check_duplicate_axis(self, ds):
'''
Checks that no variable contains two coordinates defining the same
axis.
Chapter 5 paragraph 6
If an axis attribute is attached to an auxiliary coordinate variable,
it can be used by applications in the same way the `axis` attribu... | python | def check_duplicate_axis(self, ds):
'''
Checks that no variable contains two coordinates defining the same
axis.
Chapter 5 paragraph 6
If an axis attribute is attached to an auxiliary coordinate variable,
it can be used by applications in the same way the `axis` attribu... | [
"def",
"check_duplicate_axis",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"geophysical_variables",
"=",
"self",
".",
"_find_geophysical_vars",
"(",
"ds",
")",
"for",
"name",
"in",
"geophysical_variables",
":",
"no_duplicates",
"=",
"TestCtx",
... | Checks that no variable contains two coordinates defining the same
axis.
Chapter 5 paragraph 6
If an axis attribute is attached to an auxiliary coordinate variable,
it can be used by applications in the same way the `axis` attribute
attached to a coordinate variable is used. Ho... | [
"Checks",
"that",
"no",
"variable",
"contains",
"two",
"coordinates",
"defining",
"the",
"same",
"axis",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2128-L2170 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_multi_dimensional_coords | def check_multi_dimensional_coords(self, ds):
'''
Checks that no multidimensional coordinate shares a name with its
dimensions.
Chapter 5 paragraph 4
We recommend that the name of a [multidimensional coordinate] should
not match the name of any of its dimensions.
... | python | def check_multi_dimensional_coords(self, ds):
'''
Checks that no multidimensional coordinate shares a name with its
dimensions.
Chapter 5 paragraph 4
We recommend that the name of a [multidimensional coordinate] should
not match the name of any of its dimensions.
... | [
"def",
"check_multi_dimensional_coords",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"coord",
"in",
"self",
".",
"_find_aux_coord_vars",
"(",
"ds",
")",
":",
"variable",
"=",
"ds",
".",
"variables",
"[",
"coord",
"]",
"if",
"variab... | Checks that no multidimensional coordinate shares a name with its
dimensions.
Chapter 5 paragraph 4
We recommend that the name of a [multidimensional coordinate] should
not match the name of any of its dimensions.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtyp... | [
"Checks",
"that",
"no",
"multidimensional",
"coordinate",
"shares",
"a",
"name",
"with",
"its",
"dimensions",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2172-L2200 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_grid_coordinates | def check_grid_coordinates(self, ds):
"""
5.6 When the coordinate variables for a horizontal grid are not
longitude and latitude, it is required that the true latitude and
longitude coordinates be supplied via the coordinates attribute.
:param netCDF4.Dataset ds: An open netCDF ... | python | def check_grid_coordinates(self, ds):
"""
5.6 When the coordinate variables for a horizontal grid are not
longitude and latitude, it is required that the true latitude and
longitude coordinates be supplied via the coordinates attribute.
:param netCDF4.Dataset ds: An open netCDF ... | [
"def",
"check_grid_coordinates",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"latitudes",
"=",
"cfutil",
".",
"get_true_latitude_variables",
"(",
"ds",
")",
"longitudes",
"=",
"cfutil",
".",
"get_true_longitude_variables",
"(",
"ds",
")",
"chec... | 5.6 When the coordinate variables for a horizontal grid are not
longitude and latitude, it is required that the true latitude and
longitude coordinates be supplied via the coordinates attribute.
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of resu... | [
"5",
".",
"6",
"When",
"the",
"coordinate",
"variables",
"for",
"a",
"horizontal",
"grid",
"are",
"not",
"longitude",
"and",
"latitude",
"it",
"is",
"required",
"that",
"the",
"true",
"latitude",
"and",
"longitude",
"coordinates",
"be",
"supplied",
"via",
"t... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2202-L2286 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_reduced_horizontal_grid | def check_reduced_horizontal_grid(self, ds):
"""
5.3 A "reduced" longitude-latitude grid is one in which the points are
arranged along constant latitude lines with the number of points on a
latitude line decreasing toward the poles.
Recommend that this type of gridded data be st... | python | def check_reduced_horizontal_grid(self, ds):
"""
5.3 A "reduced" longitude-latitude grid is one in which the points are
arranged along constant latitude lines with the number of points on a
latitude line decreasing toward the poles.
Recommend that this type of gridded data be st... | [
"def",
"check_reduced_horizontal_grid",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"lats",
"=",
"set",
"(",
"cfutil",
".",
"get_latitude_variables",
"(",
"ds",
")",
")",
"lons",
"=",
"set",
"(",
"cfutil",
".",
"get_longitude_variables",
"(... | 5.3 A "reduced" longitude-latitude grid is one in which the points are
arranged along constant latitude lines with the number of points on a
latitude line decreasing toward the poles.
Recommend that this type of gridded data be stored using the compression
scheme described in Section 8.... | [
"5",
".",
"3",
"A",
"reduced",
"longitude",
"-",
"latitude",
"grid",
"is",
"one",
"in",
"which",
"the",
"points",
"are",
"arranged",
"along",
"constant",
"latitude",
"lines",
"with",
"the",
"number",
"of",
"points",
"on",
"a",
"latitude",
"line",
"decreasi... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2288-L2349 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_grid_mapping | def check_grid_mapping(self, ds):
"""
5.6 When the coordinate variables for a horizontal grid are not
longitude and latitude, it is required that the true latitude and
longitude coordinates be supplied via the coordinates attribute. If in
addition it is desired to describe the ma... | python | def check_grid_mapping(self, ds):
"""
5.6 When the coordinate variables for a horizontal grid are not
longitude and latitude, it is required that the true latitude and
longitude coordinates be supplied via the coordinates attribute. If in
addition it is desired to describe the ma... | [
"def",
"check_grid_mapping",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"grid_mapping_variables",
"=",
"cfutil",
".",
"get_grid_mapping_variables",
"(",
"ds",
")",
"for",
"variable",
"in",
"ds",
".",
"get_variables_by_attributes",
"(",
"grid_map... | 5.6 When the coordinate variables for a horizontal grid are not
longitude and latitude, it is required that the true latitude and
longitude coordinates be supplied via the coordinates attribute. If in
addition it is desired to describe the mapping between the given
coordinate variables a... | [
"5",
".",
"6",
"When",
"the",
"coordinate",
"variables",
"for",
"a",
"horizontal",
"grid",
"are",
"not",
"longitude",
"and",
"latitude",
"it",
"is",
"required",
"that",
"the",
"true",
"latitude",
"and",
"longitude",
"coordinates",
"be",
"supplied",
"via",
"t... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2353-L2466 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_geographic_region | def check_geographic_region(self, ds):
"""
6.1.1 When data is representative of geographic regions which can be identified by names but which have complex
boundaries that cannot practically be specified using longitude and latitude boundary coordinates, a labeled
axis should be used to i... | python | def check_geographic_region(self, ds):
"""
6.1.1 When data is representative of geographic regions which can be identified by names but which have complex
boundaries that cannot practically be specified using longitude and latitude boundary coordinates, a labeled
axis should be used to i... | [
"def",
"check_geographic_region",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"region_list",
"=",
"[",
"'africa'",
",",
"'antarctica'",
",",
"'arabian_sea'",
",",
"'aral_sea'",
",",
"'arctic_ocean'",
",",
"'asia'",
",",
"'atlantic_ocean'",
",",... | 6.1.1 When data is representative of geographic regions which can be identified by names but which have complex
boundaries that cannot practically be specified using longitude and latitude boundary coordinates, a labeled
axis should be used to identify the regions.
Recommend that the names be c... | [
"6",
".",
"1",
".",
"1",
"When",
"data",
"is",
"representative",
"of",
"geographic",
"regions",
"which",
"can",
"be",
"identified",
"by",
"names",
"but",
"which",
"have",
"complex",
"boundaries",
"that",
"cannot",
"practically",
"be",
"specified",
"using",
"... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2474-L2571 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_cell_boundaries | def check_cell_boundaries(self, ds):
"""
Checks the dimensions of cell boundary variables to ensure they are CF compliant.
7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds
is the name of the variable that contains the vert... | python | def check_cell_boundaries(self, ds):
"""
Checks the dimensions of cell boundary variables to ensure they are CF compliant.
7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds
is the name of the variable that contains the vert... | [
"def",
"check_cell_boundaries",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"reasoning",
"=",
"[",
"]",
"for",
"variable_name",
",",
"boundary_variable_name",
"in",
"cfutil",
".",
"get_cell_boundary_map",
"(",
"ds",
")",
".",
"items",
"(",
... | Checks the dimensions of cell boundary variables to ensure they are CF compliant.
7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds
is the name of the variable that contains the vertices of the cell boundaries. We refer to this type of var... | [
"Checks",
"the",
"dimensions",
"of",
"cell",
"boundary",
"variables",
"to",
"ensure",
"they",
"are",
"CF",
"compliant",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L2579-L2669 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_packed_data | def check_packed_data(self, ds):
"""
8.1 Simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and
add_offset. After the data values of a variable have been read, they are to be multiplied by the scale_factor,
and have add_offset added to them... | python | def check_packed_data(self, ds):
"""
8.1 Simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and
add_offset. After the data values of a variable have been read, they are to be multiplied by the scale_factor,
and have add_offset added to them... | [
"def",
"check_packed_data",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"name",
",",
"var",
"in",
"ds",
".",
"variables",
".",
"items",
"(",
")",
":",
"add_offset",
"=",
"getattr",
"(",
"var",
",",
"'add_offset'",
",",
"None",
... | 8.1 Simple packing may be achieved through the use of the optional NUG defined attributes scale_factor and
add_offset. After the data values of a variable have been read, they are to be multiplied by the scale_factor,
and have add_offset added to them.
The units of a variable should be represen... | [
"8",
".",
"1",
"Simple",
"packing",
"may",
"be",
"achieved",
"through",
"the",
"use",
"of",
"the",
"optional",
"NUG",
"defined",
"attributes",
"scale_factor",
"and",
"add_offset",
".",
"After",
"the",
"data",
"values",
"of",
"a",
"variable",
"have",
"been",
... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3040-L3127 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_compression_gathering | def check_compression_gathering(self, ds):
"""
At the current time the netCDF interface does not provide for packing
data. However a simple packing may be achieved through the use of the
optional NUG defined attributes scale_factor and add_offset . After the
data values of a vari... | python | def check_compression_gathering(self, ds):
"""
At the current time the netCDF interface does not provide for packing
data. However a simple packing may be achieved through the use of the
optional NUG defined attributes scale_factor and add_offset . After the
data values of a vari... | [
"def",
"check_compression_gathering",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"for",
"compress_var",
"in",
"ds",
".",
"get_variables_by_attributes",
"(",
"compress",
"=",
"lambda",
"s",
":",
"s",
"is",
"not",
"None",
")",
":",
"valid",
... | At the current time the netCDF interface does not provide for packing
data. However a simple packing may be achieved through the use of the
optional NUG defined attributes scale_factor and add_offset . After the
data values of a variable have been read, they are to be multiplied by
the s... | [
"At",
"the",
"current",
"time",
"the",
"netCDF",
"interface",
"does",
"not",
"provide",
"for",
"packing",
"data",
".",
"However",
"a",
"simple",
"packing",
"may",
"be",
"achieved",
"through",
"the",
"use",
"of",
"the",
"optional",
"NUG",
"defined",
"attribut... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3129-L3194 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_all_features_are_same_type | def check_all_features_are_same_type(self, ds):
"""
Check that the feature types in a dataset are all the same.
9.1 The features contained within a collection must always be of the same type; and all the collections in a CF file
must be of the same feature type.
point, timeSeri... | python | def check_all_features_are_same_type(self, ds):
"""
Check that the feature types in a dataset are all the same.
9.1 The features contained within a collection must always be of the same type; and all the collections in a CF file
must be of the same feature type.
point, timeSeri... | [
"def",
"check_all_features_are_same_type",
"(",
"self",
",",
"ds",
")",
":",
"all_the_same",
"=",
"TestCtx",
"(",
"BaseCheck",
".",
"HIGH",
",",
"self",
".",
"section_titles",
"[",
"'9.1'",
"]",
")",
"feature_types_found",
"=",
"defaultdict",
"(",
"list",
")",... | Check that the feature types in a dataset are all the same.
9.1 The features contained within a collection must always be of the same type; and all the collections in a CF file
must be of the same feature type.
point, timeSeries, trajectory, profile, timeSeriesProfile, trajectoryProfile.
... | [
"Check",
"that",
"the",
"feature",
"types",
"in",
"a",
"dataset",
"are",
"all",
"the",
"same",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3202-L3235 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_cf_role | def check_cf_role(self, ds):
"""
Check variables defining cf_role for legal cf_role values.
§9.5 The only acceptable values of cf_role for Discrete Geometry CF
data sets are timeseries_id, profile_id, and trajectory_id
:param netCDF4.Dataset ds: An open netCDF dataset
:... | python | def check_cf_role(self, ds):
"""
Check variables defining cf_role for legal cf_role values.
§9.5 The only acceptable values of cf_role for Discrete Geometry CF
data sets are timeseries_id, profile_id, and trajectory_id
:param netCDF4.Dataset ds: An open netCDF dataset
:... | [
"def",
"check_cf_role",
"(",
"self",
",",
"ds",
")",
":",
"valid_roles",
"=",
"[",
"'timeseries_id'",
",",
"'profile_id'",
",",
"'trajectory_id'",
"]",
"variable_count",
"=",
"0",
"for",
"variable",
"in",
"ds",
".",
"get_variables_by_attributes",
"(",
"cf_role",... | Check variables defining cf_role for legal cf_role values.
§9.5 The only acceptable values of cf_role for Discrete Geometry CF
data sets are timeseries_id, profile_id, and trajectory_id
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: compliance_checker.base.Result | [
"Check",
"variables",
"defining",
"cf_role",
"for",
"legal",
"cf_role",
"values",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3260-L3284 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_variable_features | def check_variable_features(self, ds):
'''
Checks the variable feature types match the dataset featureType attribute
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results
'''
ret_val = []
feature_list = ['point', 'timeSer... | python | def check_variable_features(self, ds):
'''
Checks the variable feature types match the dataset featureType attribute
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results
'''
ret_val = []
feature_list = ['point', 'timeSer... | [
"def",
"check_variable_features",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"feature_list",
"=",
"[",
"'point'",
",",
"'timeSeries'",
",",
"'trajectory'",
",",
"'profile'",
",",
"'timeSeriesProfile'",
",",
"'trajectoryProfile'",
"]",
"feature_t... | Checks the variable feature types match the dataset featureType attribute
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results | [
"Checks",
"the",
"variable",
"feature",
"types",
"match",
"the",
"dataset",
"featureType",
"attribute"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3286-L3343 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck.check_hints | def check_hints(self, ds):
'''
Checks for potentially mislabeled metadata and makes suggestions for how to correct
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results
'''
ret_val = []
ret_val.extend(self._check_hint_bo... | python | def check_hints(self, ds):
'''
Checks for potentially mislabeled metadata and makes suggestions for how to correct
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results
'''
ret_val = []
ret_val.extend(self._check_hint_bo... | [
"def",
"check_hints",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"ret_val",
".",
"extend",
"(",
"self",
".",
"_check_hint_bounds",
"(",
"ds",
")",
")",
"return",
"ret_val"
] | Checks for potentially mislabeled metadata and makes suggestions for how to correct
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results | [
"Checks",
"for",
"potentially",
"mislabeled",
"metadata",
"and",
"makes",
"suggestions",
"for",
"how",
"to",
"correct"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3345-L3357 | train |
ioos/compliance-checker | compliance_checker/cf/cf.py | CFBaseCheck._check_hint_bounds | def _check_hint_bounds(self, ds):
'''
Checks for variables ending with _bounds, if they are not cell methods,
make the recommendation
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results
'''
ret_val = []
boundary... | python | def _check_hint_bounds(self, ds):
'''
Checks for variables ending with _bounds, if they are not cell methods,
make the recommendation
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results
'''
ret_val = []
boundary... | [
"def",
"_check_hint_bounds",
"(",
"self",
",",
"ds",
")",
":",
"ret_val",
"=",
"[",
"]",
"boundary_variables",
"=",
"cfutil",
".",
"get_cell_boundary_variables",
"(",
"ds",
")",
"for",
"name",
"in",
"ds",
".",
"variables",
":",
"if",
"name",
".",
"endswith... | Checks for variables ending with _bounds, if they are not cell methods,
make the recommendation
:param netCDF4.Dataset ds: An open netCDF dataset
:rtype: list
:return: List of results | [
"Checks",
"for",
"variables",
"ending",
"with",
"_bounds",
"if",
"they",
"are",
"not",
"cell",
"methods",
"make",
"the",
"recommendation"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L3359-L3380 | train |
ioos/compliance-checker | compliance_checker/protocols/netcdf.py | is_netcdf | def is_netcdf(url):
'''
Returns True if the URL points to a valid local netCDF file
:param str url: Location of file on the file system
'''
# Try an obvious exclusion of remote resources
if url.startswith('http'):
return False
# If it's a known extension, give it a shot
if url.... | python | def is_netcdf(url):
'''
Returns True if the URL points to a valid local netCDF file
:param str url: Location of file on the file system
'''
# Try an obvious exclusion of remote resources
if url.startswith('http'):
return False
# If it's a known extension, give it a shot
if url.... | [
"def",
"is_netcdf",
"(",
"url",
")",
":",
"if",
"url",
".",
"startswith",
"(",
"'http'",
")",
":",
"return",
"False",
"if",
"url",
".",
"endswith",
"(",
"'nc'",
")",
":",
"return",
"True",
"with",
"open",
"(",
"url",
",",
"'rb'",
")",
"as",
"f",
... | Returns True if the URL points to a valid local netCDF file
:param str url: Location of file on the file system | [
"Returns",
"True",
"if",
"the",
"URL",
"points",
"to",
"a",
"valid",
"local",
"netCDF",
"file"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/protocols/netcdf.py#L9-L33 | train |
ioos/compliance-checker | compliance_checker/cf/util.py | get_safe | def get_safe(dict_instance, keypath, default=None):
"""
Returns a value with in a nested dict structure from a dot separated
path expression such as "system.server.host" or a list of key entries
@retval Value if found or None
"""
try:
obj = dict_instance
keylist = keypath if type... | python | def get_safe(dict_instance, keypath, default=None):
"""
Returns a value with in a nested dict structure from a dot separated
path expression such as "system.server.host" or a list of key entries
@retval Value if found or None
"""
try:
obj = dict_instance
keylist = keypath if type... | [
"def",
"get_safe",
"(",
"dict_instance",
",",
"keypath",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"obj",
"=",
"dict_instance",
"keylist",
"=",
"keypath",
"if",
"type",
"(",
"keypath",
")",
"is",
"list",
"else",
"keypath",
".",
"split",
"(",
"... | Returns a value with in a nested dict structure from a dot separated
path expression such as "system.server.host" or a list of key entries
@retval Value if found or None | [
"Returns",
"a",
"value",
"with",
"in",
"a",
"nested",
"dict",
"structure",
"from",
"a",
"dot",
"separated",
"path",
"expression",
"such",
"as",
"system",
".",
"server",
".",
"host",
"or",
"a",
"list",
"of",
"key",
"entries"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/util.py#L161-L174 | train |
ioos/compliance-checker | compliance_checker/cf/util.py | download_cf_standard_name_table | def download_cf_standard_name_table(version, location=None):
'''
Downloads the specified CF standard name table version and saves it to file
:param str version: CF standard name table version number (i.e 34)
:param str location: Path/filename to write downloaded xml file to
'''
if location is ... | python | def download_cf_standard_name_table(version, location=None):
'''
Downloads the specified CF standard name table version and saves it to file
:param str version: CF standard name table version number (i.e 34)
:param str location: Path/filename to write downloaded xml file to
'''
if location is ... | [
"def",
"download_cf_standard_name_table",
"(",
"version",
",",
"location",
"=",
"None",
")",
":",
"if",
"location",
"is",
"None",
":",
"location",
"=",
"resource_filename",
"(",
"'compliance_checker'",
",",
"'data/cf-standard-name-table.xml'",
")",
"url",
"=",
"\"ht... | Downloads the specified CF standard name table version and saves it to file
:param str version: CF standard name table version number (i.e 34)
:param str location: Path/filename to write downloaded xml file to | [
"Downloads",
"the",
"specified",
"CF",
"standard",
"name",
"table",
"version",
"and",
"saves",
"it",
"to",
"file"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/util.py#L320-L339 | train |
ioos/compliance-checker | compliance_checker/cf/util.py | find_coord_vars | def find_coord_vars(ncds):
"""
Finds all coordinate variables in a dataset.
A variable with the same name as a dimension is called a coordinate variable.
"""
coord_vars = []
for d in ncds.dimensions:
if d in ncds.variables and ncds.variables[d].dimensions == (d,):
coord_var... | python | def find_coord_vars(ncds):
"""
Finds all coordinate variables in a dataset.
A variable with the same name as a dimension is called a coordinate variable.
"""
coord_vars = []
for d in ncds.dimensions:
if d in ncds.variables and ncds.variables[d].dimensions == (d,):
coord_var... | [
"def",
"find_coord_vars",
"(",
"ncds",
")",
":",
"coord_vars",
"=",
"[",
"]",
"for",
"d",
"in",
"ncds",
".",
"dimensions",
":",
"if",
"d",
"in",
"ncds",
".",
"variables",
"and",
"ncds",
".",
"variables",
"[",
"d",
"]",
".",
"dimensions",
"==",
"(",
... | Finds all coordinate variables in a dataset.
A variable with the same name as a dimension is called a coordinate variable. | [
"Finds",
"all",
"coordinate",
"variables",
"in",
"a",
"dataset",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/util.py#L406-L418 | train |
ioos/compliance-checker | compliance_checker/cf/util.py | is_time_variable | def is_time_variable(varname, var):
"""
Identifies if a variable is represents time
"""
satisfied = varname.lower() == 'time'
satisfied |= getattr(var, 'standard_name', '') == 'time'
satisfied |= getattr(var, 'axis', '') == 'T'
satisfied |= units_convertible('seconds since 1900-01-01', getat... | python | def is_time_variable(varname, var):
"""
Identifies if a variable is represents time
"""
satisfied = varname.lower() == 'time'
satisfied |= getattr(var, 'standard_name', '') == 'time'
satisfied |= getattr(var, 'axis', '') == 'T'
satisfied |= units_convertible('seconds since 1900-01-01', getat... | [
"def",
"is_time_variable",
"(",
"varname",
",",
"var",
")",
":",
"satisfied",
"=",
"varname",
".",
"lower",
"(",
")",
"==",
"'time'",
"satisfied",
"|=",
"getattr",
"(",
"var",
",",
"'standard_name'",
",",
"''",
")",
"==",
"'time'",
"satisfied",
"|=",
"ge... | Identifies if a variable is represents time | [
"Identifies",
"if",
"a",
"variable",
"is",
"represents",
"time"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/util.py#L421-L429 | train |
ioos/compliance-checker | compliance_checker/cf/util.py | is_vertical_coordinate | def is_vertical_coordinate(var_name, var):
"""
Determines if a variable is a vertical coordinate variable
4.3
A vertical coordinate will be identifiable by: units of pressure; or the presence of the positive attribute with a
value of up or down (case insensitive). Optionally, the vertical type may... | python | def is_vertical_coordinate(var_name, var):
"""
Determines if a variable is a vertical coordinate variable
4.3
A vertical coordinate will be identifiable by: units of pressure; or the presence of the positive attribute with a
value of up or down (case insensitive). Optionally, the vertical type may... | [
"def",
"is_vertical_coordinate",
"(",
"var_name",
",",
"var",
")",
":",
"satisfied",
"=",
"var_name",
".",
"lower",
"(",
")",
"in",
"_possiblez",
"satisfied",
"|=",
"getattr",
"(",
"var",
",",
"'standard_name'",
",",
"''",
")",
"in",
"_possiblez",
"satisfied... | Determines if a variable is a vertical coordinate variable
4.3
A vertical coordinate will be identifiable by: units of pressure; or the presence of the positive attribute with a
value of up or down (case insensitive). Optionally, the vertical type may be indicated additionally by providing
the standar... | [
"Determines",
"if",
"a",
"variable",
"is",
"a",
"vertical",
"coordinate",
"variable"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/util.py#L432-L451 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck.get_applicable_variables | def get_applicable_variables(self, ds):
'''
Returns a list of variable names that are applicable to ACDD Metadata
Checks for variables. This includes geophysical and coordinate
variables only.
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if self._applica... | python | def get_applicable_variables(self, ds):
'''
Returns a list of variable names that are applicable to ACDD Metadata
Checks for variables. This includes geophysical and coordinate
variables only.
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if self._applica... | [
"def",
"get_applicable_variables",
"(",
"self",
",",
"ds",
")",
":",
"if",
"self",
".",
"_applicable_variables",
"is",
"None",
":",
"self",
".",
"applicable_variables",
"=",
"cfutil",
".",
"get_geophysical_variables",
"(",
"ds",
")",
"varname",
"=",
"cfutil",
... | Returns a list of variable names that are applicable to ACDD Metadata
Checks for variables. This includes geophysical and coordinate
variables only.
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Returns",
"a",
"list",
"of",
"variable",
"names",
"that",
"are",
"applicable",
"to",
"ACDD",
"Metadata",
"Checks",
"for",
"variables",
".",
"This",
"includes",
"geophysical",
"and",
"coordinate",
"variables",
"only",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L117-L141 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck.check_var_long_name | def check_var_long_name(self, ds):
'''
Checks each applicable variable for the long_name attribute
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
# ACDD Variable Metadata applies to all coordinate variables and
# geophysical variables only.
... | python | def check_var_long_name(self, ds):
'''
Checks each applicable variable for the long_name attribute
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
# ACDD Variable Metadata applies to all coordinate variables and
# geophysical variables only.
... | [
"def",
"check_var_long_name",
"(",
"self",
",",
"ds",
")",
":",
"results",
"=",
"[",
"]",
"for",
"variable",
"in",
"self",
".",
"get_applicable_variables",
"(",
"ds",
")",
":",
"msgs",
"=",
"[",
"]",
"long_name",
"=",
"getattr",
"(",
"ds",
".",
"variab... | Checks each applicable variable for the long_name attribute
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Checks",
"each",
"applicable",
"variable",
"for",
"the",
"long_name",
"attribute"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L143-L162 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck.check_var_standard_name | def check_var_standard_name(self, ds):
'''
Checks each applicable variable for the standard_name attribute
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
for variable in self.get_applicable_variables(ds):
msgs = []
std_name = g... | python | def check_var_standard_name(self, ds):
'''
Checks each applicable variable for the standard_name attribute
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
for variable in self.get_applicable_variables(ds):
msgs = []
std_name = g... | [
"def",
"check_var_standard_name",
"(",
"self",
",",
"ds",
")",
":",
"results",
"=",
"[",
"]",
"for",
"variable",
"in",
"self",
".",
"get_applicable_variables",
"(",
"ds",
")",
":",
"msgs",
"=",
"[",
"]",
"std_name",
"=",
"getattr",
"(",
"ds",
".",
"var... | Checks each applicable variable for the standard_name attribute
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Checks",
"each",
"applicable",
"variable",
"for",
"the",
"standard_name",
"attribute"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L164-L179 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck.check_var_units | def check_var_units(self, ds):
'''
Checks each applicable variable for the units attribute
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
for variable in self.get_applicable_variables(ds):
msgs = []
# Check units and dims for v... | python | def check_var_units(self, ds):
'''
Checks each applicable variable for the units attribute
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
for variable in self.get_applicable_variables(ds):
msgs = []
# Check units and dims for v... | [
"def",
"check_var_units",
"(",
"self",
",",
"ds",
")",
":",
"results",
"=",
"[",
"]",
"for",
"variable",
"in",
"self",
".",
"get_applicable_variables",
"(",
"ds",
")",
":",
"msgs",
"=",
"[",
"]",
"unit_check",
"=",
"hasattr",
"(",
"ds",
".",
"variables... | Checks each applicable variable for the units attribute
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Checks",
"each",
"applicable",
"variable",
"for",
"the",
"units",
"attribute"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L181-L201 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck.verify_geospatial_bounds | def verify_geospatial_bounds(self, ds):
"""Checks that the geospatial bounds is well formed OGC WKT"""
var = getattr(ds, 'geospatial_bounds', None)
check = var is not None
if not check:
return ratable_result(False,
"Global Attributes", # grou... | python | def verify_geospatial_bounds(self, ds):
"""Checks that the geospatial bounds is well formed OGC WKT"""
var = getattr(ds, 'geospatial_bounds', None)
check = var is not None
if not check:
return ratable_result(False,
"Global Attributes", # grou... | [
"def",
"verify_geospatial_bounds",
"(",
"self",
",",
"ds",
")",
":",
"var",
"=",
"getattr",
"(",
"ds",
",",
"'geospatial_bounds'",
",",
"None",
")",
"check",
"=",
"var",
"is",
"not",
"None",
"if",
"not",
"check",
":",
"return",
"ratable_result",
"(",
"Fa... | Checks that the geospatial bounds is well formed OGC WKT | [
"Checks",
"that",
"the",
"geospatial",
"bounds",
"is",
"well",
"formed",
"OGC",
"WKT"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L376-L395 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck._check_total_z_extents | def _check_total_z_extents(self, ds, z_variable):
'''
Check the entire array of Z for minimum and maximum and compare that to
the vertical extents defined in the global attributes
:param netCDF4.Dataset ds: An open netCDF dataset
:param str z_variable: Name of the variable repre... | python | def _check_total_z_extents(self, ds, z_variable):
'''
Check the entire array of Z for minimum and maximum and compare that to
the vertical extents defined in the global attributes
:param netCDF4.Dataset ds: An open netCDF dataset
:param str z_variable: Name of the variable repre... | [
"def",
"_check_total_z_extents",
"(",
"self",
",",
"ds",
",",
"z_variable",
")",
":",
"msgs",
"=",
"[",
"]",
"total",
"=",
"2",
"try",
":",
"vert_min",
"=",
"float",
"(",
"ds",
".",
"geospatial_vertical_min",
")",
"except",
"ValueError",
":",
"msgs",
"."... | Check the entire array of Z for minimum and maximum and compare that to
the vertical extents defined in the global attributes
:param netCDF4.Dataset ds: An open netCDF dataset
:param str z_variable: Name of the variable representing the Z-Axis | [
"Check",
"the",
"entire",
"array",
"of",
"Z",
"for",
"minimum",
"and",
"maximum",
"and",
"compare",
"that",
"to",
"the",
"vertical",
"extents",
"defined",
"in",
"the",
"global",
"attributes"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L397-L451 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck._check_scalar_vertical_extents | def _check_scalar_vertical_extents(self, ds, z_variable):
'''
Check the scalar value of Z compared to the vertical extents which
should also be equivalent
:param netCDF4.Dataset ds: An open netCDF dataset
:param str z_variable: Name of the variable representing the Z-Axis
... | python | def _check_scalar_vertical_extents(self, ds, z_variable):
'''
Check the scalar value of Z compared to the vertical extents which
should also be equivalent
:param netCDF4.Dataset ds: An open netCDF dataset
:param str z_variable: Name of the variable representing the Z-Axis
... | [
"def",
"_check_scalar_vertical_extents",
"(",
"self",
",",
"ds",
",",
"z_variable",
")",
":",
"vert_min",
"=",
"ds",
".",
"geospatial_vertical_min",
"vert_max",
"=",
"ds",
".",
"geospatial_vertical_max",
"msgs",
"=",
"[",
"]",
"total",
"=",
"2",
"zvalue",
"=",... | Check the scalar value of Z compared to the vertical extents which
should also be equivalent
:param netCDF4.Dataset ds: An open netCDF dataset
:param str z_variable: Name of the variable representing the Z-Axis | [
"Check",
"the",
"scalar",
"value",
"of",
"Z",
"compared",
"to",
"the",
"vertical",
"extents",
"which",
"should",
"also",
"be",
"equivalent"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L453-L483 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDDBaseCheck.verify_convention_version | def verify_convention_version(self, ds):
"""
Verify that the version in the Conventions field is correct
"""
try:
for convention in getattr(ds, "Conventions", '').replace(' ', '').split(','):
if convention == 'ACDD-' + self._cc_spec_version:
... | python | def verify_convention_version(self, ds):
"""
Verify that the version in the Conventions field is correct
"""
try:
for convention in getattr(ds, "Conventions", '').replace(' ', '').split(','):
if convention == 'ACDD-' + self._cc_spec_version:
... | [
"def",
"verify_convention_version",
"(",
"self",
",",
"ds",
")",
":",
"try",
":",
"for",
"convention",
"in",
"getattr",
"(",
"ds",
",",
"\"Conventions\"",
",",
"''",
")",
".",
"replace",
"(",
"' '",
",",
"''",
")",
".",
"split",
"(",
"','",
")",
":",... | Verify that the version in the Conventions field is correct | [
"Verify",
"that",
"the",
"version",
"in",
"the",
"Conventions",
"field",
"is",
"correct"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L566-L582 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDD1_3Check.check_metadata_link | def check_metadata_link(self, ds):
'''
Checks if metadata link is formed in a rational manner
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if not hasattr(ds, u'metadata_link'):
return
msgs = []
meta_link = getattr(ds, 'metadata_link')
... | python | def check_metadata_link(self, ds):
'''
Checks if metadata link is formed in a rational manner
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if not hasattr(ds, u'metadata_link'):
return
msgs = []
meta_link = getattr(ds, 'metadata_link')
... | [
"def",
"check_metadata_link",
"(",
"self",
",",
"ds",
")",
":",
"if",
"not",
"hasattr",
"(",
"ds",
",",
"u'metadata_link'",
")",
":",
"return",
"msgs",
"=",
"[",
"]",
"meta_link",
"=",
"getattr",
"(",
"ds",
",",
"'metadata_link'",
")",
"if",
"'http'",
... | Checks if metadata link is formed in a rational manner
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Checks",
"if",
"metadata",
"link",
"is",
"formed",
"in",
"a",
"rational",
"manner"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L679-L692 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDD1_3Check.check_id_has_no_blanks | def check_id_has_no_blanks(self, ds):
'''
Check if there are blanks in the id field
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if not hasattr(ds, u'id'):
return
if ' ' in getattr(ds, u'id'):
return Result(BaseCheck.MEDIUM, False, 'no_bl... | python | def check_id_has_no_blanks(self, ds):
'''
Check if there are blanks in the id field
:param netCDF4.Dataset ds: An open netCDF dataset
'''
if not hasattr(ds, u'id'):
return
if ' ' in getattr(ds, u'id'):
return Result(BaseCheck.MEDIUM, False, 'no_bl... | [
"def",
"check_id_has_no_blanks",
"(",
"self",
",",
"ds",
")",
":",
"if",
"not",
"hasattr",
"(",
"ds",
",",
"u'id'",
")",
":",
"return",
"if",
"' '",
"in",
"getattr",
"(",
"ds",
",",
"u'id'",
")",
":",
"return",
"Result",
"(",
"BaseCheck",
".",
"MEDIU... | Check if there are blanks in the id field
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Check",
"if",
"there",
"are",
"blanks",
"in",
"the",
"id",
"field"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L694-L706 | train |
ioos/compliance-checker | compliance_checker/acdd.py | ACDD1_3Check.check_var_coverage_content_type | def check_var_coverage_content_type(self, ds):
'''
Check coverage content type against valid ISO-19115-1 codes
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
for variable in cfutil.get_geophysical_variables(ds):
msgs = []
ctype... | python | def check_var_coverage_content_type(self, ds):
'''
Check coverage content type against valid ISO-19115-1 codes
:param netCDF4.Dataset ds: An open netCDF dataset
'''
results = []
for variable in cfutil.get_geophysical_variables(ds):
msgs = []
ctype... | [
"def",
"check_var_coverage_content_type",
"(",
"self",
",",
"ds",
")",
":",
"results",
"=",
"[",
"]",
"for",
"variable",
"in",
"cfutil",
".",
"get_geophysical_variables",
"(",
"ds",
")",
":",
"msgs",
"=",
"[",
"]",
"ctype",
"=",
"getattr",
"(",
"ds",
"."... | Check coverage content type against valid ISO-19115-1 codes
:param netCDF4.Dataset ds: An open netCDF dataset | [
"Check",
"coverage",
"content",
"type",
"against",
"valid",
"ISO",
"-",
"19115",
"-",
"1",
"codes"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L708-L743 | train |
ioos/compliance-checker | compliance_checker/cf/appendix_d.py | no_missing_terms | def no_missing_terms(formula_name, term_set):
"""
Returns true if the set is not missing terms corresponding to the
entries in Appendix D, False otherwise. The set of terms should be exactly
equal, and not contain more or less terms than expected.
"""
reqd_terms = dimless_vertical_coordinates[f... | python | def no_missing_terms(formula_name, term_set):
"""
Returns true if the set is not missing terms corresponding to the
entries in Appendix D, False otherwise. The set of terms should be exactly
equal, and not contain more or less terms than expected.
"""
reqd_terms = dimless_vertical_coordinates[f... | [
"def",
"no_missing_terms",
"(",
"formula_name",
",",
"term_set",
")",
":",
"reqd_terms",
"=",
"dimless_vertical_coordinates",
"[",
"formula_name",
"]",
"def",
"has_all_terms",
"(",
"reqd_termset",
")",
":",
"return",
"len",
"(",
"reqd_termset",
"^",
"term_set",
")... | Returns true if the set is not missing terms corresponding to the
entries in Appendix D, False otherwise. The set of terms should be exactly
equal, and not contain more or less terms than expected. | [
"Returns",
"true",
"if",
"the",
"set",
"is",
"not",
"missing",
"terms",
"corresponding",
"to",
"the",
"entries",
"in",
"Appendix",
"D",
"False",
"otherwise",
".",
"The",
"set",
"of",
"terms",
"should",
"be",
"exactly",
"equal",
"and",
"not",
"contain",
"mo... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/appendix_d.py#L47-L62 | train |
ioos/compliance-checker | compliance_checker/base.py | attr_check | def attr_check(kvp, ds, priority, ret_val, gname=None):
"""
Handles attribute checks for simple presence of an attribute, presence of
one of several attributes, and passing a validation function. Returns a
status along with an error message in the event of a failure. Mutates
ret_val parameter
... | python | def attr_check(kvp, ds, priority, ret_val, gname=None):
"""
Handles attribute checks for simple presence of an attribute, presence of
one of several attributes, and passing a validation function. Returns a
status along with an error message in the event of a failure. Mutates
ret_val parameter
... | [
"def",
"attr_check",
"(",
"kvp",
",",
"ds",
",",
"priority",
",",
"ret_val",
",",
"gname",
"=",
"None",
")",
":",
"msgs",
"=",
"[",
"]",
"name",
",",
"other",
"=",
"kvp",
"if",
"other",
"is",
"None",
":",
"res",
"=",
"std_check",
"(",
"ds",
",",
... | Handles attribute checks for simple presence of an attribute, presence of
one of several attributes, and passing a validation function. Returns a
status along with an error message in the event of a failure. Mutates
ret_val parameter
:param tuple(str, func) or str l: the attribute being checked
:... | [
"Handles",
"attribute",
"checks",
"for",
"simple",
"presence",
"of",
"an",
"attribute",
"presence",
"of",
"one",
"of",
"several",
"attributes",
"and",
"passing",
"a",
"validation",
"function",
".",
"Returns",
"a",
"status",
"along",
"with",
"an",
"error",
"mes... | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/base.py#L235-L336 | train |
ioos/compliance-checker | compliance_checker/base.py | fix_return_value | def fix_return_value(v, method_name, method=None, checker=None):
"""
Transforms scalar return values into Result.
"""
# remove common check prefix
method_name = (method_name or method.__func__.__name__).replace("check_","")
if v is None or not isinstance(v, Result):
v = Result(value=v, n... | python | def fix_return_value(v, method_name, method=None, checker=None):
"""
Transforms scalar return values into Result.
"""
# remove common check prefix
method_name = (method_name or method.__func__.__name__).replace("check_","")
if v is None or not isinstance(v, Result):
v = Result(value=v, n... | [
"def",
"fix_return_value",
"(",
"v",
",",
"method_name",
",",
"method",
"=",
"None",
",",
"checker",
"=",
"None",
")",
":",
"method_name",
"=",
"(",
"method_name",
"or",
"method",
".",
"__func__",
".",
"__name__",
")",
".",
"replace",
"(",
"\"check_\"",
... | Transforms scalar return values into Result. | [
"Transforms",
"scalar",
"return",
"values",
"into",
"Result",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/base.py#L360-L374 | train |
ioos/compliance-checker | compliance_checker/base.py | ratable_result | def ratable_result(value, name, msgs):
"""Returns a partial function with a Result that has not been weighted."""
return lambda w: Result(w, value, name, msgs) | python | def ratable_result(value, name, msgs):
"""Returns a partial function with a Result that has not been weighted."""
return lambda w: Result(w, value, name, msgs) | [
"def",
"ratable_result",
"(",
"value",
",",
"name",
",",
"msgs",
")",
":",
"return",
"lambda",
"w",
":",
"Result",
"(",
"w",
",",
"value",
",",
"name",
",",
"msgs",
")"
] | Returns a partial function with a Result that has not been weighted. | [
"Returns",
"a",
"partial",
"function",
"with",
"a",
"Result",
"that",
"has",
"not",
"been",
"weighted",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/base.py#L377-L379 | train |
ioos/compliance-checker | compliance_checker/base.py | score_group | def score_group(group_name=None):
'''
Warning this is deprecated as of Compliance Checker v3.2!
Please do not using scoring groups and update your plugins
if necessary
'''
warnings.warn('Score_group is deprecated as of Compliance Checker v3.2.')
def _inner(func):
def _dec(s, ds):
... | python | def score_group(group_name=None):
'''
Warning this is deprecated as of Compliance Checker v3.2!
Please do not using scoring groups and update your plugins
if necessary
'''
warnings.warn('Score_group is deprecated as of Compliance Checker v3.2.')
def _inner(func):
def _dec(s, ds):
... | [
"def",
"score_group",
"(",
"group_name",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"'Score_group is deprecated as of Compliance Checker v3.2.'",
")",
"def",
"_inner",
"(",
"func",
")",
":",
"def",
"_dec",
"(",
"s",
",",
"ds",
")",
":",
"ret_val",
... | Warning this is deprecated as of Compliance Checker v3.2!
Please do not using scoring groups and update your plugins
if necessary | [
"Warning",
"this",
"is",
"deprecated",
"as",
"of",
"Compliance",
"Checker",
"v3",
".",
"2!"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/base.py#L382-L419 | train |
ioos/compliance-checker | compliance_checker/base.py | Result.serialize | def serialize(self):
'''
Returns a serializable dictionary that represents the result object
'''
return {
'name' : self.name,
'weight' : self.weight,
'value' : self.value,
'msgs' : self.msgs,
'children' : [i.serialize() for i in... | python | def serialize(self):
'''
Returns a serializable dictionary that represents the result object
'''
return {
'name' : self.name,
'weight' : self.weight,
'value' : self.value,
'msgs' : self.msgs,
'children' : [i.serialize() for i in... | [
"def",
"serialize",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'weight'",
":",
"self",
".",
"weight",
",",
"'value'",
":",
"self",
".",
"value",
",",
"'msgs'",
":",
"self",
".",
"msgs",
",",
"'children'",
":",
"... | Returns a serializable dictionary that represents the result object | [
"Returns",
"a",
"serializable",
"dictionary",
"that",
"represents",
"the",
"result",
"object"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/base.py#L160-L170 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite._get_generator_plugins | def _get_generator_plugins(cls):
"""
Return a list of classes from external plugins that are used to
generate checker classes
"""
if not hasattr(cls, 'suite_generators'):
gens = working_set.iter_entry_points('compliance_checker.generators')
cls.suite_gene... | python | def _get_generator_plugins(cls):
"""
Return a list of classes from external plugins that are used to
generate checker classes
"""
if not hasattr(cls, 'suite_generators'):
gens = working_set.iter_entry_points('compliance_checker.generators')
cls.suite_gene... | [
"def",
"_get_generator_plugins",
"(",
"cls",
")",
":",
"if",
"not",
"hasattr",
"(",
"cls",
",",
"'suite_generators'",
")",
":",
"gens",
"=",
"working_set",
".",
"iter_entry_points",
"(",
"'compliance_checker.generators'",
")",
"cls",
".",
"suite_generators",
"=",
... | Return a list of classes from external plugins that are used to
generate checker classes | [
"Return",
"a",
"list",
"of",
"classes",
"from",
"external",
"plugins",
"that",
"are",
"used",
"to",
"generate",
"checker",
"classes"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L49-L59 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.load_generated_checkers | def load_generated_checkers(cls, args):
"""
Load checker classes from generator plugins
"""
for gen in cls._get_generator_plugins():
checkers = gen.get_checkers(args)
cls.checkers.update(checkers) | python | def load_generated_checkers(cls, args):
"""
Load checker classes from generator plugins
"""
for gen in cls._get_generator_plugins():
checkers = gen.get_checkers(args)
cls.checkers.update(checkers) | [
"def",
"load_generated_checkers",
"(",
"cls",
",",
"args",
")",
":",
"for",
"gen",
"in",
"cls",
".",
"_get_generator_plugins",
"(",
")",
":",
"checkers",
"=",
"gen",
".",
"get_checkers",
"(",
"args",
")",
"cls",
".",
"checkers",
".",
"update",
"(",
"chec... | Load checker classes from generator plugins | [
"Load",
"checker",
"classes",
"from",
"generator",
"plugins"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L71-L78 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.load_all_available_checkers | def load_all_available_checkers(cls):
"""
Helper method to retrieve all sub checker classes derived from various
base classes.
"""
for x in working_set.iter_entry_points('compliance_checker.suites'):
try:
xl = x.resolve()
cls.checkers['... | python | def load_all_available_checkers(cls):
"""
Helper method to retrieve all sub checker classes derived from various
base classes.
"""
for x in working_set.iter_entry_points('compliance_checker.suites'):
try:
xl = x.resolve()
cls.checkers['... | [
"def",
"load_all_available_checkers",
"(",
"cls",
")",
":",
"for",
"x",
"in",
"working_set",
".",
"iter_entry_points",
"(",
"'compliance_checker.suites'",
")",
":",
"try",
":",
"xl",
"=",
"x",
".",
"resolve",
"(",
")",
"cls",
".",
"checkers",
"[",
"':'",
"... | Helper method to retrieve all sub checker classes derived from various
base classes. | [
"Helper",
"method",
"to",
"retrieve",
"all",
"sub",
"checker",
"classes",
"derived",
"from",
"various",
"base",
"classes",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L81-L116 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite._get_checks | def _get_checks(self, checkclass, skip_checks):
"""
Helper method to retreive check methods from a Checker class. Excludes
any checks in `skip_checks`.
The name of the methods in the Checker class should start with "check_" for this
method to find them.
"""
meth... | python | def _get_checks(self, checkclass, skip_checks):
"""
Helper method to retreive check methods from a Checker class. Excludes
any checks in `skip_checks`.
The name of the methods in the Checker class should start with "check_" for this
method to find them.
"""
meth... | [
"def",
"_get_checks",
"(",
"self",
",",
"checkclass",
",",
"skip_checks",
")",
":",
"meths",
"=",
"inspect",
".",
"getmembers",
"(",
"checkclass",
",",
"inspect",
".",
"ismethod",
")",
"returned_checks",
"=",
"[",
"]",
"for",
"fn_name",
",",
"fn_obj",
"in"... | Helper method to retreive check methods from a Checker class. Excludes
any checks in `skip_checks`.
The name of the methods in the Checker class should start with "check_" for this
method to find them. | [
"Helper",
"method",
"to",
"retreive",
"check",
"methods",
"from",
"a",
"Checker",
"class",
".",
"Excludes",
"any",
"checks",
"in",
"skip_checks",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L118-L134 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite._run_check | def _run_check(self, check_method, ds, max_level):
"""
Runs a check and appends a result to the values list.
@param bound method check_method: a given check method
@param netCDF4 dataset ds
@param int max_level: check level
@return list: list of Result objects
"""... | python | def _run_check(self, check_method, ds, max_level):
"""
Runs a check and appends a result to the values list.
@param bound method check_method: a given check method
@param netCDF4 dataset ds
@param int max_level: check level
@return list: list of Result objects
"""... | [
"def",
"_run_check",
"(",
"self",
",",
"check_method",
",",
"ds",
",",
"max_level",
")",
":",
"val",
"=",
"check_method",
"(",
"ds",
")",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"check_val",
"=",
"[",
"]",
"for",
"v",
"in",
"val",
":... | Runs a check and appends a result to the values list.
@param bound method check_method: a given check method
@param netCDF4 dataset ds
@param int max_level: check level
@return list: list of Result objects | [
"Runs",
"a",
"check",
"and",
"appends",
"a",
"result",
"to",
"the",
"values",
"list",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L136-L160 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite._get_check_versioned_name | def _get_check_versioned_name(self, check_name):
"""
The compliance checker allows the user to specify a
check without a version number but we want the report
to specify the version number.
Returns the check name with the version number it checked
"""
if ':' not ... | python | def _get_check_versioned_name(self, check_name):
"""
The compliance checker allows the user to specify a
check without a version number but we want the report
to specify the version number.
Returns the check name with the version number it checked
"""
if ':' not ... | [
"def",
"_get_check_versioned_name",
"(",
"self",
",",
"check_name",
")",
":",
"if",
"':'",
"not",
"in",
"check_name",
"or",
"':latest'",
"in",
"check_name",
":",
"check_name",
"=",
"':'",
".",
"join",
"(",
"(",
"check_name",
".",
"split",
"(",
"':'",
")",
... | The compliance checker allows the user to specify a
check without a version number but we want the report
to specify the version number.
Returns the check name with the version number it checked | [
"The",
"compliance",
"checker",
"allows",
"the",
"user",
"to",
"specify",
"a",
"check",
"without",
"a",
"version",
"number",
"but",
"we",
"want",
"the",
"report",
"to",
"specify",
"the",
"version",
"number",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L162-L173 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.run | def run(self, ds, skip_checks, *checker_names):
"""
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.
"""
ret_val = {}
ch... | python | def run(self, ds, skip_checks, *checker_names):
"""
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.
"""
ret_val = {}
ch... | [
"def",
"run",
"(",
"self",
",",
"ds",
",",
"skip_checks",
",",
"*",
"checker_names",
")",
":",
"ret_val",
"=",
"{",
"}",
"checkers",
"=",
"self",
".",
"_get_valid_checkers",
"(",
"ds",
",",
"checker_names",
")",
"if",
"skip_checks",
"is",
"not",
"None",
... | 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. | [
"Runs",
"this",
"CheckSuite",
"on",
"the",
"dataset",
"with",
"all",
"the",
"passed",
"Checker",
"instances",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L247-L285 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.dict_output | def dict_output(self, check_name, groups, source_name, limit):
'''
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 ... | python | def dict_output(self, check_name, groups, source_name, limit):
'''
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 ... | [
"def",
"dict_output",
"(",
"self",
",",
"check_name",
",",
"groups",
",",
"source_name",
",",
"limit",
")",
":",
"aggregates",
"=",
"self",
".",
"build_structure",
"(",
"check_name",
",",
"groups",
",",
"source_name",
",",
"limit",
")",
"return",
"self",
"... | 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 f... | [
"Builds",
"the",
"results",
"into",
"a",
"JSON",
"structure",
"and",
"writes",
"it",
"to",
"the",
"file",
"buffer",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L380-L391 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.serialize | def serialize(self, o):
'''
Returns a safe serializable object that can be serialized into JSON.
@param o Python object to serialize
'''
if isinstance(o, (list, tuple)):
return [self.serialize(i) for i in o]
if isinstance(o, dict):
return {k: self... | python | def serialize(self, o):
'''
Returns a safe serializable object that can be serialized into JSON.
@param o Python object to serialize
'''
if isinstance(o, (list, tuple)):
return [self.serialize(i) for i in o]
if isinstance(o, dict):
return {k: self... | [
"def",
"serialize",
"(",
"self",
",",
"o",
")",
":",
"if",
"isinstance",
"(",
"o",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"self",
".",
"serialize",
"(",
"i",
")",
"for",
"i",
"in",
"o",
"]",
"if",
"isinstance",
"(",
"o",
... | Returns a safe serializable object that can be serialized into JSON.
@param o Python object to serialize | [
"Returns",
"a",
"safe",
"serializable",
"object",
"that",
"can",
"be",
"serialized",
"into",
"JSON",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L393-L407 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.checker_html_output | def checker_html_output(self, check_name, groups, source_name, limit):
'''
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
@par... | python | def checker_html_output(self, check_name, groups, source_name, limit):
'''
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
@par... | [
"def",
"checker_html_output",
"(",
"self",
",",
"check_name",
",",
"groups",
",",
"source_name",
",",
"limit",
")",
":",
"from",
"jinja2",
"import",
"Environment",
",",
"PackageLoader",
"self",
".",
"j2",
"=",
"Environment",
"(",
"loader",
"=",
"PackageLoader"... | 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 Int... | [
"Renders",
"the",
"HTML",
"output",
"for",
"a",
"single",
"test",
"using",
"Jinja2",
"and",
"returns",
"it",
"as",
"a",
"string",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L409-L424 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.html_output | def html_output(self, checkers_html):
'''
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
'''
# Note: This relies on checker_html_out... | python | def html_output(self, checkers_html):
'''
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
'''
# Note: This relies on checker_html_out... | [
"def",
"html_output",
"(",
"self",
",",
"checkers_html",
")",
":",
"template",
"=",
"self",
".",
"j2",
".",
"get_template",
"(",
"'ccheck_wrapper.html.j2'",
")",
"return",
"template",
".",
"render",
"(",
"checkers",
"=",
"checkers_html",
")"
] | 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 | [
"Renders",
"the",
"HTML",
"output",
"for",
"multiple",
"tests",
"and",
"returns",
"it",
"as",
"a",
"string",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L426-L436 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.standard_output | def standard_output(self, ds, limit, check_name, groups):
"""
Generates the Terminal Output for Standard cases
Returns the dataset needed for the verbose output, as well as the failure flags.
"""
score_list, points, out_of = self.get_points(groups, limit)
issue_count = ... | python | def standard_output(self, ds, limit, check_name, groups):
"""
Generates the Terminal Output for Standard cases
Returns the dataset needed for the verbose output, as well as the failure flags.
"""
score_list, points, out_of = self.get_points(groups, limit)
issue_count = ... | [
"def",
"standard_output",
"(",
"self",
",",
"ds",
",",
"limit",
",",
"check_name",
",",
"groups",
")",
":",
"score_list",
",",
"points",
",",
"out_of",
"=",
"self",
".",
"get_points",
"(",
"groups",
",",
"limit",
")",
"issue_count",
"=",
"out_of",
"-",
... | Generates the Terminal Output for Standard cases
Returns the dataset needed for the verbose output, as well as the failure flags. | [
"Generates",
"the",
"Terminal",
"Output",
"for",
"Standard",
"cases"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L455-L480 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.standard_output_generation | def standard_output_generation(self, groups, limit, points, out_of, check):
'''
Generates the Terminal Output
'''
if points < out_of:
self.reasoning_routine(groups, check, priority_flag=limit)
else:
print("All tests passed!") | python | def standard_output_generation(self, groups, limit, points, out_of, check):
'''
Generates the Terminal Output
'''
if points < out_of:
self.reasoning_routine(groups, check, priority_flag=limit)
else:
print("All tests passed!") | [
"def",
"standard_output_generation",
"(",
"self",
",",
"groups",
",",
"limit",
",",
"points",
",",
"out_of",
",",
"check",
")",
":",
"if",
"points",
"<",
"out_of",
":",
"self",
".",
"reasoning_routine",
"(",
"groups",
",",
"check",
",",
"priority_flag",
"=... | Generates the Terminal Output | [
"Generates",
"the",
"Terminal",
"Output"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L482-L489 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.reasoning_routine | def reasoning_routine(self, groups, check, priority_flag=3,
_top_level=True):
"""
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 boo... | python | def reasoning_routine(self, groups, check, priority_flag=3,
_top_level=True):
"""
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 boo... | [
"def",
"reasoning_routine",
"(",
"self",
",",
"groups",
",",
"check",
",",
"priority_flag",
"=",
"3",
",",
"_top_level",
"=",
"True",
")",
":",
"sort_fn",
"=",
"lambda",
"x",
":",
"x",
".",
"weight",
"groups_sorted",
"=",
"sorted",
"(",
"groups",
",",
... | 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 str... | [
"print",
"routine",
"performed"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L491-L565 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.process_doc | def process_doc(self, doc):
"""
Attempt to parse an xml string conforming to either an SOS or SensorML
dataset and return the results
"""
xml_doc = ET.fromstring(doc)
if xml_doc.tag == "{http://www.opengis.net/sos/1.0}Capabilities":
ds = SensorObservationServi... | python | def process_doc(self, doc):
"""
Attempt to parse an xml string conforming to either an SOS or SensorML
dataset and return the results
"""
xml_doc = ET.fromstring(doc)
if xml_doc.tag == "{http://www.opengis.net/sos/1.0}Capabilities":
ds = SensorObservationServi... | [
"def",
"process_doc",
"(",
"self",
",",
"doc",
")",
":",
"xml_doc",
"=",
"ET",
".",
"fromstring",
"(",
"doc",
")",
"if",
"xml_doc",
".",
"tag",
"==",
"\"{http://www.opengis.net/sos/1.0}Capabilities\"",
":",
"ds",
"=",
"SensorObservationService",
"(",
"None",
"... | Attempt to parse an xml string conforming to either an SOS or SensorML
dataset and return the results | [
"Attempt",
"to",
"parse",
"an",
"xml",
"string",
"conforming",
"to",
"either",
"an",
"SOS",
"or",
"SensorML",
"dataset",
"and",
"return",
"the",
"results"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L568-L584 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.generate_dataset | def generate_dataset(self, cdl_path):
'''
Use ncgen to generate a netCDF file from a .cdl file
Returns the path to the generated netcdf file
:param str cdl_path: Absolute path to cdl file that is used to generate netCDF file
'''
if '.cdl' in cdl_path: # it's possible th... | python | def generate_dataset(self, cdl_path):
'''
Use ncgen to generate a netCDF file from a .cdl file
Returns the path to the generated netcdf file
:param str cdl_path: Absolute path to cdl file that is used to generate netCDF file
'''
if '.cdl' in cdl_path: # it's possible th... | [
"def",
"generate_dataset",
"(",
"self",
",",
"cdl_path",
")",
":",
"if",
"'.cdl'",
"in",
"cdl_path",
":",
"ds_str",
"=",
"cdl_path",
".",
"replace",
"(",
"'.cdl'",
",",
"'.nc'",
")",
"else",
":",
"ds_str",
"=",
"cdl_path",
"+",
"'.nc'",
"subprocess",
"."... | Use ncgen to generate a netCDF file from a .cdl file
Returns the path to the generated netcdf file
:param str cdl_path: Absolute path to cdl file that is used to generate netCDF file | [
"Use",
"ncgen",
"to",
"generate",
"a",
"netCDF",
"file",
"from",
"a",
".",
"cdl",
"file",
"Returns",
"the",
"path",
"to",
"the",
"generated",
"netcdf",
"file"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L586-L598 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.load_dataset | def load_dataset(self, ds_str):
"""
Returns an instantiated instance of either a netCDF file or an SOS
mapped DS object.
:param str ds_str: URL of the resource to load
"""
# If it's a remote URL load it as a remote resource, otherwise treat it
# as a local resour... | python | def load_dataset(self, ds_str):
"""
Returns an instantiated instance of either a netCDF file or an SOS
mapped DS object.
:param str ds_str: URL of the resource to load
"""
# If it's a remote URL load it as a remote resource, otherwise treat it
# as a local resour... | [
"def",
"load_dataset",
"(",
"self",
",",
"ds_str",
")",
":",
"pr",
"=",
"urlparse",
"(",
"ds_str",
")",
"if",
"pr",
".",
"netloc",
":",
"return",
"self",
".",
"load_remote_dataset",
"(",
"ds_str",
")",
"return",
"self",
".",
"load_local_dataset",
"(",
"d... | Returns an instantiated instance of either a netCDF file or an SOS
mapped DS object.
:param str ds_str: URL of the resource to load | [
"Returns",
"an",
"instantiated",
"instance",
"of",
"either",
"a",
"netCDF",
"file",
"or",
"an",
"SOS",
"mapped",
"DS",
"object",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L600-L612 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.load_remote_dataset | def load_remote_dataset(self, ds_str):
'''
Returns a dataset instance for the remote resource, either OPeNDAP or SOS
:param str ds_str: URL to the remote resource
'''
if opendap.is_opendap(ds_str):
return Dataset(ds_str)
else:
# Check if the HTTP... | python | def load_remote_dataset(self, ds_str):
'''
Returns a dataset instance for the remote resource, either OPeNDAP or SOS
:param str ds_str: URL to the remote resource
'''
if opendap.is_opendap(ds_str):
return Dataset(ds_str)
else:
# Check if the HTTP... | [
"def",
"load_remote_dataset",
"(",
"self",
",",
"ds_str",
")",
":",
"if",
"opendap",
".",
"is_opendap",
"(",
"ds_str",
")",
":",
"return",
"Dataset",
"(",
"ds_str",
")",
"else",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"ds_str",
",",
"allow_red... | Returns a dataset instance for the remote resource, either OPeNDAP or SOS
:param str ds_str: URL to the remote resource | [
"Returns",
"a",
"dataset",
"instance",
"for",
"the",
"remote",
"resource",
"either",
"OPeNDAP",
"or",
"SOS"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L614-L630 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite.load_local_dataset | def load_local_dataset(self, ds_str):
'''
Returns a dataset instance for the local resource
:param ds_str: Path to the resource
'''
if cdl.is_cdl(ds_str):
ds_str = self.generate_dataset(ds_str)
if netcdf.is_netcdf(ds_str):
return MemoizedDataset(... | python | def load_local_dataset(self, ds_str):
'''
Returns a dataset instance for the local resource
:param ds_str: Path to the resource
'''
if cdl.is_cdl(ds_str):
ds_str = self.generate_dataset(ds_str)
if netcdf.is_netcdf(ds_str):
return MemoizedDataset(... | [
"def",
"load_local_dataset",
"(",
"self",
",",
"ds_str",
")",
":",
"if",
"cdl",
".",
"is_cdl",
"(",
"ds_str",
")",
":",
"ds_str",
"=",
"self",
".",
"generate_dataset",
"(",
"ds_str",
")",
"if",
"netcdf",
".",
"is_netcdf",
"(",
"ds_str",
")",
":",
"retu... | Returns a dataset instance for the local resource
:param ds_str: Path to the resource | [
"Returns",
"a",
"dataset",
"instance",
"for",
"the",
"local",
"resource"
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L632-L648 | train |
ioos/compliance-checker | compliance_checker/suite.py | CheckSuite._group_raw | def _group_raw(self, raw_scores, cur=None, level=1):
"""
Internal recursive method to group raw scores into a cascading score summary.
Only top level items are tallied for scores.
@param list raw_scores: list of raw scores (Result objects)
"""
# BEGIN INTERNAL FUNCS ####... | python | def _group_raw(self, raw_scores, cur=None, level=1):
"""
Internal recursive method to group raw scores into a cascading score summary.
Only top level items are tallied for scores.
@param list raw_scores: list of raw scores (Result objects)
"""
# BEGIN INTERNAL FUNCS ####... | [
"def",
"_group_raw",
"(",
"self",
",",
"raw_scores",
",",
"cur",
"=",
"None",
",",
"level",
"=",
"1",
")",
":",
"def",
"trim_groups",
"(",
"r",
")",
":",
"if",
"isinstance",
"(",
"r",
".",
"name",
",",
"tuple",
")",
"or",
"isinstance",
"(",
"r",
... | Internal recursive method to group raw scores into a cascading score summary.
Only top level items are tallied for scores.
@param list raw_scores: list of raw scores (Result objects) | [
"Internal",
"recursive",
"method",
"to",
"group",
"raw",
"scores",
"into",
"a",
"cascading",
"score",
"summary",
".",
"Only",
"top",
"level",
"items",
"are",
"tallied",
"for",
"scores",
"."
] | ee89c27b0daade58812489a2da3aa3b6859eafd9 | https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/suite.py#L658-L733 | train |
Preston-Landers/concurrent-log-handler | src/concurrent_log_handler/queue.py | get_all_logger_names | def get_all_logger_names(include_root=False):
"""Return ``list`` of names of all loggers than have been accessed.
Warning: this is sensitive to internal structures in the standard logging module.
"""
# noinspection PyUnresolvedReferences
rv = list(logging.Logger.manager.loggerDict.keys())
if in... | python | def get_all_logger_names(include_root=False):
"""Return ``list`` of names of all loggers than have been accessed.
Warning: this is sensitive to internal structures in the standard logging module.
"""
# noinspection PyUnresolvedReferences
rv = list(logging.Logger.manager.loggerDict.keys())
if in... | [
"def",
"get_all_logger_names",
"(",
"include_root",
"=",
"False",
")",
":",
"rv",
"=",
"list",
"(",
"logging",
".",
"Logger",
".",
"manager",
".",
"loggerDict",
".",
"keys",
"(",
")",
")",
"if",
"include_root",
":",
"rv",
".",
"insert",
"(",
"0",
",",
... | Return ``list`` of names of all loggers than have been accessed.
Warning: this is sensitive to internal structures in the standard logging module. | [
"Return",
"list",
"of",
"names",
"of",
"all",
"loggers",
"than",
"have",
"been",
"accessed",
"."
] | 8e0b8e28c2b12e854853d723b3c28346a3218914 | https://github.com/Preston-Landers/concurrent-log-handler/blob/8e0b8e28c2b12e854853d723b3c28346a3218914/src/concurrent_log_handler/queue.py#L83-L92 | train |
Preston-Landers/concurrent-log-handler | src/concurrent_log_handler/queue.py | queuify_logger | def queuify_logger(logger, queue_handler, queue_listener):
"""Replace logger's handlers with a queue handler while adding existing
handlers to a queue listener.
This is useful when you want to use a default logging config but then
optionally add a logger's handlers to a queue during runtime.
Args:... | python | def queuify_logger(logger, queue_handler, queue_listener):
"""Replace logger's handlers with a queue handler while adding existing
handlers to a queue listener.
This is useful when you want to use a default logging config but then
optionally add a logger's handlers to a queue during runtime.
Args:... | [
"def",
"queuify_logger",
"(",
"logger",
",",
"queue_handler",
",",
"queue_listener",
")",
":",
"if",
"isinstance",
"(",
"logger",
",",
"str",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"logger",
")",
"handlers",
"=",
"[",
"handler",
"for",
... | Replace logger's handlers with a queue handler while adding existing
handlers to a queue listener.
This is useful when you want to use a default logging config but then
optionally add a logger's handlers to a queue during runtime.
Args:
logger (mixed): Logger instance or string name of logger ... | [
"Replace",
"logger",
"s",
"handlers",
"with",
"a",
"queue",
"handler",
"while",
"adding",
"existing",
"handlers",
"to",
"a",
"queue",
"listener",
"."
] | 8e0b8e28c2b12e854853d723b3c28346a3218914 | https://github.com/Preston-Landers/concurrent-log-handler/blob/8e0b8e28c2b12e854853d723b3c28346a3218914/src/concurrent_log_handler/queue.py#L95-L123 | train |
Preston-Landers/concurrent-log-handler | src/concurrent_log_handler/__init__.py | ConcurrentRotatingFileHandler._alter_umask | def _alter_umask(self):
"""Temporarily alter umask to custom setting, if applicable"""
if self.umask is None:
yield # nothing to do
else:
prev_umask = os.umask(self.umask)
try:
yield
finally:
os.umask(prev_umask) | python | def _alter_umask(self):
"""Temporarily alter umask to custom setting, if applicable"""
if self.umask is None:
yield # nothing to do
else:
prev_umask = os.umask(self.umask)
try:
yield
finally:
os.umask(prev_umask) | [
"def",
"_alter_umask",
"(",
"self",
")",
":",
"if",
"self",
".",
"umask",
"is",
"None",
":",
"yield",
"else",
":",
"prev_umask",
"=",
"os",
".",
"umask",
"(",
"self",
".",
"umask",
")",
"try",
":",
"yield",
"finally",
":",
"os",
".",
"umask",
"(",
... | Temporarily alter umask to custom setting, if applicable | [
"Temporarily",
"alter",
"umask",
"to",
"custom",
"setting",
"if",
"applicable"
] | 8e0b8e28c2b12e854853d723b3c28346a3218914 | https://github.com/Preston-Landers/concurrent-log-handler/blob/8e0b8e28c2b12e854853d723b3c28346a3218914/src/concurrent_log_handler/__init__.py#L262-L271 | train |
panosl/django-currencies | currencies/management/commands/currencies.py | Command.get_imports | def get_imports(self, option):
"""
See if we have been passed a set of currencies or a setting variable
or look for settings CURRENCIES or SHOP_CURRENCIES.
"""
if option:
if len(option) == 1 and option[0].isupper() and len(option[0]) > 3:
return getatt... | python | def get_imports(self, option):
"""
See if we have been passed a set of currencies or a setting variable
or look for settings CURRENCIES or SHOP_CURRENCIES.
"""
if option:
if len(option) == 1 and option[0].isupper() and len(option[0]) > 3:
return getatt... | [
"def",
"get_imports",
"(",
"self",
",",
"option",
")",
":",
"if",
"option",
":",
"if",
"len",
"(",
"option",
")",
"==",
"1",
"and",
"option",
"[",
"0",
"]",
".",
"isupper",
"(",
")",
"and",
"len",
"(",
"option",
"[",
"0",
"]",
")",
">",
"3",
... | See if we have been passed a set of currencies or a setting variable
or look for settings CURRENCIES or SHOP_CURRENCIES. | [
"See",
"if",
"we",
"have",
"been",
"passed",
"a",
"set",
"of",
"currencies",
"or",
"a",
"setting",
"variable",
"or",
"look",
"for",
"settings",
"CURRENCIES",
"or",
"SHOP_CURRENCIES",
"."
] | 8d4c6c202ad7c4cc06263ab2c1b1f969bbe99acd | https://github.com/panosl/django-currencies/blob/8d4c6c202ad7c4cc06263ab2c1b1f969bbe99acd/currencies/management/commands/currencies.py#L47-L65 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.