cloudnet-api-client 0.8.0__tar.gz → 0.9.1__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.
@@ -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.9.1 – 2025-06-19
9
+
10
+ - Support mobile sites without latitude and longitude
11
+ - Fix metadata fetching when `instrument_pid` defined
12
+
13
+ ## 0.9.0 – 2025-05-14
14
+
15
+ - By default download to current folder
16
+
8
17
  ## 0.8.0 – 2025-05-14
9
18
 
10
19
  - Add site to metadata responses
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudnet-api-client
3
- Version: 0.8.0
3
+ Version: 0.9.1
4
4
  Summary: Cloudnet API client
5
5
  Author-email: Simo Tukiainen <simo.tukiainen@fmi.fi>
6
6
  License-File: LICENSE
@@ -48,11 +48,17 @@ client = APIClient()
48
48
  sites = client.sites(type="cloudnet")
49
49
  products = client.products()
50
50
 
51
- metadata = client.metadata("hyytiala", "2021-01-01", product=["mwr", "radar"])
52
- client.download(metadata, "data/")
51
+ metadata = client.metadata(site_id="hyytiala", date="2021-01-01", product=["mwr", "radar"])
52
+ file_paths = client.download(metadata, "data/")
53
53
 
54
- raw_metadata = client.raw_metadata("granada", date="2024-01", instrument_id="parsivel")
55
- client.download(raw_metadata, "data_raw/")
54
+ raw_metadata = client.raw_metadata(site_id="granada", date="2024-01", instrument_id="parsivel")
55
+ file_paths = client.download(raw_metadata, "data_raw/")
56
+ ```
57
+
58
+ When downloading files inside Jupyter notebook (or similar environment), you have to use the asynchronous version:
59
+
60
+ ```python
61
+ file_paths = await client.adownload(metadata)
56
62
  ```
57
63
 
58
64
  ## Documentation
@@ -152,13 +158,13 @@ Download files from the fetched metadata.
152
158
 
153
159
  Parameters:
154
160
 
155
- | name | type | default |
156
- | ----------------- | ---------------------------------------------- | ------- |
157
- | metadata | `list[RawMetadata]` or `list[ProductMetadata]` | |
158
- | output_directory | `PathLike` or `str` | |
159
- | concurrency_limit | `int` | 5 |
160
- | progress | `bool` or `None` | `None` |
161
- | validate_checksum | `bool` | `False` |
161
+ | name | type | default |
162
+ | ----------------- | ---------------------------------------------- | ----------------- |
163
+ | metadata | `list[RawMetadata]` or `list[ProductMetadata]` | |
164
+ | output_directory | `PathLike` or `str` | Current directory |
165
+ | concurrency_limit | `int` | 5 |
166
+ | progress | `bool` or `None` | `None` |
167
+ | validate_checksum | `bool` | `False` |
162
168
 
163
169
  There's also an asynchronous version of this function:
164
170
  `cloudnet_api_client.adownload`. It's useful for usage inside Jupyter notebook.
@@ -21,11 +21,17 @@ client = APIClient()
21
21
  sites = client.sites(type="cloudnet")
22
22
  products = client.products()
23
23
 
24
- metadata = client.metadata("hyytiala", "2021-01-01", product=["mwr", "radar"])
25
- client.download(metadata, "data/")
24
+ metadata = client.metadata(site_id="hyytiala", date="2021-01-01", product=["mwr", "radar"])
25
+ file_paths = client.download(metadata, "data/")
26
26
 
27
- raw_metadata = client.raw_metadata("granada", date="2024-01", instrument_id="parsivel")
28
- client.download(raw_metadata, "data_raw/")
27
+ raw_metadata = client.raw_metadata(site_id="granada", date="2024-01", instrument_id="parsivel")
28
+ file_paths = client.download(raw_metadata, "data_raw/")
29
+ ```
30
+
31
+ When downloading files inside Jupyter notebook (or similar environment), you have to use the asynchronous version:
32
+
33
+ ```python
34
+ file_paths = await client.adownload(metadata)
29
35
  ```
30
36
 
