Coder Social home page Coder Social logo

gisce / primestg Goto Github PK

View Code? Open in Web Editor NEW
2.0 21.0 0.0 563 KB

Python library of Prime STG-DC Interface Specification

Home Page: http://primestg.readthedocs.org

License: GNU Affero General Public License v3.0

Python 100.00%
prime stg webservices soap metering hacktoberfest

primestg's Introduction

PrimeSTG

Build status

Build status

Python library of Prime STG-DC Interface Specification

Read the documentation at http://primestg.readthedocs.org

How it works

from primestg.report import Report

# xml is a basestring with a filename or a file object with the report
report = Report(xml)

# get all values of the report
values = report.values

# get the values of first concentrator
values = report.concentrators[1].values

# get the values of second meter of the first concentrator
values = report.concentrators[1].meters[2].values

# get the first value set of second meter of the first concentrator
values = report.concentrators[1].meters[2].measures[1].values

# get the parameters of the first concentrator from report S12
values = report.concentrators[1].parameters[1].values

Warnings property

All reports supported by the library have a warnings property that informs of problems found while parsing the contents of it. Depending on the type of report the warnings will be structured one way or another.

Meter information report:

The best way to get the warnings for these reports would be asking for the warnings of every meter in it.

for meter in cnc.meters:                        
    if meter.warnings:
        warnings.append(meter.warnings)

These will give us a list of dictionaries where each of them will have the serial name of the meter as a key and a list of strings with every exception found while reading as a value.

Concentrator information report:

To obtain the warnings from a concentrator report we will use the warnings property from the concentrator object directly.

for cnc in self.report[key].concentrators:
    if cnc.warnings:
        warnings.append(cnc.warnings)

This give us a list of strings where each one is the message of an exception found while reading.

primestg's People

Contributors

amatmv avatar davidmunoznovoa avatar ecarreras avatar fcapallera avatar gdalmau avatar giscegit avatar iiglesias-gisce avatar ilyassjaatit avatar markusrc11 avatar opachou avatar paupese avatar polsala avatar rogerav98 avatar scgallego avatar sim6 avatar theklanc avatar tinogis avatar xavitoro15 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

primestg's Issues

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.