Skip to content

Commit

Permalink
Merge pull request #927 from benjwadams/pre_commit_fixup
Browse files Browse the repository at this point in the history
Pre commit fixup/code cleanup
  • Loading branch information
benjwadams authored May 20, 2022
2 parents 0e7f4df + 065cfec commit b4e8d8c
Show file tree
Hide file tree
Showing 25 changed files with 564 additions and 882 deletions.
10 changes: 5 additions & 5 deletions compliance_checker/acdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def check_metadata_link(self, ds):
:param netCDF4.Dataset ds: An open netCDF dataset
"""
if not hasattr(ds, u"metadata_link"):
if not hasattr(ds, "metadata_link"):
return
msgs = []
meta_link = getattr(ds, "metadata_link")
Expand All @@ -784,14 +784,14 @@ def check_id_has_no_blanks(self, ds):
:param netCDF4.Dataset ds: An open netCDF dataset
"""
if not hasattr(ds, u"id"):
if not hasattr(ds, "id"):
return
if " " in getattr(ds, u"id"):
if " " in getattr(ds, "id"):
return Result(
BaseCheck.MEDIUM,
False,
"no_blanks_in_id",
msgs=[u"There should be no blanks in the id field"],
msgs=["There should be no blanks in the id field"],
)
else:
return Result(BaseCheck.MEDIUM, True, "no_blanks_in_id", msgs=[])
Expand Down Expand Up @@ -829,7 +829,7 @@ def check_var_coverage_content_type(self, ds):
}
if ctype not in valid_ctypes:
msgs.append(
'coverage_content_type in "%s"' % (variable, sorted(valid_ctypes))
'coverage_content_type "%s" not in %s' % (variable, sorted(valid_ctypes))
)
results.append(
Result(
Expand Down
2 changes: 0 additions & 2 deletions compliance_checker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import itertools
import pprint
import re
import sys
import warnings

from collections import defaultdict
Expand Down Expand Up @@ -159,7 +158,6 @@ def setup(self, ds):
Automatically run when running a CheckSuite. Define this method in your Checker class.
"""
pass

def __init__(self, options=None):
self._defined_results = defaultdict(lambda: defaultdict(dict))
Expand Down
3 changes: 2 additions & 1 deletion compliance_checker/cf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
dimless_vertical_coordinates_1_6,
dimless_vertical_coordinates_1_7,
)
from compliance_checker.cf.cf import CF1_6Check, CF1_7Check, util
from compliance_checker.cf.cf import CF1_6Check, CF1_7Check
from compliance_checker.cf import util


__all__ = [
Expand Down
10 changes: 6 additions & 4 deletions compliance_checker/cf/appendix_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# the same units as the standard name canonical units, "1" is unitless for
# observation counts, and None is used for status_flag, which expects units
# not to be present
valid_modifiers = {"detection_minimum": "u",
"number_of_observations": "1",
"standard_error": "u",
"status_flag": None}
valid_modifiers = {
"detection_minimum": "u",
"number_of_observations": "1",
"standard_error": "u",
"status_flag": None,
}
33 changes: 19 additions & 14 deletions compliance_checker/cf/appendix_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,26 @@
# vertical coordinates only have one computed_standard_name, but some have
# multiple acceptable values.
ocean_computed_standard_names = {
"altitude": {"zlev": "altitude",
"eta": "sea_surface_height_above_geoid",
"depth": "sea_floor_depth_below_geoid"},
"height_above_geopotential_datum":
{"zlev": "height_above_geopotential_datum",
"altitude": {
"zlev": "altitude",
"eta": "sea_surface_height_above_geoid",
"depth": "sea_floor_depth_below_geoid",
},
"height_above_geopotential_datum": {
"zlev": "height_above_geopotential_datum",
"eta": "sea_surface_height_above_geopotential_datum",
"depth": "sea_floor_depth_below_geopotential_datum"},
"height_above_reference_ellipsoid":
{"zlev": "height_above_reference_ellipsoid",
"eta": "sea_surface_height_above_reference_ellipsoid",
"depth": "sea_floor_depth_below_reference_ellipsoid"},
"height_above_mean_sea_level":
{"zlev": "height_above_mean_sea_level",
"eta": "sea_surface_height_above_mean_sea_level",
"depth": "sea_floor_depth_below_mean_sea_level"}
"depth": "sea_floor_depth_below_geopotential_datum",
},
"height_above_reference_ellipsoid": {
"zlev": "height_above_reference_ellipsoid",
"eta": "sea_surface_height_above_reference_ellipsoid",
"depth": "sea_floor_depth_below_reference_ellipsoid",
},
"height_above_mean_sea_level": {
"zlev": "height_above_mean_sea_level",
"eta": "sea_surface_height_above_mean_sea_level",
"depth": "sea_floor_depth_below_mean_sea_level",
},
}

dimless_vertical_coordinates_1_6 = { # only for CF-1.6
Expand Down
33 changes: 10 additions & 23 deletions compliance_checker/cf/cf.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
import sqlite3
import sys

from collections import OrderedDict, defaultdict
from functools import wraps
from warnings import warn

import numpy as np
import pyproj
import regex

from cf_units import Unit

from compliance_checker import cfutil
from compliance_checker.base import BaseCheck, BaseNCCheck, Result, TestCtx
from compliance_checker.cf import util
from compliance_checker.cf.appendix_d import (
from compliance_checker import cfutil # noqa: F401
from compliance_checker.base import BaseCheck, BaseNCCheck, Result, TestCtx # noqa: F401
from compliance_checker.cf import util # noqa: F401
from compliance_checker.cf.appendix_d import ( # noqa: F401
dimless_vertical_coordinates_1_6,
dimless_vertical_coordinates_1_7,
no_missing_terms,
)
from compliance_checker.cf.appendix_e import cell_methods16, cell_methods17
from compliance_checker.cf.appendix_f import (

from compliance_checker.cf.appendix_e import cell_methods16, cell_methods17 # noqa: F401
from compliance_checker.cf.appendix_f import ( # noqa: F401
ellipsoid_names17,
grid_mapping_attr_types16,
grid_mapping_attr_types17,
Expand All @@ -35,6 +22,6 @@
)

# Version specific checkers organized in other modules
from compliance_checker.cf.cf_1_6 import CF1_6Check
from compliance_checker.cf.cf_1_7 import CF1_7Check
from compliance_checker.cf.cf_1_8 import CF1_8Check
from compliance_checker.cf.cf_1_6 import CF1_6Check # noqa: F401
from compliance_checker.cf.cf_1_7 import CF1_7Check # noqa: F401
from compliance_checker.cf.cf_1_8 import CF1_8Check # noqa: F401
Loading

0 comments on commit b4e8d8c

Please sign in to comment.