Catalog PyPI
PACKAGE EXPLORERView in registry

addereq-dm

PyPI

SDK for geophysics time-series data access, lightweight processing, and plotting

Versions collected1
Direct dependencies12From release 2.1.1
Last observed20 Oct, 19:17 UTC

README

Version 2.1.1 documentation

addereq-dm

Dameng-backed earthquake precursor time-series data access, processing, and plotting SDK. This package is the API-based successor to the Oracle-oriented addereq package.

Install

Python 3.9 or newer is required.

Install the package with plotting support. The distribution name is addereq-dm and the Python import name is addereq_dm:

pip install "addereq-dm[viz]"

Connection config

For CLI usage, the recommended place for credentials is a user-level config file instead of the project directory.

Default config file location:

  • Windows: %APPDATA%\\addereq-dm\\config.env
  • Linux/macOS: ~/.config/addereq-dm/config.env

Initialize the config from CLI with your own values:

addereq-dm init-config \
  --base-url http://your-api-server:8080 \
  --app-id your_app_id \
  --secret your_secret

If any required value is omitted, the CLI will prompt for it interactively. timeout defaults to 10.

Or initialize from Python:

from addereq_dm import initialize_user_config

initialize_user_config(
    base_url="http://your-api-server:8080",
    app_id="your_app_id",
    secret="your_secret",
)

Example written file:

DM_API_BASE_URL="http://your-api-server:8080"
DM_API_APP_ID="your_app_id"
DM_API_SECRET="your_secret"
DM_API_TIMEOUT="10"

The CLI resolves values in this order:

  • command-line arguments
  • --env-file if provided
  • the default user config file above
  • current process environment variables
  • built-in defaults such as DM_API_TIMEOUT=10

Business parameters such as station, point, item, sample rate, and time range are still expected to be passed explicitly in code or CLI commands.

Quick start

from addereq_dm import create_geophysics_client

api = create_geophysics_client(
    base_url="http://your-api-server:8080",
    app_id="your_app_id",
    secret="your_secret",
)

Core fetch API

df = api.ts.fetch_dys(
    station="taian_center",
    point="1",
    item="vertical_z",
    source_sample_rate="02",
    output_sample_rate="02",
    start_time="2025-11-01 00:00:00",
    end_time="2025-11-03 00:00:00",
)

The Python API uses explicit names for the two sample-rate concepts:

  • source_sample_rate: raw input sample rate
  • output_sample_rate: output sample rate for the returned series

For the CLI, use the corresponding options --source-sample-rate and --output-sample-rate. The configuration variables are DM_SOURCE_SAMPLE_RATE and DM_OUTPUT_SAMPLE_RATE.

Accepted sample-rate aliases currently include:

  • 01, minute, min
  • 02, second, sec
  • 60, hour, h
  • 90, day, d
  • common Chinese aliases are also supported in code

source_sample_rate must match the rate of the data stored upstream. The output_sample_rate may request a coarser result, for example source seconds to output minutes. It cannot recover second-level observations from minute-level source data.

The Chinese aliases map as follows:

AliasCodeMeaning
分钟值01minute-level data
秒钟值02second-level data
整点值60hourly data
日值90daily data

DYS and DYU

Use fetch_dys() for DYS raw data:

dys = api.ts.fetch_dys(
    station="taian_center",
    point="1",
    item="vertical_z",
    source_sample_rate="02",
    output_sample_rate="01",
    start_time="2025-11-01 00:00:00",
    end_time="2025-11-02 00:00:00",
)

Use fetch_dyu() for DYU preprocessed data. Its call shape is the same; the kind is selected by the method name:

dyu = api.ts.fetch_dyu(
    station="taian_center",
    point="1",
    item="vertical_z",
    source_sample_rate="02",
    output_sample_rate="01",
    start_time="2025-11-01 00:00:00",
    end_time="2025-11-02 00:00:00",
)

Use fetch_dys_with_report() or fetch_dyu_with_report() when you need success/failure details for multiple targets or long time ranges.

Fetch parameters

The common parameters for fetch_dys(), fetch_dyu(), and their *_with_report() variants are:

