Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.

Commit 7e50ea5

Browse files
committed
fix concurrency
1 parent 5a67687 commit 7e50ea5

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

README.md

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Retrieve data:
7676
... "data_format": "grib",
7777
... "download_format": "unarchived"
7878
... }
79+
7980
>>> client.retrieve(collection_id, request, target="target_1.grib") # blocks
8081
'target_1.grib'
8182

@@ -91,6 +92,9 @@ Results(...)
9192
>>> remote.download("target_3.grib")
9293
'target_3.grib'
9394

95+
>>> client.download_results(remote.request_id, "target_4.grib") # blocks
96+
'target_4.grib'
97+
9498
```
9599

96100
List all collection IDs sorted by last update:
@@ -142,6 +146,23 @@ Remote(...)
142146

143147
```
144148

149+
Interact with results:
150+
151+
```python
152+
>>> results = client.get_results(remote.request_id)
153+
154+
>>> results.content_length > 0
155+
True
156+
>>> results.content_type
157+
'application/x-grib'
158+
>>> results.location
159+
'...'
160+
161+
>>> results.download("target_5.grib")
162+
'target_5.grib'
163+
164+
```
165+
145166
List all successful jobs, sorted by newest first:
146167

147168
```python
@@ -162,7 +183,7 @@ True
162183
Interact with a previously submitted job:
163184

164185
```python
165-
>>> remote = client.get_remote(request_ids[0])
186+
>>> remote = client.get_remote(remote.request_id)
166187

167188
>>> remote.collection_id == collection_id
168189
True
@@ -183,8 +204,8 @@ datetime.datetime(...)
183204
>>> remote.updated_at == remote.finished_at
184205
True
185206

186-
>>> remote.download("target_4.grib")
187-
'target_4.grib'
207+
>>> remote.download("target_6.grib")
208+
'target_6.grib'
188209

189210
>>> remote.get_results()
190211
Results(...)
@@ -194,42 +215,17 @@ Results(...)
194215

195216
```
196217

197-
Interact with results:
198-
199-
```python
200-
>>> results = client.get_results(request_ids[1])
201-
202-
>>> results.content_length > 0
203-
True
204-
>>> results.content_type
205-
'application/x-grib'
206-
>>> results.location
207-
'...'
208-
209-
>>> results.download("target_5.grib")
210-
'target_5.grib'
211-
212-
```
213-
214218
Apply constraints and find the number of available days in a given month:
215219

216220
```python
217-
>>> month = {"year": "2000", "month": "02"} # Leap year
221+
>>> month = {"year": "2000", "month": "02"}
218222
>>> constrained_request = client.apply_constraints(collection_id, month)
219223

220224
>>> len(constrained_request["day"])
221225
29
222226

223227
```
224228

225-
Utility methods:
226-
227-
```python
228-
>>> client.download_results(request_ids[1], "target_6.grib")
229-
'target_6.grib'
230-
231-
```
232-
233229
## Workflow for developers/contributors
234230

235231
For best experience create a new conda environment (e.g. DEVELOP) with Python 3.11:

0 commit comments

Comments
 (0)