Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/default-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- name: Setup Micromamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
with:
micromamba-version: '2.6.0-0'
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest 2.6.1 is broken on Windows. We should unpin when a new release is out.

environment-name: TEST
init-shell: bash
create-args: >-
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
rev: v0.15.13
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -50,7 +50,7 @@ repos:
)$

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.24.1
rev: v1.25.2
hooks:
- id: zizmor

Expand Down
32 changes: 0 additions & 32 deletions compliance_checker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,12 @@
import validators
from lxml import etree
from netCDF4 import Dataset
from owslib.namespaces import Namespaces
from owslib.swe.observation.sos100 import SensorObservationService_1_0_0
from owslib.swe.sensor.sml import SensorML
from typing_extensions import deprecated

from compliance_checker import __version__
from compliance_checker.util import kvp_convert


def get_namespaces():
n = Namespaces()
ns = n.get_namespaces(["ogc", "sml", "gml", "sos", "swe", "xlink"])
ns["ows"] = n.get_namespace("ows110")
return ns


def csv_splitter(input_string):
"""
csv_splitter(input_string)
Expand Down Expand Up @@ -207,28 +197,6 @@ def std_check(cls, dataset, name):
return name in dataset.ncattrs()


@deprecated(
"The ioos_sos checker is deprecated and will be removed in the next compliance-checker version.",
)
class BaseSOSGCCheck:
"""
Base class for SOS-GetCapabilities supporting Check Suites.
"""

supported_ds = [SensorObservationService_1_0_0]


@deprecated(
"The ioos_sos checker is deprecated and will be removed in the next compliance-checker version.",
)
class BaseSOSDSCheck:
"""
Base class for SOS-DescribeSensor supporting Check Suites.
"""

supported_ds = [SensorML]


class Result:
"""
Holds the result of a check method.
Expand Down
268 changes: 0 additions & 268 deletions compliance_checker/ioos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
from numbers import Number

import validators
from lxml.etree import XPath
from owslib.namespaces import Namespaces
from typing_extensions import deprecated

import compliance_checker.cf.util as cfutil
from compliance_checker import base
from compliance_checker.acdd import ACDD1_3Check
from compliance_checker.base import (
BaseCheck,
BaseNCCheck,
BaseSOSDSCheck,
BaseSOSGCCheck,
Result,
TestCtx,
check_has,
Expand Down Expand Up @@ -1725,266 +1720,3 @@ def check_instrument_make_model_calib_date(self, ds):
)

return results


@deprecated(
"The ioos_sos checker is deprecated and will be removed in the next compliance-checker version.",
)
class IOOSBaseSOSCheck(BaseCheck):
_cc_spec = "ioos_sos"
_cc_spec_version = "0.1"
_cc_description = "IOOS Inventory Metadata checks for the Sensor Observation System (SOS). Checks SOS functions GetCapabilities and DescribeSensor."
register_checker = True
# requires login
_cc_url = "http://sdf.ndbc.noaa.gov/sos/"


@deprecated(
"The ioos_sos checker is deprecated and will be removed in the next compliance-checker version.",
)
class IOOSSOSGCCheck(BaseSOSGCCheck, IOOSBaseSOSCheck):
# set up namespaces for XPath
ns = Namespaces().get_namespaces(["sos", "gml", "xlink"])
ns["ows"] = Namespaces().get_namespace("ows110")

@check_has(BaseCheck.HIGH)
def check_high(self, ds):
return []

@check_has(BaseCheck.MEDIUM)
def check_recommended(self, ds):
return [
(
"service_contact_email",
XPath(
"/sos:Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:ElectronicMailAddress",
namespaces=self.ns,
),
),
(
"service_contact_name",
XPath(
"/sos:Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:IndividualName",
namespaces=self.ns,
),
),
(
"service_provider_name",
XPath(
"/sos:Capabilities/ows:ServiceProvider/ows:ProviderName",
namespaces=self.ns,
),
),
(
"service_title",
XPath(
"/sos:Capabilities/ows:ServiceProvider/ows:ProviderName",
namespaces=self.ns,
),
),
(
"service_type_name",
XPath(
"/sos:Capabilities/ows:ServiceIdentification/ows:ServiceType",
namespaces=self.ns,
),
),
(
"service_type_version",
XPath(
"/sos:Capabilities/ows:ServiceIdentification/ows:ServiceTypeVersion",
namespaces=self.ns,
),
),
# ds.identification[0].observed_properties has this as well, but
# don't want to try to shoehorn a function here
# ('variable_names', len(ds.identification[0].observed_properties) > 0)
(
"variable_names",
XPath(
"/sos:Capabilities/sos:Contents/sos:ObservationOfferingList/sos:ObservationOffering/sos:observedProperty",
namespaces=self.ns,
),
),
(
"data_format_template_version",
XPath(
"/sos:Capabilities/ows:OperationsMetadata/ows:ExtendedCapabilities/gml:metaDataProperty[@xlink:title='ioosTemplateVersion']/gml:version",
namespaces=self.ns,
),
),
]

