cs.splink


Namecs.splink JSON
Version 20240316 PyPI version JSON
download
home_page
SummaryAssorted utility functions for working with data downloaded from Selectronics' SP-LINK programme which communicates with their solar inverter controllers.
upload_time2024-03-16 06:55:12
maintainer
docs_urlNone
author
requires_python
licenseGNU General Public License v3 or later (GPLv3+)
keywords python3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Assorted utility functions for working with data
downloaded from Selectronics' SP-LINK programme
which communicates with their solar inverter controllers.

*Latest release 20240316*:
Fixed release upload artifacts.

I use this to gather and plot data from my solar inverter.

## Function `main(argv=None)`

SP-Link command line mode.

## Class `SPLinkCommand(cs.timeseries.TimeSeriesBaseCommand, cs.cmdutils.BaseCommand)`

Command line to work with SP-Link data downloads.

Command line usage:

    Usage: splink [-d spdpath] [-n] subcommand...
        -d spdpath  Specify the directory containing the SP-Link downloads
                    and time series. Default from $SPLINK_DATADIR,
                    or '.'.
        -n          No action; recite planned actions.
      Subcommands:
        export dataset
          Export the named dataset in the original CSV form.
          Available datasets: DailySummaryData DetailedData
        fetch [-F rsync-source] [-nx] [-- [rsync-options...]]
          Rsync everything from rsync-source into the downloads area.
          -F    Fetch rsync source, default from $SPLINK_FETCH_SOURCE.
          -n    Passed to rsync. Just more convenient than putting it at the end.
          -x    Delete source files.
        help [-l] [subcommand-names...]
          Print help for subcommands.
          This outputs the full help for the named subcommands,
          or the short help for all subcommands if no names are specified.
          -l  Long help even if no subcommand-names provided.
        import [-d dataset,...] [-n] [sp-link-download...]
          Import CSV data from the downloads area into the time series data.
          -d datasets       Comma separated list of datasets to import.
                            Default datasets: DailySummaryData DetailedData EventData
          -f                Force. Import datasets even if already marked as
                            imported.
          -n                No action. Recite planned imports.
          sp-link-download  Specify specific individual downloads to import.
                            The default is any download not tagged as already
                            imported.
        info
          Report information about the time series stored at tspath.
        plot [-e event,...] [-f] [-o imagepath] [--show] [start-time [stop-time] {mode|[dataset:]{glob|field}}...]
          Plot the data from specified fields for the specified time range.
          If there is no start-time a time of 5 (the preceeding 5 days) is assumed.
          If there are no data specs a mode of POWER is assumed.
          Options:
            --bare          Strip axes and padding from the plot.
            -e events,...   Display the specified events.
            -f              Force. Overwirte the image path even if it exists.
            -o imagepath    Write the plot to imagepath.
                            If not specified, the image will be written
                            to the standard output in sixel format if
                            it is a terminal, and in PNG format otherwise.
            --stacked       Stack graphed values on top of each other.
            --show          Open the image path with "open".
            --tz tzspec     Skew the UTC times presented on the graph
                            to emulate the timezone specified by tzspec.
                            The default skew is the system local timezone.
            -U, --update    Run a "pull" before plotting.
            start-time      An integer number of days before the current time
                            or any datetime specification recognised by
                            dateutil.parser.parse.
            stop-time       Optional stop time, default now.
                            An integer number of days before the current time
                            or any datetime specification recognised by
                            dateutil.parser.parse.
            mode            A named graph mode, implying a group of fields.
                            Providing '?' or 'help' prints the available
                            datasets and field names.
        pull [-d dataset,...] [-F rsync-source] [-nx]
          Fetch and import data.
          -d dataset,...
                Specify the datasets to import.
          -F    Fetch rsync source, default from $SPLINK_FETCH_SOURCE.
          -n    No action; pass -n to rsync. Just more convenient than putting it at the end.
          -x    Delete source files.
        shell
          Run a command prompt via cmd.Cmd using this command's subcommands.

## Class `SPLinkCSVDir(cs.fs.HasFSPath)`

