Skip to main content

Plot data availability for seismic

Project description

data-availability

GitHub contribution-style calendar heatmaps for data completeness over time.

Useful for monitoring instrument data quality or any time-series availability tracking. Generates a matplotlib Figure with one subplot per calendar year, each day rendered as a color-coded tile on a red-yellow-green gradient.

Input: Excel (.xlsx/.xls) or CSV with date and completeness (0–100) columns.
Output: A matplotlib.figure.Figure — save or display as needed.

Availability of IJEN

Installation

pip install data-availability

Or with uv:

uv add data-availability

Quick start

Fluent builder (recommended)

import matplotlib.pyplot as plt
from data_availability import PlotAvailability

fig = (
    PlotAvailability("data.xlsx")
    .load_data(years="2023")
    .plot_availability(title="Sensor Uptime", tile_shape="squircle")
)
plt.savefig("availability.png", dpi=150, bbox_inches="tight")

One-call helpers

from data_availability import plot_from_file, plot_from_df

# From a file
fig = plot_from_file("data.csv", title="My Data")

# From a pre-loaded DataFrame
import pandas as pd
df = pd.read_csv("data.csv")
fig = plot_from_df(df, title="My Data")

API reference

PlotAvailability(filepath)

Fluent builder class.

fig = (
    PlotAvailability("data.xlsx")
    .load_data(
        date_column="date",          # column name for dates
        completeness_column="completeness",  # column name for values (0–100)
        years=["2022", "2023"],      # filter to specific years (optional)
    )
    .plot_availability(
        title="Data Availability",
        tile_shape="square",         # "square" or "squircle"
        hspace=0.2,
        figsize_per_year=2.2,
        missing_color="#e0e0e0",
        cbar_bottom=20,
        cbar_height=10,
        tile_gap=0.9,
        title_pad=40,
    )
)

plot_from_file(filepath, **kwargs) / plot_from_df(df, **kwargs)

Functional alternatives that accept the same keyword arguments as .plot_availability() plus date_column and completeness_column.

load_data(filepath, date_column, completeness_column)

Load and normalize an Excel or CSV file into a DataFrame ready for plotting.

Input format

Column Type Notes
date date string or datetime parsed automatically
completeness float clipped to [0, 100]; strings replaced with NaN

Column names are configurable via date_column / completeness_column parameters.

Development

# Install with dev extras
uv sync --group dev

# Run the example
uv run main.py

# Lint and format
uv run ruff check --fix .
uv run ruff format .

# Type check
uv run ty check

License

MIT © Martanto

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

data_availability-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

data_availability-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file data_availability-0.1.0.tar.gz.

File metadata

  • Download URL: data_availability-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for data_availability-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3e2b5cbb59357565cfee179b0cd6083e798268ca6c7e2b552c3cbe38e7fec00c
MD5 99477404452dbf4a5823b8ac44f5c058
BLAKE2b-256 e7fbc03aaa08a16877d78500359d4870ba122ff985e09f94ac62ef7898b77894

See more details on using hashes here.

File details

Details for the file data_availability-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: data_availability-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for data_availability-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ad41a41de48906056e75d39fd80fb2d3c80e54ea68207c37d29bfbcd9fbadec
MD5 1085482ca626ef0e5ef34e8ecccf4059
BLAKE2b-256 7c1d6d3d1c29fef84cdbaa4e63e1a16892efd68cc3b513c5f7c2a765a8493b4c

See more details on using hashes here.

Supported by

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