tonik 0.1.13__py3-none-any.whl → 0.1.14__py3-none-any.whl

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.
@@ -1,93 +1,164 @@
1
+ <!-- TonikAPI index.html -->
1
2
  <!DOCTYPE html>
2
3
  <html lang="en">
3
4
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Tonik API Documentation</title>
7
- <style>
8
- body {
9
- font-family: Arial, sans-serif;
10
- margin: 0;
11
- padding: 0;
12
- background-color: #f5f5f5;
13
- }
14
- header {
15
- background-color: #333;
16
- color: white;
17
- text-align: center;
18
- padding: 1em;
19
- }
20
- section {
21
- max-width: 800px;
22
- margin: 2em auto;
23
- padding: 2em;
24
- background-color: white;
25
- border-radius: 8px;
26
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
27
- }
28
- h1 {
29
- color: #333;
30
- }
31
- p {
32
- line-height: 1.6;
33
- color: #666;
34
- }
35
- </style>
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>
36
74
  </head>
37
75
  <body>
76
+ <header>
77
+ <h1>TonikAPI</h1>
78
+ <p>Query, transform, and extract features from multidimensional data stores</p>
79
+ </header>
38
80
 
39
- <header>
40
- <h1>Tonik</h1>
41
- <p>Tonik - API</p>
42
- </header>
43
-
44
- <section>
81
+ <section>
45
82
  <h2>Overview</h2>
46
83
  <p>
47
- Welcome to the documentation for the Tonik API. This API provides access to time-series stored with the tonik package.
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.
48
88
  </p>
89
+ </section>
49
90
 
91
+ <section>
50
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?group=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>
51
125
  <p>
52
- The endpoints available in the API are:
126
+ <a class="button" href="#" onclick="alert('Simulate API call using curl or your browser.')">Try Feature Query</a>
53
127
  </p>
54
- <ul>
55
- <li><strong>GET /feature:</strong> Request time-series data.</li>
56
- <li><strong>GET /inventory:</strong> Request information on data.</li>
57
- </ul>
128
+ <pre>curl "http://localhost:8003/feature?group=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 and Labels</h2>
133
+ <p>Query inventory of datasets:</p>
134
+ <pre>GET /inventory?group=testgroup</pre>
135
+ <p>Query labels for a dataset:</p>
136
+ <pre>GET /labels?group=testgroup&amp;starttime=2023-01-01T00:00:00&amp;endtime=2023-01-02T00:00:00</pre>
137
+ </section>
138
+
139
+ <section>
140
+ <h2>Python Example</h2>
141
+ <p>You can query the TonikAPI directly from Python using <code>requests</code>:</p>
142
+ <pre><code>import requests
143
+
144
+ params = {
145
+ "group": "testgroup",
146
+ "name": "rms",
147
+ "starttime": "2023-01-01T00:00:00",
148
+ "endtime": "2023-01-02T00:00:00",
149
+ "resolution": "1h",
150
+ "log": "true",
151
+ "normalise": "true"
152
+ }
58
153
 
59
- <h2>Code Examples</h2>
60
- <h3>Requesting meta data</h3>
61
- The following will return information on available datasets in JSON format.
62
- <pre>
63
- curl -X GET "http://your.host.server:yourport/inventory"
64
- </pre>
65
- To do the same with Python using requests you can use the following code:
66
- <pre>
67
- import requests
68
- url = "http://your.host.server:yourport/inventory"
69
- response = requests.get(url)
70
- response.json()
71
- </pre>
72
- <h3>Requesting data</h3>
73
- The following example shows how to request RSAM data for station WIZ at volcano Whakaari
74
- between 2019-12-01 and 2019-12-31. The return format is CSV.
75
- <pre>
76
- curl -X GET "http://your.host.server:yourport/feature?name=rsam&starttime=2019-12-01T00:00:00&endtime=2019-12-31T00:00:00&subdir=Whakaari&subdir=WIZ"
77
- </pre>
78
- To do the same with Python using pandas you can use the following code:
79
- <pre>
80
- import pandas as pd
81
- feature="rsam"
82
- starttime="2019-12-01T00:00:00"
83
- endtime="2019-12-31T00:00:00"
84
- volcano="Whakaari"
85
- site="WIZ"
86
- url = f"http://your.host.server:yourport/feature?name={feature}&starttime={starttime}&endtime={endtime}&subdir={volcano}&subdir={site}"
87
- pd.read_csv(url, parse_dates=True, index_col=0)
88
- </pre>
89
- </section>
90
- </section>
154
+ response = requests.get("http://localhost:8003/feature", params=params)
155
+ with open("rms_feature.csv", "w") as f:
156
+ f.write(response.text)
157
+ </code></pre>
158
+ </section>
91
159
 
160
+ <footer>
161
+ <p>&copy; 2025 TonikAPI. Built with precision using FastAPI + Pandas + Xarray.</p>
162
+ </footer>
92
163
  </body>
93
164
  </html>
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: tonik
3
- Version: 0.1.13
3
+ Version: 0.1.14
4
4
  Summary: Store time series data as HDF5 files and access them through an API.
5
5
  Project-URL: Homepage, https://tsc-tools.github.io/tonik
6
6
  Project-URL: Issues, https://github.com/tsc-tools/tonik/issues
@@ -4,9 +4,9 @@ tonik/storage.py,sha256=IklM_atZD4rebUsnXsUj5JldSHU2LqmuqME03PHp_UI,10441
4
4
  tonik/utils.py,sha256=9eSVKIbs8TIZlJCz_-B7FrvOUQCQHO3K52v4Heus-uE,6135
5
5
  tonik/xarray2netcdf.py,sha256=gDNT6nxnRbXPeRqZ3URW5oXY3Nfh3TCrfueE-eUrIoY,5181
6
6
  tonik/xarray2zarr.py,sha256=RhCnS6g3yqe8mrEXhD_4PCN0EI3QPhp5X7ui_wvb_jY,2445
7
- tonik/package_data/index.html,sha256=GKDClUhIam_fAYbNfzAolORhSCG3ae1wW3VjWCg4PMk,2732
8
- tonik-0.1.13.dist-info/METADATA,sha256=MNuL04Q7howEYqs_HbnLxQtIXLAoLhN5nEC9GcE3uk4,2143
9
- tonik-0.1.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- tonik-0.1.13.dist-info/entry_points.txt,sha256=mT3B4eBE8SHlAeMhFnZGor9-YkVtoWM1NVHVuypJ-uY,74
11
- tonik-0.1.13.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- tonik-0.1.13.dist-info/RECORD,,
7
+ tonik/package_data/index.html,sha256=ZCZ-BtGRERsL-6c_dfY43qd2WAaggH7xereennGL6ww,4372
8
+ tonik-0.1.14.dist-info/METADATA,sha256=N9teKTsSEZP6GvNBcvhYcx6AOZv6pMySEECmToK0YyA,2143
9
+ tonik-0.1.14.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
10
+ tonik-0.1.14.dist-info/entry_points.txt,sha256=mT3B4eBE8SHlAeMhFnZGor9-YkVtoWM1NVHVuypJ-uY,74
11
+ tonik-0.1.14.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ tonik-0.1.14.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.17.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any