A class for working with SP-Link data downloads,
referring to a particular `PerformanceData*` download directory.

## Class `SPLinkData(cs.fs.HasFSPath, cs.resources.MultiOpenMixin, cs.context.ContextManagerMixin)`

A directory containing SP-LInk data.

This contains:
- `downloads`: a directory containing copies of various SP-Link
  downloads i.e. this contains directories named `PerformanceData_*`.
- `events.db`: accrued event data from the `EventData` CSV files
- `DailySummaryData`: an `SPLinkDataDir` containing accrued
  data from the `DailySummaryData` CSV files
- `DetailedData`: an `SPLinkDataDir` containing accrued data
  from the `DetailedData` CSV files

## Class `SPLinkDataDir(cs.timeseries.TimeSeriesDataDir, cs.timeseries.TimeSeriesMapping, builtins.dict, cs.resources.MultiOpenMixin, cs.context.ContextManagerMixin, cs.fs.HasFSPath, cs.configutils.HasConfigIni, cs.timeseries.HasEpochMixin, cs.timeseries.TimeStepsMixin)`

A `TimeSeriesDataDir` to hold log data from an SP-Link CSV data download.
This holds the data from a particular CSV log such as `'DetailedData'`.
The `SPLinkData` class manages a couple of these and a downloads
subdirectory and an events `SQLTags`.

*Method `SPLinkDataDir.__init__(self, dirpath, dataset: str, step: int, policy=None, **kw)`*:
Initialise the `SPLinkDataDir`.

Parameters:
* `dirpath`: the pathname of the directory holding the downloaded CSV files
* `dataset`: which CSV file populates this time series, eg `'DetailedData'`
* `step`: optional time series step size,
  default `SPLinkDataDir.DEFAULT_LOG_FREQUENCY`,
  which comes from `SPLinkCSVDir.DEFAULT_LOG_FREQUENCY`
