Skip to main content

🧙🔧 Utils that can be reused and shared across and beyond the ESO Nowcast project

Project description

Nowcast Library

🧙‍♂️🔧 Utils that can be reused and shared across and beyond the ESO Nowcast project

This is a public repository hosted on GitHub via a push mirror setup in the internal ESO GitLab repository

Installation

Simply run

pip install nowcastlib

Usage and Documentation

Nowcast Library (nowcastlib) consists in a collection of functions organized in submodules (API) and a tool accessible via the command line (CLI). The latter is primarily intended for accessing the Nowcast Library Pipeline, an opinionated yet configurable set of processing steps for wrangling data and evaluating models in a consistent and rigorous way. More information can be found on the nowcastlib pipeline index page (link to markdown and link to hosted docs)

Please refer to the examples folder on GitHub for usage examples.

API

Here is a quick example of how one may import nowcastlib and access to one of the functions:

"""Example showing how to access compute_trig_fields function"""
import nowcastlib as ncl
import pandas as pd
import numpy as np

data_df = pd.DataFrame(
    [[0, 3, 4, np.NaN], [32, 4, np.NaN, 4], [56, 8, 0, np.NaN]],
    columns=["A", "B", "C"],
    index=pd.date_range(start="1/1/2018", periods=4, freq="2min"),
)

result = ncl.datasets.compute_trig_fields(data_df, ["A", "C"])

More in-depth API documentation can be found here.

CLI

Some of the library's functionality is bundled in configurable subcommands accessible via the terminal with the command nowcastlib:

usage: nowcastlib [-h] [-v]
                  {triangulate,preprocess,sync,postprocess,datapipe} ...

positional arguments:
  {triangulate,preprocess,sync,postprocess,datapipe}
                        available commands
    triangulate         Run `nowcastlib triangulate -h` for further help
    preprocess          Run `nowcastlib preprocess -h` for further help
    sync                Run `nowcastlib sync -h` for further help
    postprocess         Run `nowcastlib postprocess -h` for further help
    datapipe            Run `nowcastlib datapipe -h` for further help

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         increase verbosity level from INFO to DEBUG

Development Setup

This repository relies on Poetry for tracking dependencies, building and publishing. It is therefore recommended that developers install poetry and make use of it throughout their development of the project.

Dependencies

Make sure you are in the right Python environment and run

poetry install

This reads pyproject.toml, resolves the dependencies, and installs them.

Deployment

The repository is published to PyPi, so to make it accessible via a pip install command as mentioned earlier.

To publish changes follow these steps. Ideally this process is automated via a CI tool triggered by a push/merge to the master branch:

  1. Optionally run poetry version with the appropriate argument based on semver guidelines.

  2. Update the documentation by running

    make document
    
  3. Prepare the package by running

    poetry build
    
  4. Ensure you have TestPyPi and PyPi configured as your poetry repositories:

    poetry config repositories.testpypi https://test.pypi.org/legacy/
    poetry config repositories.pypi https://pypi.org/
    
  5. Publish the repository to TestPyPi, to see that everything works as expected:

    poetry publish -r testpypi
    
  6. Stage, commit and push your changes (to master) with git.

  7. Publish the repository to PyPi:

    poetry publish -r pypi
    

Upon successful deployment, the library should be available for install via pip

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nowcastlib-3.0.10.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

nowcastlib-3.0.10-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file nowcastlib-3.0.10.tar.gz.

File metadata

  • Download URL: nowcastlib-3.0.10.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.10 Darwin/19.6.0

File hashes

Hashes for nowcastlib-3.0.10.tar.gz
Algorithm Hash digest
SHA256 334b04c5253733dcff51c19c60fbaaba41e256aa1af984bda7316cf8eb04851d
MD5 fe6e99e1c2b9237ba016b438ed93cad9
BLAKE2b-256 4d4918a663b982d5f22d83eed0e2a9628389eb68d9c16e36839ee900cb2731dd

See more details on using hashes here.

Provenance

File details

Details for the file nowcastlib-3.0.10-py3-none-any.whl.

File metadata

  • Download URL: nowcastlib-3.0.10-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.10 Darwin/19.6.0

File hashes

Hashes for nowcastlib-3.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 31aba67ad28e6ee49309dd8a24a85742b619e0ccdf364f876d37822e10c7d009
MD5 7210a1451ed3218df475d97f8488a224
BLAKE2b-256 19bad9fbf15dd8e3c0741caf5c59e30262320924ed517493b9e240306f1adda7

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page