aitana-storage 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ .claude/memory/
2
+ __pycache__
3
+ dist/
4
+ site/
5
+ # pixi environments
6
+ .pixi/*
7
+ !.pixi/config.toml
8
+ src/aitana/data/workflows/egu_2026/.conda/
9
+ src/aitana/data/workflows/egu_2026/.cache/
10
+ src/aitana/data/workflows/egu_2026/.snakemake/
11
+ *.png
12
+ *.pdf
13
+ aitana-volcanoes/src/aitana/volcanoes/data/RSAM_NZ.WIZ.10.HHZ.csv
14
+ aitana-volcanoes/src/aitana/volcanoes/data/ruapehu_rsam.csv
15
+ .vscode/settings.json
16
+ .vscode/launch.json
17
+ .devcontainer/devcontainer-lock.json
18
+ sandbox.ipynb
19
+ file.tar
20
+ .cache/mkdocs-jupyter/420337ba48befbcb635ec031a7d75be7d7746c272cd29ffdd968828c2bf81fc6.json
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: aitana-storage
3
+ Version: 0.1.0
4
+ Summary: Store time series data as HDF5 files and access them through an API.
5
+ Project-URL: Homepage, https://github.com/tsc-tools/aitana
6
+ Author-email: Yannik Behr <y.behr@gns.cri.nz>, Christof Mueller <c.mueller@gns.cri.nz>
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: datashader<0.19,>=0.18.2
9
+ Requires-Dist: fastapi<0.129,>=0.128.0
10
+ Requires-Dist: h5netcdf<2,>=1.7.3
11
+ Requires-Dist: h5py<4,>=3.15.1
12
+ Requires-Dist: matplotlib<4,>=3.10.8
13
+ Requires-Dist: pandas<3,>=2.3.3
14
+ Requires-Dist: s3fs<2026,>=2025.12.0
15
+ Requires-Dist: torch<3,>=2.10.0
16
+ Requires-Dist: uvicorn[standard]<0.41,>=0.40.0
17
+ Requires-Dist: xarray[accel,io,parallel]<2026,>=2025.6.1
18
+ Requires-Dist: zarr<4,>=3.1.5
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "aitana-storage"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Yannik Behr", email="y.behr@gns.cri.nz" },
10
+ { name="Christof Mueller", email="c.mueller@gns.cri.nz" }
11
+ ]
12
+ description = "Store time series data as HDF5 files and access them through an API."
13
+ requires-python = ">=3.11"
14
+
15
+ dependencies = [
16
+ "xarray[io,accel,parallel]>=2025.6.1,<2026",
17
+ "datashader>=0.18.2,<0.19",
18
+ "h5py>=3.15.1,<4",
19
+ "pandas>=2.3.3,<3",
20
+ "h5netcdf>=1.7.3,<2",
21
+ "uvicorn[standard]>=0.40.0,<0.41",
22
+ "fastapi>=0.128.0,<0.129",
23
+ "matplotlib>=3.10.8,<4",
24
+ "zarr>=3.1.5,<4",
25
+ "s3fs>=2025.12.0,<2026",
26
+ "torch>=2.10.0,<3"
27
+ ]
28
+
29
+ [tool.hatch.build.targets.wheel]
30
+ packages = ["src/aitana"]
31
+
32
+ [tool.hatch.build]
33
+ include = ["src/aitana/storage/package_data/**"]
34
+
35
+ [project.scripts]
36
+ tonik_api = "aitana.storage.api:main"
37
+ test_data = "aitana.storage.utils:main"
38
+ grafana_annotations = "aitana.storage.grafana_annotations:main"
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/tsc-tools/aitana"
@@ -0,0 +1,214 @@
1
+ <!-- TonikAPI index.html -->
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>TonikAPI</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ background-color: #f9f9f9;
12
+ line-height: 1.6;
13
+ }
14
+ header {
15
+ background-color: #007ACC;
16
+ color: #fff;
17
+ padding: 20px;
18
+ text-align: center;
19
+ border-radius: 8px;
20
+ }
21
+ section {
22
+ background-color: #fff;
23
+ margin-top: 20px;
24
+ padding: 20px;
25
+ border-radius: 8px;
26
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
27
+ }
28
+ h2 {
29
+ color: #007ACC;
30
+ }
31
+ code {
32
+ background-color: #eef;
33
+ padding: 2px 4px;
34
+ border-radius: 4px;
35
+ }
36
+ pre {
37
+ background-color: #eef;
38
+ padding: 10px;
39
+ border-radius: 4px;
40
+ overflow-x: auto;
41
+ }
42
+ a.button {
43
+ display: inline-block;
44
+ padding: 10px 15px;
45
+ margin: 5px 0;
46
+ font-size: 14px;
47
+ text-decoration: none;
48
+ background-color: #007ACC;
49
+ color: #fff;
50
+ border-radius: 4px;
51
+ }
52
+ table {
53
+ width: 100%;
54
+ border-collapse: collapse;
55
+ margin-bottom: 20px;
56
+ }
57
+ table, th, td {
58
+ border: 1px solid #ddd;
59
+ }
60
+ th, td {
61
+ padding: 8px;
62
+ text-align: left;
63
+ }
64
+ th {
65
+ background-color: #f2f2f2;
66
+ }
67
+ footer {
68
+ text-align: center;
69
+ margin-top: 40px;
70
+ color: #666;
71
+ font-size: 0.9em;
72
+ }
73
+ </style>
74
+ </head>
75
+ <body>
76
+ <header>
77
+ <h1>TonikAPI</h1>
78
+ <p>Query, transform, and extract features from multidimensional data stores</p>
79
+ </header>
80
+
81
+ <section>
82
+ <h2>Overview</h2>
83
+ <p>
84
+ TonikAPI is designed for efficient retrieval, transformation, and feature extraction of time-series and spectrogram-like data stored in hierarchical formats. It supports subdirectory traversal, resampling, log-scaling, and normalization.
85
+ </p>
86
+ <p>
87
+ This API is especially suited for applications in seismology, geophysics, and related fields.
88
+ </p>
89
+ </section>
90
+
91
+ <section>
92
+ <h2>Endpoints</h2>
93
+ <table>
94
+ <thead>
95
+ <tr>
96
+ <th>Endpoint</th>
97
+ <th>Method</th>
98
+ <th>Description</th>
99
+ </tr>
100
+ </thead>
101
+ <tbody>
102
+ <tr>
103
+ <td><code>/feature</code></td>
104
+ <td>GET</td>
105
+ <td>Returns time series or spectrogram features for a given group, variable, and time range.</td>
106
+ </tr>
107
+ <tr>
108
+ <td><code>/inventory</code></td>
109
+ <td>GET</td>
110
+ <td>Lists available datasets or subdirectories within a group.</td>
111
+ </tr>
112
+ <tr>
113
+ <td><code>/labels</code></td>
114
+ <td>GET</td>
115
+ <td>Fetches labels associated with a dataset for a specified time range.</td>
116
+ </tr>
117
+ </tbody>
118
+ </table>
119
+ </section>
120
+
121
+ <section>
122
+ <h2>Feature Request Example</h2>
123
+ <p>Example query for retrieving a feature:</p>
124
+ <pre>GET /feature?path=testgroup&amp;name=rms&amp;starttime=2023-01-01T00:00:00&amp;endtime=2023-01-02T00:00:00&amp;resolution=1h&amp;log=true&amp;normalise=true</pre>
125
+ <p>
126
+ <a class="button" href="#" onclick="alert('Simulate API call using curl or your browser.')">Try Feature Query</a>
127
+ </p>
128
+ <pre>curl "http://localhost:8003/feature?path=testgroup&amp;name=rms&amp;starttime=2023-01-01T00:00:00&amp;endtime=2023-01-02T00:00:00&amp;resolution=1h&amp;log=true&amp;normalise=true"</pre>
129
+ </section>
130
+
131
+ <section>
132
+ <h2>Inventory</h2>
133
+ <p>
134
+ The <code>/inventory</code> endpoint returns a fully nested dictionary of all available datasets within a group.
135
+ Every feature leaf carries metadata so you know exactly what data is available before making a feature request.
136
+ </p>
137
+
138
+ <h3>Tree view (default)</h3>
139
+ <p>Returns the complete hierarchy as nested dicts. Each feature is a dict with record metadata and a ready-to-use request URL:</p>
140
+ <pre>GET /inventory?path=testgroup</pre>
141
+ <pre><code>{
142
+ "testgroup": {
143
+ "WIZ": {
144
+ "00": {
145
+ "HHZ": {
146
+ "rsam": {
147
+ "name": "rsam",
148
+ "recordCount": 1440,
149
+ "earliestRecord": "2023-01-01T00:00:00",
150
+ "latestRecord": "2023-01-10T23:50:00",
151
+ "url": "http://localhost:8003/feature?path=testgroup,WIZ,00,HHZ&amp;name=rsam&amp;starttime=2023-01-01T00:00:00&amp;endtime=2023-01-10T23:50:00"
152
+ },
153
+ ...
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }</code></pre>
159
+
160
+ <h3>Flat view</h3>
161
+ <p>Pass <code>tree=false</code> to list only the top-level subdirectories:</p>
162
+ <pre>GET /inventory?path=testgroup&amp;tree=false</pre>
163
+
164
+ <h3>Subdir view</h3>
165
+ <p>Pass a comma-separated <code>path</code> to list features at a specific location. Returns the same feature metadata dicts:</p>
166
+ <pre>GET /inventory?path=testgroup,WIZ,00,HHZ</pre>
167
+
168
+ <h3>Feature metadata fields</h3>
169
+ <table>
170
+ <thead>
171
+ <tr><th>Field</th><th>Type</th><th>Description</th></tr>
172
+ </thead>
173
+ <tbody>
174
+ <tr><td><code>name</code></td><td>string</td><td>Feature name</td></tr>
175
+ <tr><td><code>recordCount</code></td><td>integer</td><td>Total number of time-series records on disk</td></tr>
176
+ <tr><td><code>earliestRecord</code></td><td>ISO 8601 string</td><td>Timestamp of the first record</td></tr>
177
+ <tr><td><code>latestRecord</code></td><td>ISO 8601 string</td><td>Timestamp of the last record</td></tr>
178
+ <tr><td><code>url</code></td><td>string</td><td>Ready-to-use URL to request the full feature time series via <code>/feature</code></td></tr>
179
+ </tbody>
180
+ </table>
181
+ </section>
182
+
183
+ <section>
184
+ <h2>Labels</h2>
185
+ <p>Query labels associated with a dataset for a specified time range:</p>
186
+ <pre>GET /labels?path=testgroup&amp;starttime=2023-01-01T00:00:00&amp;endtime=2023-01-02T00:00:00</pre>
187
+ </section>
188
+
189
+ <section>
190
+ <h2>Python Example</h2>
191
+ <p>You can query the TonikAPI directly from Python using <code>requests</code>:</p>
192
+ <pre><code>import requests
193
+
194
+ params = {
195
+ "path": "testgroup",
196
+ "name": "rms",
197
+ "starttime": "2023-01-01T00:00:00",
198
+ "endtime": "2023-01-02T00:00:00",
199
+ "resolution": "1h",
200
+ "log": "true",
201
+ "normalise": "true"
202
+ }
203
+
204
+ response = requests.get("http://localhost:8003/feature", params=params)
205
+ with open("rms_feature.csv", "w") as f:
206
+ f.write(response.text)
207
+ </code></pre>
208
+ </section>
209
+
210
+ <footer>
211
+ <p>&copy; 2025 TonikAPI. Built with precision using FastAPI + Pandas + Xarray.</p>
212
+ </footer>
213
+ </body>
214
+ </html>