* `policy`: optional TimespanPolicy` instance;
  if omitted an `TimespanPolicyYearly` instance will be made
Other keyword arguments are passed to the `TimeSeriesDataDir`
initialiser.

## Class `SPLinkDataFileInfo(builtins.tuple)`

SPLinkDataFileInfo(fspath, sitename, dataset, unixtime, dotext)

*Method `SPLinkDataFileInfo.__new__(_cls, fspath, sitename, dataset, unixtime, dotext)`*:
Create new instance of SPLinkDataFileInfo(fspath, sitename, dataset, unixtime, dotext)

## Function `ts2001_unixtime(tzname=None)`

Return the SP-Link 2001-01-01-local-time epoch as a UNIX time.

# Release Log



*Release 20240316*:
Fixed release upload artifacts.

*Release 20240201*:
* Release with the "splink" script.
* splink plot: new -U/--update option to run a "pull" before plotting.

*Release 20230612*:
* SPLinkCommand: new print_known_datasets method, use in help.
* SPLinkCommand.cmd_plot: if the start/stop times are out of order, swap them.
* Assorted internal changes.

*Release 20230217*:
SPLinkCommand.cmd_plot: make the start-time optional, default to 5.

*Release 20220918*:
* SPLinkData.plot: rename `key_specs` keyword parameter to mandatory posiitional `data_specs` parameter.
* SPLinkData.resolve: accept multiple specification strings.
* New SPLinkData.plot_data_from_spec(start,stop,data_spec,...) method to return a list of PlotSeries instances.
* SPLinkData.plot: drop mode param (unused).
* SPLinkData.plot: process plot data and annotate with style, call Axes.plot or Axes.stackplot instead of DataFrame.plot.
* SPLinkData.plot: axes() now has a better default size, drop our own default size.
* SPLinkData.plot: new optional ax_title parameter to specify a title for the axes.
* SPLinkCommand.cmd_plot: make pseudo-data "POWER" the default and special case a stack plot for "POWER".

*Release 20220806*:
Faster events prescan during import (it appears that timestamps are unique), less import noise.

*Release 20220805*:
* SPLinkCommand.cmd_plot: new --bare option to strip legends, axes etc from a graph.
* Assorted small internal changes.

*Release 20220626*:
* Lots of updates to the import process.
* SPLinkCommand: new cmd_pull, combining fetch and import.
* SPLinkData.plot: rework the key matching and plot data gathering, pass the utcoffset to the subsidiary timeseries plot call.
* SPLinkDataDir.to_csv: shim TimeSeriesDataDir,to_csv to reproduce the SP-Link download CSV format.
* SPLinkCommand.cmd_export: new "splink export" command to export data in SP-Link CSV format.
* Many minor updates.

*Release 20220606*:
Initial PyPI release.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cs.splink",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python3",
    "author": "",
    "author_email": "Cameron Simpson <cs@cskk.id.au>",
    "download_url": "https://files.pythonhosted.org/packages/9f/aa/cf0727b3a7af4e1fd35abaa2b9c107f2fad31fb684c1903a2b6c7bd44baa/cs.splink-20240316.tar.gz",
    "platform": null,
    "description": "Assorted utility functions for working with data\ndownloaded from Selectronics' SP-LINK programme\nwhich communicates with their solar inverter controllers.\n\n*Latest release 20240316*:\nFixed release upload artifacts.\n\nI use this to gather and plot data from my solar inverter.\n\n## Function `main(argv=None)`\n\nSP-Link command line mode.\n\n## Class `SPLinkCommand(cs.timeseries.TimeSeriesBaseCommand, cs.cmdutils.BaseCommand)`\n\nCommand line to work with SP-Link data downloads.\n\nCommand line usage:\n\n    Usage: splink [-d spdpath] [-n] subcommand...\n        -d spdpath  Specify the directory containing the SP-Link downloads\n                    and time series. Default from $SPLINK_DATADIR,\n                    or '.'.\n        -n          No action; recite planned actions.\n      Subcommands:\n        export dataset\n          Export the named dataset in the original CSV form.\n          Available datasets: DailySummaryData DetailedData\n        fetch [-F rsync-source] [-nx] [-- [rsync-options...]]\n          Rsync everything from rsync-source into the downloads area.\n          -F    Fetch rsync source, default from $SPLINK_FETCH_SOURCE.\n          -n    Passed to rsync. Just more convenient than putting it at the end.\n          -x    Delete source files.\n        help [-l] [subcommand-names...]\n          Print help for subcommands.\n          This outputs the full help for the named subcommands,\n          or the short help for all subcommands if no names are specified.\n          -l  Long help even if no subcommand-names provided.\n        import [-d dataset,...] [-n] [sp-link-download...]\n          Import CSV data from the downloads area into the time series data.\n          -d datasets       Comma separated list of datasets to import.\n                            Default datasets: DailySummaryData DetailedData EventData\n          -f                Force. Import datasets even if already marked as\n                            imported.\n          -n                No action. Recite planned imports.\n          sp-link-download  Specify specific individual downloads to import.\n                            The default is any download not tagged as already\n                            imported.\n        info\n          Report information about the time series stored at tspath.\n        plot [-e event,...] [-f] [-o imagepath] [--show] [start-time [stop-time] {mode|[dataset:]{glob|field}}...]\n          Plot the data from specified fields for the specified time range.\n          If there is no start-time a time of 5 (the preceeding 5 days) is assumed.\n          If there are no data specs a mode of POWER is assumed.\n          Options:\n            --bare          Strip axes and padding from the plot.\n            -e events,...   Display the specified events.\n            -f              Force. Overwirte the image path even if it exists.\n            -o imagepath    Write the plot to imagepath.\n                            If not specified, the image will be written\n                            to the standard output in sixel format if\n                            it is a terminal, and in PNG format otherwise.\n            --stacked       Stack graphed values on top of each other.\n            --show          Open the image path with \"open\".\n            --tz tzspec     Skew the UTC times presented on the graph\n                            to emulate the timezone specified by tzspec.\n                            The default skew is the system local timezone.\n            -U, --update    Run a \"pull\" before plotting.\n            start-time      An integer number of days before the current time\n                            or any datetime specification recognised by\n                            dateutil.parser.parse.\n            stop-time       Optional stop time, default now.\n                            An integer number of days before the current time\n                            or any datetime specification recognised by\n                            dateutil.parser.parse.\n            mode            A named graph mode, implying a group of fields.\n                            Providing '?' or 'help' prints the available\n                            datasets and field names.\n        pull [-d dataset,...] [-F rsync-source] [-nx]\n          Fetch and import data.\n          -d dataset,...\n                Specify the datasets to import.\n          -F    Fetch rsync source, default from $SPLINK_FETCH_SOURCE.\n          -n    No action; pass -n to rsync. Just more convenient than putting it at the end.\n          -x    Delete source files.\n        shell\n          Run a command prompt via cmd.Cmd using this command's subcommands.\n\n## Class `SPLinkCSVDir(cs.fs.HasFSPath)`\n\nA class for working with SP-Link data downloads,\nreferring to a particular `PerformanceData*` download directory.\n\n## Class `SPLinkData(cs.fs.HasFSPath, cs.resources.MultiOpenMixin, cs.context.ContextManagerMixin)`\n\nA directory containing SP-LInk data.\n\nThis contains:\n- `downloads`: a directory containing copies of various SP-Link\n  downloads i.e. this contains directories named `PerformanceData_*`.\n- `events.db`: accrued event data from the `EventData` CSV files\n- `DailySummaryData`: an `SPLinkDataDir` containing accrued\n  data from the `DailySummaryData` CSV files\n- `DetailedData`: an `SPLinkDataDir` containing accrued data\n  from the `DetailedData` CSV files\n\n## Class `SPLinkDataDir(cs.timeseries.TimeSeriesDataDir, cs.timeseries.TimeSeriesMapping, builtins.dict, cs.resources.MultiOpenMixin, cs.context.ContextManagerMixin, cs.fs.HasFSPath, cs.configutils.HasConfigIni, cs.timeseries.HasEpochMixin, cs.timeseries.TimeStepsMixin)`\n\nA `TimeSeriesDataDir` to hold log data from an SP-Link CSV data download.\nThis holds the data from a particular CSV log such as `'DetailedData'`.\nThe `SPLinkData` class manages a couple of these and a downloads\nsubdirectory and an events `SQLTags`.\n\n*Method `SPLinkDataDir.__init__(self, dirpath, dataset: str, step: int, policy=None, **kw)`*:\nInitialise the `SPLinkDataDir`.\n\nParameters:\n* `dirpath`: the pathname of the directory holding the downloaded CSV files\n* `dataset`: which CSV file populates this time series, eg `'DetailedData'`\n* `step`: optional time series step size,\n  default `SPLinkDataDir.DEFAULT_LOG_FREQUENCY`,\n  which comes from `SPLinkCSVDir.DEFAULT_LOG_FREQUENCY`\n* `policy`: optional TimespanPolicy` instance;\n  if omitted an `TimespanPolicyYearly` instance will be made\nOther keyword arguments are passed to the `TimeSeriesDataDir`\ninitialiser.\n\n## Class `SPLinkDataFileInfo(builtins.tuple)`\n\nSPLinkDataFileInfo(fspath, sitename, dataset, unixtime, dotext)\n\n*Method `SPLinkDataFileInfo.__new__(_cls, fspath, sitename, dataset, unixtime, dotext)`*:\nCreate new instance of SPLinkDataFileInfo(fspath, sitename, dataset, unixtime, dotext)\n\n## Function `ts2001_unixtime(tzname=None)`\n\nReturn the SP-Link 2001-01-01-local-time epoch as a UNIX time.\n\n# Release Log\n\n\n\n*Release 20240316*:\nFixed release upload artifacts.\n\n*Release 20240201*:\n* Release with the \"splink\" script.\n* splink plot: new -U/--update option to run a \"pull\" before plotting.\n\n*Release 20230612*:\n* SPLinkCommand: new print_known_datasets method, use in help.\n* SPLinkCommand.cmd_plot: if the start/stop times are out of order, swap them.\n* Assorted internal changes.\n\n*Release 20230217*:\nSPLinkCommand.cmd_plot: make the start-time optional, default to 5.\n\n*Release 20220918*:\n* SPLinkData.plot: rename `key_specs` keyword parameter to mandatory posiitional `data_specs` parameter.\n* SPLinkData.resolve: accept multiple specification strings.\n* New SPLinkData.plot_data_from_spec(start,stop,data_spec,...) method to return a list of PlotSeries instances.\n* SPLinkData.plot: drop mode param (unused).\n* SPLinkData.plot: process plot data and annotate with style, call Axes.plot or Axes.stackplot instead of DataFrame.plot.\n* SPLinkData.plot: axes() now has a better default size, drop our own default size.\n* SPLinkData.plot: new optional ax_title parameter to specify a title for the axes.\n* SPLinkCommand.cmd_plot: make pseudo-data \"POWER\" the default and special case a stack plot for \"POWER\".\n\n*Release 20220806*:\nFaster events prescan during import (it appears that timestamps are unique), less import noise.\n\n*Release 20220805*:\n* SPLinkCommand.cmd_plot: new --bare option to strip legends, axes etc from a graph.\n* Assorted small internal changes.\n\n*Release 20220626*:\n* Lots of updates to the import process.\n* SPLinkCommand: new cmd_pull, combining fetch and import.\n* SPLinkData.plot: rework the key matching and plot data gathering, pass the utcoffset to the subsidiary timeseries plot call.\n* SPLinkDataDir.to_csv: shim TimeSeriesDataDir,to_csv to reproduce the SP-Link download CSV format.\n* SPLinkCommand.cmd_export: new \"splink export\" command to export data in SP-Link CSV format.\n* Many minor updates.\n\n*Release 20220606*:\nInitial PyPI release.\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 or later (GPLv3+)",
    "summary": "Assorted utility functions for working with data downloaded from Selectronics' SP-LINK programme which communicates with their solar inverter controllers.",
    "version": "20240316",
    "project_urls": {
        "URL": "https://bitbucket.org/cameron_simpson/css/commits/all"
    },
    "split_keywords": [
        "python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b2833757cb8a3fdf672dc9d198f7229df7bd4b5b01a1429c9d56dac08550238",
                "md5": "3c7072db71618f1412c8f8d97290dc9c",
                "sha256": "70e33867a9e59026e8e78586fcc501715fd4f87d3e1cd7d8b1249c3dc4aa98a4"
            },
            "downloads": -1,
            "filename": "cs.splink-20240316-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c7072db71618f1412c8f8d97290dc9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16722,
            "upload_time": "2024-03-16T06:55:03",
            "upload_time_iso_8601": "2024-03-16T06:55:03.760141Z",
            "url": "https://files.pythonhosted.org/packages/4b/28/33757cb8a3fdf672dc9d198f7229df7bd4b5b01a1429c9d56dac08550238/cs.splink-20240316-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9faacf0727b3a7af4e1fd35abaa2b9c107f2fad31fb684c1903a2b6c7bd44baa",
                "md5": "cdf05ddee62a66b4e688ead18172338e",
                "sha256": "38a2a82483421496c0a3dbcacb1009f97195b71b81d9864f86f3f49d197bbb9e"
            },
            "downloads": -1,
            "filename": "cs.splink-20240316.tar.gz",
            "has_sig": false,
            "md5_digest": "cdf05ddee62a66b4e688ead18172338e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19737,
            "upload_time": "2024-03-16T06:55:12",
            "upload_time_iso_8601": "2024-03-16T06:55:12.541857Z",
            "url": "https://files.pythonhosted.org/packages/9f/aa/cf0727b3a7af4e1fd35abaa2b9c107f2fad31fb684c1903a2b6c7bd44baa/cs.splink-20240316.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-16 06:55:12",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "cameron_simpson",
    "bitbucket_project": "css",
    "lcname": "cs.splink"
}
        
Elapsed time: 0.19140s