Skip to main content

sos4py

https://img.shields.io/pypi/v/sos4py.svg

sos4py is a convenience layer for Python environment to access services, extract data, and allow querying from SOS instances.

  • Free software: Apache Software License 2.0

Features

  • Allows connection to an SOS service using OWSLib.

  • Explore and summarize service capabilities, sensor metadata, offerings, observed properties, available phenomena and features of interest.

  • Query requests to an SOS service for Get Data Availability.

  • Query requests to an SOS service for getting observation data.

  • Query requests to an SOS service for getting observation site data.

Usage

EXAMPLES OF THE PACKAGE CAN BE SEEN:: https://github.com/52North/sos4py/tree/master/examples

Connecting to an SOS service:
Description

Base class of a connection to a Sensor Observation Service. The result is class object SensorObservationService_2_0_0(object) of the OWSLib (<https://github.com/geopython/OWSLib/blob/master/owslib/swe/observation/sos200.py>)

Usage

def connection_sos(url, xml=None, username=None, password=None,):

Parameters

xmlstr

Xml file path.

usernamestr

Username to access the SOS service.

passwordstr

User password to access the SOS service.

Example

from sos4py.main import connection_sos

service = sos4py('http://sensorweb.demo.52north.org/52n-sos-webapp/sos/kvp')

Get capabilities functions (summaries):
Description

Construction class sos_2_0_0. Implements the the return of the function connection_sos() as input. The methods of the class can be used for metadata retrieval of sensors, and observation data queries.

Usage

class sos_2_0_0(self, url, version, xml=None, username=None, password=None):

Methods

sosServiceIdentification() The identification section of a SOS v2.0 capabilities document. This function queries the identification metadata available and returns the data as a pandas Series dataframe.

sosProvider() The provider section of an SOS v2.0 capabilities document. This function queries the provider metadata available and returns the data as a pandas Series dataframe.

sosOperationsMetadata() Elements in an OperationsMetadata object.This function queries the operations available of a SOS v2.0 capabilities document and returns the data as a pandas Series dataframe.

sosOfferings() Explore offerings section of an SOS v2.0 capabilities document. This function queries the offerings and returns the data as a pandas Series dataframe.

sosPhenomena() Queries a SOS v2.0 for all its phenomena. Returns a list of the phenomena ids.

sosFeaturesOfInterest() Queries a SOS v2.0 for all its features of interest. Returns a list of the feature of interest ids.

Examples

from sos4py.main import connection_sos

service = connection_sos('http://sensorweb.demo.52north.org/52n-sos-webapp/sos/kvp')

service.sosServiceIdentification()

service.sosProvider()

service.sosOperationsMetadata()

service.sosOfferings()

service.phenomena()

Get Data Availability function:
Description

Base class of a connection to a Sensor Observation Service. The result is class object SensorObservationService_2_0_0(object) of the OWSLib (<https://github.com/geopython/OWSLib/blob/master/owslib/swe/observation/sos200.py>)

Usage

def get_data_availability(object, procedures=None, observedProperties=None, featuresOfInterest=None, offerings=None, method=None, **kwargs)

Parameters

objectstr

Xml file path.

procedureslist of str

Query the data based on the availability of the indicated procedures.

observedProperties: list of str

Query the data based on the availability of the indicated observed properties.

featuresOfInterestlist of str

Query the data based on the availability of the indicated features of interest.

offeringslist of str

Query the data based on the availability of the indicated offerings.

methodstr

‘Get’ or ‘Post’ request parameter.

Examples

service.get_data_availability()

service.get_data_availability(procedures=['http://www.52north.org/test/procedure/6'], featuresOfInterest=['http://www.52north.org/test/featureOfInterest/6'])

Get sites function:
Description

Method to retrieve sites from an SOS. The result is a GeoDataFrame.

Usage

def get_sites(self, include_phenomena=False)

Parameters

include_phenomenaboolean, optional

Whether or not flags for the existance of phenomenona (e.g. water temperature) should be included (default is False)

Examples

service.get_sites()

service.get_sites(include_phenomena = True)

Get data function:
Description

Method to get observation data from an SOS. The result is a DataFrame.

Usage

def get_data(self, sites=None, phenomena=None, procedures=None, begin=None, end=None)

Parameters

sitesnon-empty list of str, optional

observation sites/sensor locations

phenomenanon-empty list of str, optional

phenomena, e.g. water temperature

proceduresnon-empty list of str, optional

measurement procedures of the observation, e.g. measurements in 2 m water depth

beginstr, optional if end is not provided

begin of time period in the form ‘YYYY-MM-DDThh:mm:ssZ’, e.g. ‘2020-01-01T10:00:00Z’

endstr, optional if begin is not provided

end of time period in the form ‘YYYY-MM-DDThh:mm:ssZ’, e.g. ‘2020-01-02T10:00:00Z’

It is recommended to provide at least one of sites, phenomena or procedures. Otherwise the request may take very long.

Examples

service.get_data()

service.get_data(sites=['Sensor location 1'],phenomena=['water temperature','salinity'])

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2020-05-09)

  • First release on PyPI.

0.2.0 (2020-08-20)

  • Add method get_feature_of_interest()

  • Add example for accessing and plotting sensor data

0.3.0 (2020-08-30)

  • Add method get_data()

  • Add method get_sites()

  • Add method sosFeaturesOfInterest()

  • Update example notebook for accessing and plotting sensor data

Metadata

Release files for sos4py 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sos4py 0.3.0
File Size Uploaded Provenance
sos4py-0.3.0.tar.gz 20.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sos4py 0.3.0
File Interpreter ABI Platform
sos4py-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 34.9 kB

Release files / sos4py-0.3.0.tar.gz

Download URL sos4py-0.3.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7214c2f955934f3cdfb7727d316c7267df7ebb16d1522639665340742afdde5f
BLAKE2b-256 checksum
How to use checksums
e6d3fbcb9227e5f5045f992eb101b01b944e29566ff2afd23f8aff905abd4451
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Release files / sos4py-0.3.0-py2.py3-none-any.whl

Download URL sos4py-0.3.0-py2.py3-none-any.whl
Size 14.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
738fa6b9c0c045320705e6bdbb44499274ec7e990aece9f4287ae7a94ed212e8
BLAKE2b-256 checksum
How to use checksums
ed9a5a48702c30bfe25c4814be5cdf416d6f3bec17f41aa5af1905ceb05affa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Security for sos4py 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page