31
37
  ## Documentation
@@ -125,13 +131,13 @@ Download files from the fetched metadata.
125
131
 
126
132
  Parameters:
127
133
 
128
- | name | type | default |
129
- | ----------------- | ---------------------------------------------- | ------- |
130
- | metadata | `list[RawMetadata]` or `list[ProductMetadata]` | |
131
- | output_directory | `PathLike` or `str` | |
132
- | concurrency_limit | `int` | 5 |
133
- | progress | `bool` or `None` | `None` |
134
- | validate_checksum | `bool` | `False` |
134
+ | name | type | default |
135
+ | ----------------- | ---------------------------------------------- | ----------------- |
136
+ | metadata | `list[RawMetadata]` or `list[ProductMetadata]` | |
137
+ | output_directory | `PathLike` or `str` | Current directory |
138
+ | concurrency_limit | `int` | 5 |
139
+ | progress | `bool` or `None` | `None` |
140
+ | validate_checksum | `bool` | `False` |
135
141
 
136
142
  There's also an asynchronous version of this function:
137
143
  `cloudnet_api_client.adownload`. It's useful for usage inside Jupyter notebook.
@@ -111,17 +111,18 @@ class APIClient:
111
111
 
112
112
  _check_params(params, ("showLegacy",))
113
113
 
114
- no_instrument = not instrument_id or instrument_pid
115
- if no_instrument and (not product and model_id):
114
+ no_instrument = instrument_id is None and instrument_pid is None
115
+
116
+ if no_instrument and (product is None and model_id is not None):
116
117
  files_res = []
117
118
  else:
118
119
  files_res = self._get_response("files", params)
119
120
 
120
121
  # Add model files if requested
121
122
  if (
122
- (not product and no_instrument)
123
- or (product and "model" in product)
124
- or (model_id and (not product or "model" in product))
123
+ (product is None and no_instrument)
124
+ or (product is not None and "model" in product)
125
+ or (model_id is not None and (product is None or "model" in product))
125
126
  ):
126
127
  for key in ("showLegacy", "product", "instrument", "instrumentPid"):
127
128
  del params[key]
@@ -193,7 +194,7 @@ class APIClient:
193
194
  def download(
194
195
  self,
195
196
  metadata: MetadataList,
196
- output_directory: str | PathLike,
197
+ output_directory: str | PathLike = ".",
197
198
  concurrency_limit: int = 5,
198
199
  progress: bool | None = None,
199
200
  validate_checksum: bool = False,
@@ -211,7 +212,7 @@ class APIClient:
211
212
  async def adownload(
212
213
  self,
213
214
  metadata: MetadataList,
214
- output_directory: str | PathLike,
215
+ output_directory: str | PathLike = ".",
215
216
  concurrency_limit: int = 5,
216
217
  progress: bool | None = None,
217
218
  validate_checksum: bool = False,
@@ -482,9 +483,9 @@ def _create_site_object(metadata: dict) -> Site:
482
483
  id=metadata["id"],
483
484
  human_readable_name=metadata["humanReadableName"],
484
485
  station_name=metadata["stationName"],
485
- latitude=float(metadata["latitude"]),
486
- longitude=float(metadata["longitude"]),
487
- altitude=float(metadata["altitude"]),
486
+ latitude=metadata["latitude"],
487
+ longitude=metadata["longitude"],
488
+ altitude=metadata["altitude"],
488
489
  dvas_id=metadata["dvasId"],
489
490
  actris_id=metadata["actrisId"],
490
491
  country=metadata["country"],
@@ -13,9 +13,9 @@ class Site:
13
13
  id: str
14
14
  human_readable_name: str
15
15
  station_name: str | None
16
- latitude: float
17
- longitude: float
18
- altitude: float
16
+ latitude: float | None
17
+ longitude: float | None
18
+ altitude: int
19
19
  dvas_id: str | None
20
20
  actris_id: int | None
21
21
  country: str
@@ -0,0 +1 @@
1
+ __version__ = "0.9.1"
@@ -1 +0,0 @@
1
- __version__ = "0.8.0"