ParameterRequiredDescription
stationYesStation ID or station name; use "all" for all stations.
pointNoPoint ID, point number, or point name. Omit to match multiple points.
itemYesItem ID or item name; use "all" for all items.
source_sample_rateNoActual source-data rate, default "02".
output_sample_rateNoReturned-data rate; the Python API default is "02", so set it explicitly when needed.
start_timeYesStart time in YYYY-MM-DD HH:MM:SS format.
end_timeYesExclusive end time in YYYY-MM-DD HH:MM:SS format.
max_targetsNoMaximum number of resolved station/point/item targets, default 50.
allow_partialNoKeep successful targets or chunks when another request fails.
max_workersNoConcurrent target workers; use 1 for serial requests.

fetch_dys() and fetch_dyu() return a normalized pandas DataFrame, or None when no target can be resolved. The *_with_report() variants return (dataframe, report) so partial failures can be inspected.

Supported input styles:

  • station: station id or station name
  • point: point id, point number, or point name; may be omitted
  • item: item id or item name

When resolution fails or the query is ambiguous, the resolver returns candidate suggestions to help narrow the scope.

Long-range requests are handled automatically. When the requested range spans more than 30 natural days, the SDK splits the request into multiple upstream calls, merges the returned frames, sorts by timestamp, and deduplicates boundary rows. Chunk boundaries follow an exclusive end_time rule, so each chunk covers [start_time, end_time) and the next chunk starts exactly at the previous chunk's end_time.

Use the next midnight when requesting a complete final day. For example, data for November 1-2 should use end_time="2025-11-03 00:00:00".

Scope keywords

The following keywords are supported for broad queries:

  • "all"
  • "*"
  • common Chinese equivalents for “all” are also supported in code

Lightweight processing

stats = api.ts.summarize(df)
report = api.ts.quality_report(df)
hourly = api.ts.resample(df, "1h")
centered = api.ts.center(hourly)
detrended = api.ts.detrend(df, method="mean")
cleaned = api.ts.clip_outliers(df, zscore=3.0)
differenced = api.ts.difference(df)
robust = api.ts.hampel(df, window_size=15, threshold=5.0)
complete = api.ts.expand_timeline(df)
aligned = api.ts.align([df1, df2], labels=["station_a", "station_b"])

The processing layer normalizes sentinel missing values such as 999999 into real missing values before summaries, quality checks, resampling, alignment, and plotting.

Frames containing multiple logical series are processed independently by STATIONID, POINTID, and ITEMID. Multi-series summaries and quality reports include a series list with per-series results. Pass group_cols=[] only when an intentional whole-frame calculation is required.

Normalized output uses SAMPLERATE for the actual returned series rate and SOURCE_SAMPLERATE for the upstream source rate. VALUE is the canonical value column; OBSVALUE remains as a compatibility mirror for existing addereq workflows.

expand_timeline uses the sample rate to insert timestamps omitted by the API. MISSING_REASON="missing_record" identifies inserted rows, while MISSING_REASON="sentinel" identifies explicit upstream values such as 999999.

Optional metadata snapshot

Online resolution and plotting use live API metadata plus process-local memory caching. They do not automatically read or write persistent metadata. If offline plotting is required, explicitly create a station, point, item, and unit snapshot under the same user configuration directory as config.env.

Snapshot namespaces are SHA-256 hashes of the normalized API base URL; credentials are never written into snapshot files or keys. Refresh failures are reported directly and never hidden by silently using old metadata.

addereq-dm metadata path
addereq-dm metadata status
addereq-dm metadata refresh
addereq-dm metadata refresh --station-id 37001
addereq-dm metadata clear

Optional batch fetch report

df, report = api.ts.fetch_dys_with_report(
    station="all",
    point="1",
    item="3123",
    source_sample_rate="02",
    output_sample_rate="02",
    start_time="2025-11-01 00:00:00",
    end_time="2025-11-03 00:00:00",
    max_targets=20,
    allow_partial=True,
)

report contains:

  • a local request identifier for tracing one aggregated SDK fetch
  • total elapsed time and elapsed time per target
  • target count
  • success count
  • failure count
  • successful targets
  • failed targets with error summaries
  • requested chunk count
  • successful chunk count
  • failed chunk count and failed time ranges

With allow_partial=True, successful chunks remain available when another chunk for the same target fails. The failures remain visible in report.

Plotting

Plotting accepts a DataFrame returned by fetch_*() or restored with the export/import helpers. It uses the metadata returned by the API to label stations, points, items, and units.

Plot grouped by item:

api.plot.plot_by_items(
    df,
    prefix="demo_",
    fig_label="_item",
    show_mean=True,
    overlay_earthquakes=True,
    xlabel="Time",
)

