cloudnet-api-client 0.10.0__tar.gz → 0.12.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.
Files changed (34) hide show
  1. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/workflows/test.yml +1 -1
  2. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/CHANGELOG.md +9 -0
  3. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/PKG-INFO +94 -18
  4. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/README.md +91 -17
  5. cloudnet_api_client-0.12.0/cloudnet_api_client/__init__.py +2 -0
  6. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/cloudnet_api_client/client.py +263 -107
  7. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/cloudnet_api_client/containers.py +45 -6
  8. cloudnet_api_client-0.12.0/cloudnet_api_client/utils.py +30 -0
  9. cloudnet_api_client-0.12.0/cloudnet_api_client/version.py +1 -0
  10. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/pyproject.toml +4 -1
  11. cloudnet_api_client-0.12.0/tests/data/20140205_hyytiala_classification.nc +0 -0
  12. cloudnet_api_client-0.12.0/tests/data/20250808_hyytiala_iwc-Z-T-method.nc +0 -0
  13. cloudnet_api_client-0.12.0/tests/data/20250814_bucharest_classification.nc +0 -0
  14. cloudnet_api_client-0.12.0/tests/data/20250821_limassol_parsivel_41582c49.nc +0 -0
  15. cloudnet_api_client-0.12.0/tests/data/20250822_leipzig-lim_ecmwf-open.nc +0 -0
  16. cloudnet_api_client-0.12.0/tests/test_client.py +500 -0
  17. cloudnet_api_client-0.10.0/cloudnet_api_client/__init__.py +0 -1
  18. cloudnet_api_client-0.10.0/cloudnet_api_client/utils.py +0 -19
  19. cloudnet_api_client-0.10.0/cloudnet_api_client/version.py +0 -1
  20. cloudnet_api_client-0.10.0/tests/test_client.py +0 -139
  21. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/dataportal.env +0 -0
  22. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/db.env +0 -0
  23. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/docker-compose.yml +0 -0
  24. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/initdb.d/init-dbs.sh +0 -0
  25. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/ss.env +0 -0
  26. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.github/workflows/publish.yml +0 -0
  27. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.gitignore +0 -0
  28. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/.pre-commit-config.yaml +0 -0
  29. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/LICENSE +0 -0
  30. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/cloudnet_api_client/dl.py +0 -0
  31. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/cloudnet_api_client/py.typed +0 -0
  32. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/tests/data/20250801_Magurele_CHM170137_000.nc +0 -0
  33. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/tests/data/20250803_JOYCE_WST_01m.dat +0 -0
  34. {cloudnet_api_client-0.10.0 → cloudnet_api_client-0.12.0}/tests/data/20250808_Granada_CHM170119_0045_000.nc +0 -0
@@ -1,4 +1,4 @@
1
- name: Test against dataportal backend
1
+ name: Test and lint
2
2
 
3
3
  on: [push, pull_request]
4
4
 
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 0.12.0 – 2025-08-25
9
+
10
+ - Adjust routes and responses
11
+
12
+ ## 0.11.0 – 2025-08-16
13
+
14
+ - Adjust routes and responses
15
+ - Improve tests
16
+
8
17
  ## 0.10.0 – 2025-08-13
9
18
 
10
19
  - Add `volatile` to metadata response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudnet-api-client
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Summary: Cloudnet API client
5
5
  Author-email: Simo Tukiainen <simo.tukiainen@fmi.fi>
6
6
  License-File: LICENSE
@@ -22,7 +22,9 @@ Requires-Dist: types-requests; extra == 'dev'
22
22
  Requires-Dist: types-tqdm; extra == 'dev'
23
23
  Provides-Extra: test
24
24
  Requires-Dist: mypy; extra == 'test'
25
+ Requires-Dist: netcdf4; extra == 'test'
25
26
  Requires-Dist: pytest; extra == 'test'
27
+ Requires-Dist: pytest-asyncio; extra == 'test'
26
28
  Description-Content-Type: text/markdown
27
29
 
