Code Monkey home page Code Monkey logo

pycampbellcr1000's Introduction

PyCampbellCR1000 : Query the Campbell CR1000-type Dataloggers

PyCampbellCR1000 is a python project which aims to allow the communication with Campbell CR1000 Type Datalogger

The main features include automatic collecting of data and settings (read only) as a list of dictionnaries.

The tool can be used in your python scripts for data post-processing, or in command line mode to collect data as CSV.

We don't update anything from PyCampbellCR1000 besides time, because we are assuming that the dataloggers are already configured.

Note: PyCampbellCR1000 uses the PyLink lib, offers a universal communication interface with File-Like API.

Examples

We init communication by giving the datalogger URL.

>>> from pycampbellcr1000 import CR1000
>>> device = CR1000.from_url('tcp:host-ip:port')
>>> # or with Serial connection
>>> device = CR1000.from_url('serial:/dev/ttyUSB0:38400')

To get time, use:

>>> device.gettime()
datetime.datetime(2012, 7, 16, 12, 27, 55)

To get data, you have to enter the table name where it is stored. If you don't know the table name, you cannot collect the list of available tables in the datalogger.

>>> device.list_tables()
['Status', 'Table1', 'Public']

Choose the time period to get your data from start date to stop date.

>>> import datetime
>>> start = datetime.datetime(2012, 7, 16, 11, 0, 0)
>>> stop = datetime.datetime(2012, 7, 16, 12, 0, 0)
>>> data = device.get_data('Table1', start, stop)
>>> data[0]["Datetime"]
datetime.datetime(2012, 7, 16, 11, 0)
>>> data[0]["CurSensor1_mVolt_Avg"]
2508.0
>>> print(data.filter(('Datetime', 'CurSensor3_mAmp_Avg')).to_csv())
Datetime,CurSensor3_mAmp_Avg
2012-07-16 11:00:00,18.7
2012-07-16 11:01:00,18.48
...
2012-07-16 11:59:00,17.25

Features

  • Collecting data as a list of dictionaries
  • Collecting data in a CSV file
  • Reading and adjusting the data logger's internal clock
  • Retrieving table definitions
  • Listing table names
  • Reading settings
  • Collect file list and download file content
  • Tested with CR1000 and CR800 dataloggers (should work with CR3000 datalogger)
  • Various types of connections are supported (TCP, UDP, Serial, GSM)
  • Comes with a command-line script
  • Compatible with Python 2.6+ and 3.x

Installation

You can install, upgrade, uninstall PyCampbellCR1000 with these commands

$ pip install pycampbellcr1000
$ pip install --upgrade pycampbellcr1000
$ pip uninstall pycampbellcr1000

Or if you don't have pip

$ easy_install pycampbellcr1000

Or you can get the source code from github.

$ git clone https://github.com/LionelDarras/PyCampbellCR1000.git
$ cd PyCampbellCR1000
$ python setup.py install

Documentation

See documentation here: http://pycampbellcr1000.readthedocs.org

pycampbellcr1000's People

Contributors

bender270 avatar hyperglitch avatar lioneldarras avatar salemharrache avatar

Watchers

 avatar

Forkers

syukisihor

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.