Plot grouped by station and point:

api.plot.plot_by_stations(
    df,
    prefix="demo_",
    fig_label="_station",
    show_mean=False,
    overlay_earthquakes=False,
    ylabel="Displacement",
)

Plot parameters

Common parameters for plot_by_items() and plot_by_stations() include:

ParameterDescription
tsNormalized time-series DataFrame.
prefixFilename prefix for generated figures.
fig_labelExtra label added to generated filenames.
plot_typePlot style, normally "line".
show_meanDraw the mean line when True.
show_stdDraw standard-deviation bands when True.
start_time, end_timeLimit the displayed time range without refetching data.
invert_yReverse the y-axis when True.
figure_formatOutput format, default "png".
overlay_earthquakesAdd earthquake markers when earthquake data is supplied.

plot_by_items() creates figures grouped by item and orders station/point subplots by station. plot_by_stations() creates figures grouped by station and point and orders item subplots by item. Additional matplotlib axis options can be passed through as keyword arguments.

Plotting dependencies are loaded lazily, so importing the package without matplotlib is still supported when plotting is not used.

Subplot ordering rules are stable:

  • plot_by_items sorts station subplots by STATIONID
  • plot_by_stations sorts item subplots by ITEMID

CLI

Initialize user config:

addereq-dm init-config --base-url http://your-api-server:8080 --app-id your_app_id --secret your_secret

Resolve station, point, or item:

addereq-dm resolve --station taian_center --point 1 --item vertical_z

Fetch data and export to file:

addereq-dm fetch \
  --station taian_center \
  --point 1 \
  --item 3123 \
  --start-time "2025-01-01 00:00:00" \
  --end-time "2025-01-01 01:00:00" \
  --kind dys \
  --allow-partial \
  --workers 2 \
  --out data.csv \
  --summary

CSV, JSON, and Parquet exports include a <data-file>.metadata.json sidecar with the query, data kind, labels, units, and fetch report. The SDK uses this sidecar automatically when the file is imported or plotted locally:

from addereq_dm import export_timeseries, import_timeseries

export_timeseries(df, "data.parquet", metadata={"project": "weekly-review"})
restored = import_timeseries("data.parquet")

--workers enables controlled concurrency across independent resolved targets. It defaults to 1 and is capped at 8; each target's 30-day windows remain sequential, and merged output keeps target order deterministic.

Plot an existing file:

addereq-dm plot --input data.csv --output-dir figures

Use an explicit persistent metadata snapshot instead of the export sidecar:

addereq-dm plot --input data.csv --offline-metadata --output-dir figures

Local files exported by the SDK restore their embedded labels and units automatically. --offline-metadata explicitly replaces those labels with the persistent snapshot and is the only plotting mode that reads that snapshot.

Inspect a local file without API configuration:

addereq-dm quality --input data.csv

Fetch and plot directly:

addereq-dm plot \
  --station taian_center \
  --point 1 \
  --item 3123 \
  --start-time "2025-01-01 00:00:00" \
  --end-time "2025-01-01 01:00:00" \
  --kind dys \
  --output-dir figures

Use --kind dyu for processed data. CP is intentionally not exposed until its upstream API is stable.

See ROADMAP.md for compatibility, rate limiting, and reporting work.

Downloads & popularity

1downloads
1-day window · source-reported counts19 Oct 2026
114570
2026-09-01: 114 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-01–2026-09-012026-09-02: 85 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-02–2026-09-022026-09-03: 99 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-03–2026-09-032026-09-04: 11 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-04–2026-09-042026-09-05: 10 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-05–2026-09-052026-09-06: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-06–2026-09-062026-09-07: 7 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-07–2026-09-072026-09-08: 5 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-08–2026-09-082026-09-09: 16 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-09–2026-09-092026-09-10: 2 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-10–2026-09-102026-09-11: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-11–2026-09-112026-09-12: 7 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-12–2026-09-122026-09-15: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-15–2026-09-152026-09-16: 6 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-16–2026-09-162026-09-18: 6 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-18–2026-09-182026-09-19: 7 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-19–2026-09-192026-09-20: 9 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-20–2026-09-202026-09-22: 3 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-22–2026-09-222026-09-23: 2 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-23–2026-09-232026-09-24: 5 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-24–2026-09-242026-09-25: 2 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-25–2026-09-252026-09-26: 3 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-26–2026-09-262026-09-27: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-27–2026-09-272026-09-28: 3 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-28–2026-09-282026-09-30: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-09-30–2026-09-302026-10-05: 6 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-05–2026-10-052026-10-06: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-06–2026-10-062026-10-07: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-07–2026-10-072026-10-08: 4 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-08–2026-10-082026-10-09: 2 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-09–2026-10-092026-10-10: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-10–2026-10-102026-10-11: 11 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-11–2026-10-112026-10-13: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-13–2026-10-132026-10-14: 3 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-14–2026-10-142026-10-15: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-15–2026-10-152026-10-16: 9 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-16–2026-10-162026-10-17: 2 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-17–2026-10-172026-10-18: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-18–2026-10-182026-10-19: 1 · observed 2026-10-20T21:21:33.0049820Z · period 2026-10-19–2026-10-19
1 Sept19 Oct

