Giter VIP home page Giter VIP logo

osisoftpy's Introduction

osisoftpy

A python library for OSIsoft's PI Web API

Circle CI code test status Travis CI code test status AppVeyor CI code test status Code Climate rating Codecov Coverage Report Documentation status

This library provides pythonic access to OSIsoft's PI System.

Usage

import arrow       # Arrow is optional - it's included to simplify the timestamps.
import osisoftpy


webapi = osisoftpy.webapi('https://localhost/piwebapi', authtype='kerberos')

# <OSIsoft PI Web API [https://localhost/piwebapi]>

points = webapi.points(query='name:CD* or name:SINU*', count=100)

# <osisoftpy.points.Points at 0x108a26850>

points.current()

for point in points:

    print('The current value for {} is {}, recorded {}'.format(
        point.name,
        point.current_value.value,
        arrow.get(point.current_value.timestamp).humanize()))

# The current value for CDEP158 is 267, recorded 2017-05-12T01:46:23Z
# The current value for CDM158 is {u'IsSystem': False, u'Name': u'Cascade', u'Value': 2}, recorded 2017-05-12T01:51:53Z
# The current value for CDT158 is 65.66323, recorded 2017-05-12T01:50:53Z
# The current value for SINUSOID is 28.9156246, recorded 2017-05-12T01:49:53Z
# The current value for SINUSOIDU is 91.05328, recorded 2017-05-12T01:50:23Z

for point in points:

    values = point.interpolated(starttime='*-14d', endtime='*', interval='1m')

    print('{} interpolated values for {} were retrieved; '
        'the data ranges from {} to {}.'.format(
        values.__len__(),
        point.name,
        arrow.get(values[0].timestamp).humanize(),
        arrow.get(values[-1].timestamp).humanize()))


# 20161 interpolated values for CDEP158 were retrieved. The data spans from 2017-04-28T02:00:30.8133676Z to 2017-05-12T02:00:30.8133676Z
# 20161 interpolated values for CDM158 were retrieved. The data spans from 2017-04-28T02:00:31.6571736Z to 2017-05-12T02:00:31.6571736Z
# 20161 interpolated values for CDT158 were retrieved. The data spans from 2017-04-28T02:00:32.8447522Z to 2017-05-12T02:00:32.8447522Z
# 20161 interpolated values for SINUSOID were retrieved. The data spans from 2017-04-28T02:00:33.7666888Z to 2017-05-12T02:00:33.7666888Z
# 20161 interpolated values for SINUSOIDU were retrieved. The data spans from 2017-04-28T02:00:34.6417451Z to 2017-05-12T02:00:34.6417451Z

Installation

To install osisoftpy, simply:

$ pip install osisoftpy

Documentation

Documentation is available at http://osisoftpy.readthedocs.io/.

Author

osisoftpy's People

Contributors

andrewpong avatar edkng avatar jveezy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.