28
30
  [![CI](https://github.com/actris-cloudnet/cloudnet-api-client/actions/workflows/test.yml/badge.svg)](https://github.com/actris-cloudnet/cloudnet-api-client/actions/workflows/test.yml)
@@ -45,14 +47,25 @@ from cloudnet_api_client import APIClient
45
47
 
46
48
  client = APIClient()
47
49
 
48
- sites = client.sites(type="cloudnet")
50
+ sites = client.sites()
51
+ site = client.site("hyytiala")
52
+
49
53
  products = client.products()
54
+ product = client.products("classification")
55
+
56
+ models = client.models()
57
+ model = client.model("ecmwf-open")
58
+
59
+ instruments = client.instruments()
60
+ instrument = client.instrument("d6bf209b-c48b-48a4-bbfb-fed713b27832")
50
61
 
51
- metadata = client.metadata(site_id="hyytiala", date="2021-01-01", product=["mwr", "radar"])
52
- file_paths = client.download(metadata, "data/")
62
+ file = client.file("405cc410-1f24-4ea9-bae8-da7f22be26cb")
53
63
 
54
- raw_metadata = client.raw_metadata(site_id="granada", date="2024-01", instrument_id="parsivel")
55
- file_paths = client.download(raw_metadata, "data_raw/")
64
+ files = client.files(site_id="hyytiala", date="2021-01-01", product_id=["mwr", "radar"])
65
+ file_paths = client.download(files, "data/")
66
+
67
+ raw_files = client.raw_files(site_id="granada", date="2024-01", instrument_id="parsivel")
68
+ file_paths = client.download(raw_files, "data_raw/")
56
69
  ```
57
70
 
58
71
  When downloading files inside Jupyter notebook (or similar environment), you have to use the asynchronous version:
@@ -63,7 +76,7 @@ file_paths = await client.adownload(metadata)
63
76
 
64
77
  ## Documentation
65
78
 
66
- ### `APIClient().metadata()` and `raw_metadata()` &rarr; `list[Metadata]`
79
+ ### `APIClient().files()` and `raw_files()` &rarr; `list[Metadata]`
67
80
 
68
81
  Fetch product and raw file metadata from the Cloudnet data portal.
69
82
 
@@ -81,15 +94,15 @@ Parameters:
81
94
  | instrument_id | `str` or `list[str]` | `None` | "rpg-fmcw-94" |
82
95
  | instrument_pid | `str` or `list[str]` | `None` | "https://hdl.handle.net/21.12132/3.191564170f8a4686" |
83
96
  | model_id | `str` or `list[str]` | `None` | "gdas1" |
84
- | product\* | `str` or `list[str]` | `None` | "classification" |
97
+ | product_id\* | `str` or `list[str]` | `None` | "classification" |
85
98
  | show_legacy\* | `bool` | `False` | |
86
99
  | filename_prefix\*\* | `str` or `list[str]` | `None` | "stare" |
87
100
  | filename_suffix\*\* | `str` or `list[str]` | `None` | ".lv1" |
88
101
  | status\*\* | `str` or `list[str]` | `None` | "created", "uploaded", "processed" or "invalid" |
89
102
 
90
- \* = only in `metadata()`
103
+ \* = only in `files()`
91
104
 
92
- \*\* = only in `raw_metadata()`
105
+ \*\* = only in `raw_files()`
93
106
 
94
107
  **Date Handling**
95
108
 
@@ -128,30 +141,93 @@ Parameters:
128
141
 
129
142
  \* = only with `RawMetadata`
130
143
 
144
+ ### `APIClient().file()` &rarr; `ProductMetadata`
145
+
146
+ Fetch metadata of a single file.
147
+
148
+ Parameters:
149
+
150
+ | name | type |
151
+ | ---- | -------------------- |
152
+ | uuid | `str` or `uuid.UUID` |
153
+
131
154
  ### `APIClient().sites()` &rarr; `list[Site]`
132
155
 
133
- Fetch cloudnet sites.
156
+ Fetch all sites.
134
157
 
135
158
  Parameters:
136
159
 
137
- | name | type | Choices | default |
138
- | ------- | -------------------- | ----------------------------------------- | ------- |
139
- | site_id | `str` | | `None` |
140
- | type | `str` or `list[str]` | "cloudnet", "campaign", "model", "hidden" | `None` |
160
+ | name | type | choices | default |
161
+ | ---- | ----- | ----------------------------------------- | ------- |
162
+ | type | `str` | "cloudnet", "campaign", "model", "hidden" | `None` |
163
+
164
+ ### `APIClient().site()` &rarr; `Site`
165
+
166
+ Fetch a single site.
167
+
168
+ Parameters:
169
+
170
+ | name | type |
171
+ | ------- | ----- |
172
+ | site_id | `str` |
141
173
 
142
174
  ### `APIClient().products()` &rarr; `list[Product]`
143
175
 
144
- Fetch cloudnet products.
176
+ Fetch all products.
145
177
 
146
178
  Parameters:
147
179
 
148
- | name | type | Choices | default |
180
+ | name | type | choices | default |
149
181
  | ---- | -------------------- | ----------------------------------------- | ------- |
150
182
  | type | `str` or `list[str]` | "instrument", "geophysical", "evaluation" | `None` |
151
183
 
184
+ ### `APIClient().product()` &rarr; `ExtendedProduct`
185
+
186
+ Fetch a single product.
187
+
188
+ Parameters:
189
+
190
+ | name | type |
191
+ | ---------- | ----- |
192
+ | product_id | `str` |
193
+
152
194
  ### `APIClient().instruments()` &rarr; `list[Instrument]`
153
195
 
154
- Fetch cloudnet instruments.
196
+ Fetch all instruments.
197
+
198
+ ### `APIClient().instrument()` &rarr; `ExtendedInstrument`
199
+
200
+ Fetch a single instruments.
201
+
202
+ Parameters:
203
+
204
+ | name | type |
205
+ | ---- | ----- |
206
+ | uuid | `str` |
207
+
208
+ ### `APIClient().models()` &rarr; `list[Model]`
209
+
210
+ Fetch all models.
211
+
212
+ ### `APIClient().instrument()` &rarr; `Model`
213
+
214
+ Fetch a single model.
215
+
216
+ Parameters:
217
+
218
+ | name | type |
219
+ | -------- | ----- |
220
+ | model_id | `str` |
221
+
222
+ ### `APIClient().versions()` &rarr; `list[VersionMetadata]`
223
+
224
+ Fetch information of all versions of a file.
225
+
226
+ Parameters:
227
+
228
+ | name | type |
229
+ | ---- | -------------------- |
230
+ | uuid | `str` or `uuid.UUID` |
155
231
 
156
232
  ### `APIClient().download(list[Metadata])` &rarr; `list[Path]`
157
233
 
@@ -18,14 +18,25 @@ from cloudnet_api_client import APIClient
18
18
 
19
19
  client = APIClient()
20
20
 
21
- sites = client.sites(type="cloudnet")
21
+ sites = client.sites()
22
+ site = client.site("hyytiala")
23
+
22
24
  products = client.products()
25
+ product = client.products("classification")
26
+
27
+ models = client.models()
28
+ model = client.model("ecmwf-open")
29
+
30
+ instruments = client.instruments()
31
+ instrument = client.instrument("d6bf209b-c48b-48a4-bbfb-fed713b27832")
23
32
 
24
- metadata = client.metadata(site_id="hyytiala", date="2021-01-01", product=["mwr", "radar"])
25
- file_paths = client.download(metadata, "data/")
33
+ file = client.file("405cc410-1f24-4ea9-bae8-da7f22be26cb")
26
34
 
27
- raw_metadata = client.raw_metadata(site_id="granada", date="2024-01", instrument_id="parsivel")
28
- file_paths = client.download(raw_metadata, "data_raw/")
35
+ files = client.files(site_id="hyytiala", date="2021-01-01", product_id=["mwr", "radar"])
36
+ file_paths = client.download(files, "data/")
37
+
38
+ raw_files = client.raw_files(site_id="granada", date="2024-01", instrument_id="parsivel")
39
+ file_paths = client.download(raw_files, "data_raw/")
29
40
  ```
30
41
 
31
42
  When downloading files inside Jupyter notebook (or similar environment), you have to use the asynchronous version:
@@ -36,7 +47,7 @@ file_paths = await client.adownload(metadata)
36
47
 
37
48
  ## Documentation
38
49
 
39
- ### `APIClient().metadata()` and `raw_metadata()` &rarr; `list[Metadata]`
50
+ ### `APIClient().files()` and `raw_files()` &rarr; `list[Metadata]`
40
51
 
41
52
  Fetch product and raw file metadata from the Cloudnet data portal.
42
53
 
@@ -54,15 +65,15 @@ Parameters:
54
65
  | instrument_id | `str` or `list[str]` | `None` | "rpg-fmcw-94" |
55
66
  | instrument_pid | `str` or `list[str]` | `None` | "https://hdl.handle.net/21.12132/3.191564170f8a4686" |
56
67
  | model_id | `str` or `list[str]` | `None` | "gdas1" |
57
- | product\* | `str` or `list[str]` | `None` | "classification" |
68
+ | product_id\* | `str` or `list[str]` | `None` | "classification" |
58
69
  | show_legacy\* | `bool` | `False` | |
59
70
  | filename_prefix\*\* | `str` or `list[str]` | `None` | "stare" |
60
71
  | filename_suffix\*\* | `str` or `list[str]` | `None` | ".lv1" |
61
72
  | status\*\* | `str` or `list[str]` | `None` | "created", "uploaded", "processed" or "invalid" |
62
73
 
63
- \* = only in `metadata()`
74
+ \* = only in `files()`
64
75
 
65
- \*\* = only in `raw_metadata()`
76
+ \*\* = only in `raw_files()`
66
77
 
67
78
  **Date Handling**
68
79
 
@@ -101,30 +112,93 @@ Parameters:
101
112
 
102
113
  \* = only with `RawMetadata`
103
114
 
115
+ ### `APIClient().file()` &rarr; `ProductMetadata`
116
+
117
+ Fetch metadata of a single file.
118
+
119
+ Parameters:
120
+
121
+ | name | type |
122
+ | ---- | -------------------- |
123
+ | uuid | `str` or `uuid.UUID` |
124
+
104
125
  ### `APIClient().sites()` &rarr; `list[Site]`
105
126
 
106
- Fetch cloudnet sites.
127
+ Fetch all sites.
107
128
 
108
129
  Parameters:
109
130
 
110
- | name | type | Choices | default |
111
- | ------- | -------------------- | ----------------------------------------- | ------- |
112
- | site_id | `str` | | `None` |
113
- | type | `str` or `list[str]` | "cloudnet", "campaign", "model", "hidden" | `None` |
131
+ | name | type | choices | default |
132
+ | ---- | ----- | ----------------------------------------- | ------- |
133
+ | type | `str` | "cloudnet", "campaign", "model", "hidden" | `None` |
134
+
135
+ ### `APIClient().site()` &rarr; `Site`
136
+
137
+ Fetch a single site.
138
+
139
+ Parameters:
140
+
141
+ | name | type |
142
+ | ------- | ----- |
143
+ | site_id | `str` |
114
144
 
115
145
  ### `APIClient().products()` &rarr; `list[Product]`
116
146
 
117
- Fetch cloudnet products.
147
+ Fetch all products.
118
148
 
119
149
  Parameters:
120
150
 
121
- | name | type | Choices | default |
151
+ | name | type | choices | default |
122
152
  | ---- | -------------------- | ----------------------------------------- | ------- |
123
153
  | type | `str` or `list[str]` | "instrument", "geophysical", "evaluation" | `None` |
124
154
 
155
+ ### `APIClient().product()` &rarr; `ExtendedProduct`
156
+
157
+ Fetch a single product.
158
+
159
+ Parameters:
160
+
161
+ | name | type |
162
+ | ---------- | ----- |
163
+ | product_id | `str` |
164
+
125
165
  ### `APIClient().instruments()` &rarr; `list[Instrument]`
126
166
 
127
- Fetch cloudnet instruments.
167
+ Fetch all instruments.
168
+
169
+ ### `APIClient().instrument()` &rarr; `ExtendedInstrument`
170
+
171
+ Fetch a single instruments.
172
+
173
+ Parameters:
174
+
175
+ | name | type |
176
+ | ---- | ----- |
177
+ | uuid | `str` |
178
+
179
+ ### `APIClient().models()` &rarr; `list[Model]`
180
+
181
+ Fetch all models.
182
+
183
+ ### `APIClient().instrument()` &rarr; `Model`
184
+
185
+ Fetch a single model.
186
+
187
+ Parameters:
188
+
189
+ | name | type |
190
+ | -------- | ----- |
191
+ | model_id | `str` |
192
+
193
+ ### `APIClient().versions()` &rarr; `list[VersionMetadata]`
194
+
195
+ Fetch information of all versions of a file.
196
+
197
+ Parameters:
198
+
199
+ | name | type |
200
+ | ---- | -------------------- |
201
+ | uuid | `str` or `uuid.UUID` |
128
202
 
129
203
  ### `APIClient().download(list[Metadata])` &rarr; `list[Path]`
130
204
 
@@ -0,0 +1,2 @@
1
+ from .client import APIClient as APIClient
2
+ from .utils import CloudnetAPIError as CloudnetAPIError