pypistats · 39 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-19 – 2026-10-1912026-10-20T21:21:33.0049820Z
2026-10-18 – 2026-10-1812026-10-20T21:21:33.0049820Z
2026-10-17 – 2026-10-1722026-10-20T21:21:33.0049820Z
2026-10-16 – 2026-10-1692026-10-20T21:21:33.0049820Z
2026-10-15 – 2026-10-1512026-10-20T21:21:33.0049820Z
2026-10-14 – 2026-10-1432026-10-20T21:21:33.0049820Z
2026-10-13 – 2026-10-1312026-10-20T21:21:33.0049820Z
2026-10-11 – 2026-10-11112026-10-20T21:21:33.0049820Z
2026-10-10 – 2026-10-1012026-10-20T21:21:33.0049820Z
2026-10-09 – 2026-10-0922026-10-20T21:21:33.0049820Z
2026-10-08 – 2026-10-0842026-10-20T21:21:33.0049820Z
2026-10-07 – 2026-10-0712026-10-20T21:21:33.0049820Z
2026-10-06 – 2026-10-0612026-10-20T21:21:33.0049820Z
2026-10-05 – 2026-10-0562026-10-20T21:21:33.0049820Z
2026-09-30 – 2026-09-3012026-10-20T21:21:33.0049820Z
2026-09-28 – 2026-09-2832026-10-20T21:21:33.0049820Z
2026-09-27 – 2026-09-2712026-10-20T21:21:33.0049820Z
2026-09-26 – 2026-09-2632026-10-20T21:21:33.0049820Z
2026-09-25 – 2026-09-2522026-10-20T21:21:33.0049820Z
2026-09-24 – 2026-09-2452026-10-20T21:21:33.0049820Z
2026-09-23 – 2026-09-2322026-10-20T21:21:33.0049820Z
2026-09-22 – 2026-09-2232026-10-20T21:21:33.0049820Z
2026-09-20 – 2026-09-2092026-10-20T21:21:33.0049820Z
2026-09-19 – 2026-09-1972026-10-20T21:21:33.0049820Z
2026-09-18 – 2026-09-1862026-10-20T21:21:33.0049820Z
2026-09-16 – 2026-09-1662026-10-20T21:21:33.0049820Z
2026-09-15 – 2026-09-1512026-10-20T21:21:33.0049820Z
2026-09-12 – 2026-09-1272026-10-20T21:21:33.0049820Z
2026-09-11 – 2026-09-1112026-10-20T21:21:33.0049820Z
2026-09-10 – 2026-09-1022026-10-20T21:21:33.0049820Z
2026-09-09 – 2026-09-09162026-10-20T21:21:33.0049820Z
2026-09-08 – 2026-09-0852026-10-20T21:21:33.0049820Z
2026-09-07 – 2026-09-0772026-10-20T21:21:33.0049820Z
2026-09-06 – 2026-09-0612026-10-20T21:21:33.0049820Z
2026-09-05 – 2026-09-05102026-10-20T21:21:33.0049820Z
2026-09-04 – 2026-09-04112026-10-20T21:21:33.0049820Z
2026-09-03 – 2026-09-03992026-10-20T21:21:33.0049820Z
2026-09-02 – 2026-09-02852026-10-20T21:21:33.0049820Z
2026-09-01 – 2026-09-011142026-10-20T21:21:33.0049820Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
2.1.13 Sept 202612

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
chdwql/addereq-dm

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:17 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:248644f2af8a65da540f1afcce09a7b9bc80dd82cbfbea8e65c8195c8a71c11c