windborne 1.0.5__py3-none-any.whl → 1.0.7__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.
- windborne/__init__.py +11 -4
- windborne/cli.py +168 -75
- windborne/data_api.py +629 -119
- windborne/utils.py +40 -16
- {windborne-1.0.5.dist-info → windborne-1.0.7.dist-info}/METADATA +1 -1
- windborne-1.0.7.dist-info/RECORD +11 -0
- windborne-1.0.5.dist-info/RECORD +0 -11
- {windborne-1.0.5.dist-info → windborne-1.0.7.dist-info}/WHEEL +0 -0
- {windborne-1.0.5.dist-info → windborne-1.0.7.dist-info}/entry_points.txt +0 -0
- {windborne-1.0.5.dist-info → windborne-1.0.7.dist-info}/top_level.txt +0 -0
windborne/__init__.py
CHANGED
@@ -8,8 +8,11 @@ from .utils import (
|
|
8
8
|
|
9
9
|
# Import Data API functions
|
10
10
|
from .data_api import (
|
11
|
-
|
12
|
-
|
11
|
+
get_observations_page,
|
12
|
+
observations,
|
13
|
+
|
14
|
+
get_super_observations_page,
|
15
|
+
super_observations,
|
13
16
|
|
14
17
|
poll_super_observations,
|
15
18
|
poll_observations,
|
@@ -44,8 +47,12 @@ __all__ = [
|
|
44
47
|
"convert_to_netcdf",
|
45
48
|
"sync_to_s3",
|
46
49
|
|
47
|
-
"
|
48
|
-
"
|
50
|
+
"get_observations_page",
|
51
|
+
"observations",
|
52
|
+
|
53
|
+
"get_super_observations_page",
|
54
|
+
"super_observations",
|
55
|
+
|
49
56
|
"poll_super_observations",
|
50
57
|
"poll_observations",
|
51
58
|
|
windborne/cli.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
import argparse
|
2
2
|
|
3
3
|
from . import (
|
4
|
+
super_observations,
|
5
|
+
observations,
|
6
|
+
|
7
|
+
get_observations_page,
|
8
|
+
get_super_observations_page,
|
9
|
+
|
4
10
|
poll_super_observations,
|
5
11
|
poll_observations,
|
6
|
-
|
7
|
-
get_super_observations,
|
12
|
+
|
8
13
|
get_flying_missions,
|
9
14
|
get_mission_launch_site,
|
10
15
|
get_predicted_path,
|
@@ -35,55 +40,80 @@ def main():
|
|
35
40
|
####################################################################################################################
|
36
41
|
# DATA API FUNCTIONS
|
37
42
|
####################################################################################################################
|
38
|
-
#
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
poll_parser.add_argument('-xl', '--max-latitude', type=float, help='Maximum latitude filter')
|
53
|
-
poll_parser.add_argument('-mg', '--min-longitude', type=float, help='Minimum longitude filter')
|
54
|
-
poll_parser.add_argument('-xg', '--max-longitude', type=float, help='Maximum longitude filter')
|
55
|
-
poll_parser.add_argument('-id', '--include-ids', action='store_true', help='Include observation IDs')
|
56
|
-
poll_parser.add_argument('-u', '--include-updated-at', action='store_true', help='Include update timestamps')
|
57
|
-
poll_parser.add_argument('-i', '--interval', type=int, default=60, help='Polling interval in seconds')
|
58
|
-
poll_parser.add_argument('-b', '--bucket-hours', type=float, default=6.0, help='Hours per bucket')
|
59
|
-
poll_parser.add_argument('output', help='Save output to a single file (filename.csv, filename.json or filename.little_r) or to multiple files (csv or little_r)')
|
60
|
-
|
61
|
-
|
62
|
-
# Get Observations Command
|
63
|
-
obs_parser = subparsers.add_parser('observations', help='Get observations with filters')
|
64
|
-
obs_parser.add_argument('since', help='Get observations since this time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
65
|
-
obs_parser.add_argument('-mt', '--min-time', help='Minimum time filter (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
66
|
-
obs_parser.add_argument('-xt', '--max-time', help='Maximum time filter (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
67
|
-
obs_parser.add_argument('-m', '--mission-id', help='Filter by mission ID')
|
43
|
+
# Super Observations Command
|
44
|
+
super_obs_parser = subparsers.add_parser('super-observations', help='Poll super observations within a time range')
|
45
|
+
super_obs_parser.add_argument('start_time', help='Starting time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
46
|
+
super_obs_parser.add_argument('end_time', help='End time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)', nargs='?', default=None)
|
47
|
+
super_obs_parser.add_argument('-i', '--interval', type=int, default=60, help='Polling interval in seconds')
|
48
|
+
super_obs_parser.add_argument('-b', '--bucket-hours', type=float, default=6.0, help='Hours per bucket')
|
49
|
+
super_obs_parser.add_argument('-d', '--output-dir', help='Directory path where the separate files should be saved. If not provided, files will be saved in current directory.')
|
50
|
+
super_obs_parser.add_argument('output', help='Save output to a single file (filename.csv, filename.json or filename.little_r) or to or to multiple files (csv, json, netcdf or little_r)')
|
51
|
+
|
52
|
+
# Observations Command
|
53
|
+
obs_parser = subparsers.add_parser('observations', help='Poll observations within a time range')
|
54
|
+
obs_parser.add_argument('start_time', help='Starting time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
55
|
+
obs_parser.add_argument('end_time', help='End time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)', nargs='?', default=None)
|
56
|
+
obs_parser.add_argument('-m', '--mission-id', help='Filter observations by mission ID')
|
68
57
|
obs_parser.add_argument('-ml', '--min-latitude', type=float, help='Minimum latitude filter')
|
69
58
|
obs_parser.add_argument('-xl', '--max-latitude', type=float, help='Maximum latitude filter')
|
70
59
|
obs_parser.add_argument('-mg', '--min-longitude', type=float, help='Minimum longitude filter')
|
71
60
|
obs_parser.add_argument('-xg', '--max-longitude', type=float, help='Maximum longitude filter')
|
72
61
|
obs_parser.add_argument('-id', '--include-ids', action='store_true', help='Include observation IDs')
|
73
|
-
obs_parser.add_argument('-mn', '--include-mission-name', action='store_true', help='Include mission names')
|
74
62
|
obs_parser.add_argument('-u', '--include-updated-at', action='store_true', help='Include update timestamps')
|
75
|
-
obs_parser.add_argument('
|
63
|
+
obs_parser.add_argument('-i', '--interval', type=int, default=60, help='Polling interval in seconds')
|
64
|
+
obs_parser.add_argument('-b', '--bucket-hours', type=float, default=6.0, help='Hours per bucket')
|
65
|
+
obs_parser.add_argument('-d', '--output-dir', help='Directory path where the separate files should be saved. If not provided, files will be saved in current directory.')
|
66
|
+
obs_parser.add_argument('output', help='Save output to a single file (filename.csv, filename.json or filename.little_r) or to multiple files (csv, json, netcdf or little_r)')
|
67
|
+
|
68
|
+
|
69
|
+
# Get Observations Page Command
|
70
|
+
obs_page_parser = subparsers.add_parser('observations-page', help='Get observations page with filters')
|
71
|
+
obs_page_parser.add_argument('since', help='Get observations since this time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
72
|
+
obs_page_parser.add_argument('-mt', '--min-time', help='Minimum time filter (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
73
|
+
obs_page_parser.add_argument('-xt', '--max-time', help='Maximum time filter (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
74
|
+
obs_page_parser.add_argument('-m', '--mission-id', help='Filter by mission ID')
|
75
|
+
obs_page_parser.add_argument('-ml', '--min-latitude', type=float, help='Minimum latitude filter')
|
76
|
+
obs_page_parser.add_argument('-xl', '--max-latitude', type=float, help='Maximum latitude filter')
|
77
|
+
obs_page_parser.add_argument('-mg', '--min-longitude', type=float, help='Minimum longitude filter')
|
78
|
+
obs_page_parser.add_argument('-xg', '--max-longitude', type=float, help='Maximum longitude filter')
|
79
|
+
obs_page_parser.add_argument('-id', '--include-ids', action='store_true', help='Include observation IDs')
|
80
|
+
obs_page_parser.add_argument('-mn', '--include-mission-name', action='store_true', help='Include mission names')
|
81
|
+
obs_page_parser.add_argument('-u', '--include-updated-at', action='store_true', help='Include update timestamps')
|
82
|
+
obs_page_parser.add_argument('output', nargs='?', help='Output file')
|
76
83
|
|
77
84
|
# Get Super Observations Command
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
super_obs_page_parser = subparsers.add_parser('super-observations-page', help='Get super observations page with filters')
|
86
|
+
super_obs_page_parser.add_argument('since', help='Get super observations page since this time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
87
|
+
super_obs_page_parser.add_argument('-mt', '--min-time', help='Minimum time filter (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
88
|
+
super_obs_page_parser.add_argument('-xt', '--max-time', help='Maximum time filter (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
89
|
+
super_obs_page_parser.add_argument('-m', '--mission-id', help='Filter by mission ID')
|
90
|
+
super_obs_page_parser.add_argument('-id', '--include-ids', action='store_true', help='Include observation IDs')
|
91
|
+
super_obs_page_parser.add_argument('-mn', '--include-mission-name', action='store_true', help='Include mission names')
|
92
|
+
super_obs_page_parser.add_argument('-u', '--include-updated-at', action='store_true', help='Include update timestamps')
|
93
|
+
super_obs_page_parser.add_argument('output', nargs='?', help='Output file')
|
94
|
+
|
95
|
+
# Poll Super Observations Command
|
96
|
+
poll_super_obs_parser = subparsers.add_parser('poll-super-observations', help='Continuously polls for super observations and saves to files in specified format.')
|
97
|
+
poll_super_obs_parser.add_argument('start_time', help='Starting time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
98
|
+
poll_super_obs_parser.add_argument('-i', '--interval', type=int, default=60, help='Polling interval in seconds')
|
99
|
+
poll_super_obs_parser.add_argument('-b', '--bucket-hours', type=float, default=6.0, help='Hours per bucket')
|
100
|
+
poll_super_obs_parser.add_argument('-d', '--output-dir', help='Directory path where the separate files should be saved. If not provided, files will be saved in current directory.')
|
101
|
+
poll_super_obs_parser.add_argument('output', help='Save output to multiple files (csv, json, netcdf or little_r)')
|
102
|
+
|
103
|
+
# Poll Observations Command
|
104
|
+
poll_obs_parser = subparsers.add_parser('poll-observations', help='Continuously polls for observations and saves to files in specified format.')
|
105
|
+
poll_obs_parser.add_argument('start_time', help='Starting time (YYYY-MM-DD_HH:MM, "YYYY-MM-DD HH:MM:SS" or YYYY-MM-DDTHH:MM:SS.fffZ)')
|
106
|
+
poll_obs_parser.add_argument('-m', '--mission-id', help='Filter observations by mission ID')
|
107
|
+
poll_obs_parser.add_argument('-ml', '--min-latitude', type=float, help='Minimum latitude filter')
|
108
|
+
poll_obs_parser.add_argument('-xl', '--max-latitude', type=float, help='Maximum latitude filter')
|
109
|
+
poll_obs_parser.add_argument('-mg', '--min-longitude', type=float, help='Minimum longitude filter')
|
110
|
+
poll_obs_parser.add_argument('-xg', '--max-longitude', type=float, help='Maximum longitude filter')
|
111
|
+
poll_obs_parser.add_argument('-id', '--include-ids', action='store_true', help='Include observation IDs')
|
112
|
+
poll_obs_parser.add_argument('-u', '--include-updated-at', action='store_true', help='Include update timestamps')
|
113
|
+
poll_obs_parser.add_argument('-i', '--interval', type=int, default=60, help='Polling interval in seconds')
|
114
|
+
poll_obs_parser.add_argument('-b', '--bucket-hours', type=float, default=6.0, help='Hours per bucket')
|
115
|
+
poll_obs_parser.add_argument('-d', '--output-dir', help='Directory path where the separate files should be saved. If not provided, files will be saved in current directory.')
|
116
|
+
poll_obs_parser.add_argument('output', help='Save output to multiple files (csv, json, netcdf or little_r)')
|
87
117
|
|
88
118
|
# Get Flying Missions Command
|
89
119
|
flying_parser = subparsers.add_parser('flying-missions', help='Get currently flying missions')
|
@@ -198,8 +228,8 @@ def main():
|
|
198
228
|
####################################################################################################################
|
199
229
|
# DATA API FUNCTIONS CALLED
|
200
230
|
####################################################################################################################
|
201
|
-
if args.command == '
|
202
|
-
# Error handling is performed within
|
231
|
+
if args.command == 'super-observations':
|
232
|
+
# Error handling is performed within super_observations
|
203
233
|
# and we display the appropriate error messages
|
204
234
|
# No need to implement them here
|
205
235
|
|
@@ -207,22 +237,56 @@ def main():
|
|
207
237
|
if '.' in args.output:
|
208
238
|
save_to_file = args.output
|
209
239
|
output_format = None
|
240
|
+
output_dir = None
|
210
241
|
# In case user wants separate file for each data from missions (buckets)
|
211
242
|
else:
|
212
243
|
save_to_file = None
|
213
244
|
output_format = args.output
|
245
|
+
output_dir = args.output_dir
|
214
246
|
|
215
|
-
|
247
|
+
super_observations(
|
216
248
|
start_time=args.start_time,
|
217
249
|
end_time=args.end_time,
|
218
250
|
interval=args.interval,
|
219
251
|
save_to_file=save_to_file,
|
220
252
|
bucket_hours=args.bucket_hours,
|
253
|
+
output_dir=output_dir,
|
254
|
+
output_format=output_format
|
255
|
+
)
|
256
|
+
|
257
|
+
elif args.command == 'poll-super-observations':
|
258
|
+
output_format = args.output
|
259
|
+
output_dir = args.output_dir
|
260
|
+
|
261
|
+
poll_super_observations(
|
262
|
+
start_time=args.start_time,
|
263
|
+
interval=args.interval,
|
264
|
+
bucket_hours=args.bucket_hours,
|
265
|
+
output_dir=output_dir,
|
221
266
|
output_format=output_format
|
222
267
|
)
|
223
268
|
|
224
269
|
elif args.command == 'poll-observations':
|
225
|
-
|
270
|
+
output_format = args.output
|
271
|
+
output_dir = args.output_dir
|
272
|
+
|
273
|
+
poll_observations(
|
274
|
+
start_time=args.start_time,
|
275
|
+
include_ids=args.include_ids,
|
276
|
+
include_updated_at=args.include_updated_at,
|
277
|
+
mission_id=args.mission_id,
|
278
|
+
min_latitude=args.min_latitude,
|
279
|
+
max_latitude=args.max_latitude,
|
280
|
+
min_longitude=args.min_longitude,
|
281
|
+
max_longitude=args.max_longitude,
|
282
|
+
interval=args.interval,
|
283
|
+
bucket_hours=args.bucket_hours,
|
284
|
+
output_dir=output_dir,
|
285
|
+
output_format=output_format
|
286
|
+
)
|
287
|
+
|
288
|
+
elif args.command == 'observations':
|
289
|
+
# Error handling is performed within observations
|
226
290
|
# and we display the appropriate error messages
|
227
291
|
# No need to implement them here
|
228
292
|
|
@@ -230,12 +294,14 @@ def main():
|
|
230
294
|
if '.' in args.output:
|
231
295
|
save_to_file = args.output
|
232
296
|
output_format = None
|
297
|
+
output_dir = None
|
233
298
|
# In case user wants separate file for each data from missions (buckets)
|
234
299
|
else:
|
235
300
|
save_to_file = None
|
236
301
|
output_format = args.output
|
302
|
+
output_dir = args.output_dir
|
237
303
|
|
238
|
-
|
304
|
+
observations(
|
239
305
|
start_time=args.start_time,
|
240
306
|
end_time=args.end_time,
|
241
307
|
include_ids=args.include_ids,
|
@@ -248,36 +314,63 @@ def main():
|
|
248
314
|
interval=args.interval,
|
249
315
|
save_to_file=save_to_file,
|
250
316
|
bucket_hours=args.bucket_hours,
|
317
|
+
output_dir=output_dir,
|
251
318
|
output_format=output_format
|
252
319
|
)
|
253
320
|
|
254
|
-
elif args.command == 'observations':
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
321
|
+
elif args.command == 'observations-page':
|
322
|
+
if not args.output:
|
323
|
+
pprint(get_observations_page(
|
324
|
+
since=args.since,
|
325
|
+
min_time=args.min_time,
|
326
|
+
max_time=args.max_time,
|
327
|
+
include_ids=args.include_ids,
|
328
|
+
include_mission_name=args.include_mission_name,
|
329
|
+
include_updated_at=args.include_updated_at,
|
330
|
+
mission_id=args.mission_id,
|
331
|
+
min_latitude=args.min_latitude,
|
332
|
+
max_latitude=args.max_latitude,
|
333
|
+
min_longitude=args.min_longitude,
|
334
|
+
max_longitude=args.max_longitude
|
335
|
+
))
|
336
|
+
else:
|
337
|
+
get_observations_page(
|
338
|
+
since=args.since,
|
339
|
+
min_time=args.min_time,
|
340
|
+
max_time=args.max_time,
|
341
|
+
include_ids=args.include_ids,
|
342
|
+
include_mission_name=args.include_mission_name,
|
343
|
+
include_updated_at=args.include_updated_at,
|
344
|
+
mission_id=args.mission_id,
|
345
|
+
min_latitude=args.min_latitude,
|
346
|
+
max_latitude=args.max_latitude,
|
347
|
+
min_longitude=args.min_longitude,
|
348
|
+
max_longitude=args.max_longitude,
|
349
|
+
save_to_file=args.output
|
350
|
+
)
|
351
|
+
|
352
|
+
elif args.command == 'super-observations-page':
|
353
|
+
if not args.output:
|
354
|
+
pprint(get_super_observations_page(
|
355
|
+
since=args.since,
|
356
|
+
min_time=args.min_time,
|
357
|
+
max_time=args.max_time,
|
358
|
+
include_ids=args.include_ids,
|
359
|
+
include_mission_name=args.include_mission_name,
|
360
|
+
include_updated_at=args.include_updated_at,
|
361
|
+
mission_id=args.mission_id
|
362
|
+
))
|
363
|
+
else:
|
364
|
+
get_super_observations_page(
|
365
|
+
since=args.since,
|
366
|
+
min_time=args.min_time,
|
367
|
+
max_time=args.max_time,
|
368
|
+
include_ids=args.include_ids,
|
369
|
+
include_mission_name=args.include_mission_name,
|
370
|
+
include_updated_at=args.include_updated_at,
|
371
|
+
mission_id=args.mission_id,
|
372
|
+
save_to_file=args.output
|
373
|
+
)
|
281
374
|
|
282
375
|
elif args.command == 'flying-missions':
|
283
376
|
get_flying_missions(cli=True, save_to_file=args.output)
|