@check_has(BaseCheck.LOW)
def check_suggested(self, ds):
return ["altitude_units"]


@deprecated(
"The ioos_sos checker is deprecated and will be removed in the next compliance-checker version.",
)
class IOOSSOSDSCheck(BaseSOSDSCheck, IOOSBaseSOSCheck):
# set up namespaces for XPath
ns = Namespaces().get_namespaces(["sml", "swe", "gml", "xlink"])

@check_has(BaseCheck.HIGH)
def check_high(self, ds):
return [
(
"platform_sponsor",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:classification/sml:ClassifierList/sml:classifier[@name='sponsor']/sml:Term/sml:value",
namespaces=self.ns,
),
),
(
"platform_type",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:classification/sml:ClassifierList/sml:classifier[@name='platformType']/sml:Term/sml:value",
namespaces=self.ns,
),
),
(
"station_publisher_name",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/publisher']/sml:ResponsibleParty/sml:organizationName",
namespaces=self.ns,
),
),
(
"station_publisher_email",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/publisher']/sml:ResponsibleParty/sml:contactInfo/address/sml:electronicMailAddress",
namespaces=self.ns,
),
),
(
"station_id",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier[@name='stationID']/sml:Term/sml:value",
namespaces=self.ns,
),
),
(
"station_long_name",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier[@name='longName']/sml:Term/sml:value",
namespaces=self.ns,
),
),
(
"station_short_name",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier[@name='shortName']/sml:Term/sml:value",
namespaces=self.ns,
),
),
(
"station_wmo_id",
XPath(
'/sml:SensorML/sml:member/sml:System/sml:identification/sml:IdentifierList/sml:identifier/sml:Term[@definition="http://mmisw.org/ont/ioos/definition/wmoID"]/sml:value',
namespaces=self.ns,
),
),
(
"time_period",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:capabilities[@name='observationTimeRange']/swe:DataRecord/swe:field[@name='observationTimeRange']/swe:TimeRange/swe:value",
namespaces=self.ns,
),
),
(
"operator_email",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/operator']/sml:ResponsibleParty/sml:contactInfo/address/sml:electronicMailAddress",
namespaces=self.ns,
),
),
(
"operator_name",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:contact/sml:ContactList/sml:member[@xlink:role='http://mmisw.org/ont/ioos/definition/operator']/sml:ResponsibleParty/sml:organizationName",
namespaces=self.ns,
),
),
(
"station_description",
XPath(
"/sml:SensorML/sml:member/sml:System/gml:description",
namespaces=self.ns,
),
),
# replaced with lon/lat with point
(
"station_location_point",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:location/gml:Point/gml:pos",
namespaces=self.ns,
),
),
]

@check_has(BaseCheck.MEDIUM)
def check_recommended(self, ds):
return [
(
"sensor_descriptions",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/gml:description",
namespaces=self.ns,
),
),
(
"sensor_ids",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/@gml:id",
namespaces=self.ns,
),
),
(
"sensor_names",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/@name",
namespaces=self.ns,
),
),
(
"data_format_template_version",
XPath(
"/sml:SensorML/sml:capabilities/swe:SimpleDataRecord/swe:field[@name='ioosTemplateVersion']/swe:Text/swe:value",
namespaces=self.ns,
),
),
(
"variable_names",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/sml:outputs/sml:OutputList/sml:output/swe:Quantity/@definition",
namespaces=self.ns,
),
),
(
"variable_units",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:components/sml:ComponentList/sml:component/sml:System/sml:outputs/sml:OutputList/sml:output/swe:Quantity/swe:uom/@code",
namespaces=self.ns,
),
),
(
"network_id",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:capabilities[@name='networkProcedures']/swe:SimpleDataRecord/gml:metaDataProperty/@xlink:href",
namespaces=self.ns,
),
),
(
"operator_sector",
XPath(
"/sml:SensorML/sml:member/sml:System/sml:classification/sml:ClassifierList/sml:classifier[@name='operatorSector']/sml:Term/sml:value",
namespaces=self.ns,
),
),
]

@check_has(BaseCheck.LOW)
def check_suggested(self, ds):
return []
Loading
Loading