Imports

In [23]:
import pyaurorax
import datetime
import pprint
import pandas as pd

Search for conjunctions

In [5]:
# search for conjunctions between any THEMIS-ASI intrument and any Swarm instrument
start = datetime.datetime(2020, 1, 1, 0, 0, 0)
end = datetime.datetime(2020, 1, 1, 6, 59, 59)
ground = [
    {"programs": ["themis-asi"]}
]
space = [
    {"programs": ["swarm"]}
]
distance = 500
In [3]:
# perform search
s = pyaurorax.conjunctions.search(start,
                                  end,
                                  distance,
                                  ground=ground,
                                  space=space,
                                  verbose=True)
[2022-01-14 01:11:55.871260] Search object created
[2022-01-14 01:11:55.978327] Request submitted
[2022-01-14 01:11:55.978520] Request ID: 911be71f-589b-4c6a-9a7d-217805c7e2f0
[2022-01-14 01:11:55.978535] Request details available at: https://api.aurorax.space/api/v1/conjunctions/requests/911be71f-589b-4c6a-9a7d-217805c7e2f0
[2022-01-14 01:11:55.979484] Waiting for data ...
[2022-01-14 01:11:57.054873] Checking for data ...
[2022-01-14 01:11:57.119220] Data is now available
[2022-01-14 01:11:57.119337] Retrieving data ...
[2022-01-14 01:11:57.241491] Retrieved 373.6 kB of data containing 49 records
In [4]:
# output data as a pandas dataframe
conjunctions = [c.__dict__ for c in s.data]
df = pd.DataFrame(conjunctions)
df.sort_values("start")
Out[4]:
conjunction_type start end data_sources min_distance max_distance events
43 nbtrace 2020-01-01 00:08:00 2020-01-01 00:09:00 [DataSource(identifier=53, program='themis-asi... 206.588207 260.819127 [{'conjunction_type': 'nbtrace', 'e1_source': ...
15 nbtrace 2020-01-01 00:08:00 2020-01-01 00:09:00 [DataSource(identifier=53, program='themis-asi... 192.029390 336.631805 [{'conjunction_type': 'nbtrace', 'e1_source': ...
11 nbtrace 2020-01-01 00:10:00 2020-01-01 00:11:00 [DataSource(identifier=51, program='themis-asi... 282.877438 285.744881 [{'conjunction_type': 'nbtrace', 'e1_source': ...
38 nbtrace 2020-01-01 00:10:00 2020-01-01 00:11:00 [DataSource(identifier=51, program='themis-asi... 195.554240 298.419001 [{'conjunction_type': 'nbtrace', 'e1_source': ...
30 nbtrace 2020-01-01 00:11:00 2020-01-01 00:13:00 [DataSource(identifier=46, program='themis-asi... 53.391843 441.814398 [{'conjunction_type': 'nbtrace', 'e1_source': ...
3 nbtrace 2020-01-01 00:12:00 2020-01-01 00:13:00 [DataSource(identifier=46, program='themis-asi... 89.436436 332.998863 [{'conjunction_type': 'nbtrace', 'e1_source': ...
17 nbtrace 2020-01-01 00:13:00 2020-01-01 00:13:00 [DataSource(identifier=54, program='themis-asi... 401.883399 401.883399 [{'conjunction_type': 'nbtrace', 'e1_source': ...
37 nbtrace 2020-01-01 00:13:00 2020-01-01 00:14:00 [DataSource(identifier=50, program='themis-asi... 215.337413 330.343161 [{'conjunction_type': 'nbtrace', 'e1_source': ...
10 nbtrace 2020-01-01 00:13:00 2020-01-01 00:15:00 [DataSource(identifier=50, program='themis-asi... 105.345328 488.349867 [{'conjunction_type': 'nbtrace', 'e1_source': ...
7 nbtrace 2020-01-01 00:44:00 2020-01-01 00:46:00 [DataSource(identifier=48, program='themis-asi... 114.890751 488.203200 [{'conjunction_type': 'nbtrace', 'e1_source': ...
33 nbtrace 2020-01-01 00:44:00 2020-01-01 00:45:00 [DataSource(identifier=48, program='themis-asi... 176.558673 365.537448 [{'conjunction_type': 'nbtrace', 'e1_source': ...
41 nbtrace 2020-01-01 00:46:00 2020-01-01 00:47:00 [DataSource(identifier=52, program='themis-asi... 275.851379 345.489291 [{'conjunction_type': 'nbtrace', 'e1_source': ...
13 nbtrace 2020-01-01 00:46:00 2020-01-01 00:47:00 [DataSource(identifier=52, program='themis-asi... 216.790371 385.043153 [{'conjunction_type': 'nbtrace', 'e1_source': ...
8 nbtrace 2020-01-01 00:47:00 2020-01-01 00:48:00 [DataSource(identifier=49, program='themis-asi... 332.998445 461.144528 [{'conjunction_type': 'nbtrace', 'e1_source': ...
34 nbtrace 2020-01-01 00:47:00 2020-01-01 00:48:00 [DataSource(identifier=49, program='themis-asi... 355.233113 396.151714 [{'conjunction_type': 'nbtrace', 'e1_source': ...
35 nbtrace 2020-01-01 00:50:00 2020-01-01 00:51:00 [DataSource(identifier=51, program='themis-asi... 117.379897 241.904346 [{'conjunction_type': 'nbtrace', 'e1_source': ...
24 nbtrace 2020-01-01 00:52:00 2020-01-01 00:52:00 [DataSource(identifier=46, program='themis-asi... 460.151231 460.151231 [{'conjunction_type': 'nbtrace', 'e1_source': ...
42 nbtrace 2020-01-01 00:53:00 2020-01-01 00:53:00 [DataSource(identifier=54, program='themis-asi... 430.171520 430.171520 [{'conjunction_type': 'nbtrace', 'e1_source': ...
21 nbtrace 2020-01-01 00:54:00 2020-01-01 00:55:00 [DataSource(identifier=44, program='themis-asi... 265.640223 333.568278 [{'conjunction_type': 'nbtrace', 'e1_source': ...
27 nbtrace 2020-01-01 01:29:00 2020-01-01 01:29:00 [DataSource(identifier=47, program='themis-asi... 493.180071 493.180071 [{'conjunction_type': 'nbtrace', 'e1_source': ...
2 nbtrace 2020-01-01 01:43:00 2020-01-01 01:45:00 [DataSource(identifier=45, program='themis-asi... 131.293608 465.392815 [{'conjunction_type': 'nbtrace', 'e1_source': ...
26 nbtrace 2020-01-01 01:43:00 2020-01-01 01:45:00 [DataSource(identifier=45, program='themis-asi... 198.022033 490.128034 [{'conjunction_type': 'nbtrace', 'e1_source': ...
23 nbtrace 2020-01-01 01:45:00 2020-01-01 01:46:00 [DataSource(identifier=44, program='themis-asi... 205.885002 420.474697 [{'conjunction_type': 'nbtrace', 'e1_source': ...
0 nbtrace 2020-01-01 01:46:00 2020-01-01 01:47:00 [DataSource(identifier=44, program='themis-asi... 284.420850 493.197476 [{'conjunction_type': 'nbtrace', 'e1_source': ...
36 nbtrace 2020-01-01 02:17:00 2020-01-01 02:18:00 [DataSource(identifier=50, program='themis-asi... 375.455878 459.284383 [{'conjunction_type': 'nbtrace', 'e1_source': ...
9 nbtrace 2020-01-01 02:17:00 2020-01-01 02:18:00 [DataSource(identifier=50, program='themis-asi... 347.656216 390.934039 [{'conjunction_type': 'nbtrace', 'e1_source': ...
40 nbtrace 2020-01-01 02:19:00 2020-01-01 02:20:00 [DataSource(identifier=52, program='themis-asi... 197.889134 494.591201 [{'conjunction_type': 'nbtrace', 'e1_source': ...
14 nbtrace 2020-01-01 02:20:00 2020-01-01 02:21:00 [DataSource(identifier=52, program='themis-asi... 228.831208 480.716179 [{'conjunction_type': 'nbtrace', 'e1_source': ...
22 nbtrace 2020-01-01 02:28:00 2020-01-01 02:29:00 [DataSource(identifier=45, program='themis-asi... 156.167998 288.063655 [{'conjunction_type': 'nbtrace', 'e1_source': ...
5 nbtrace 2020-01-01 03:15:00 2020-01-01 03:16:00 [DataSource(identifier=47, program='themis-asi... 412.812856 489.362899 [{'conjunction_type': 'nbtrace', 'e1_source': ...
32 nbtrace 2020-01-01 03:15:00 2020-01-01 03:16:00 [DataSource(identifier=47, program='themis-asi... 385.355069 414.231784 [{'conjunction_type': 'nbtrace', 'e1_source': ...
47 nbtrace 2020-01-01 03:17:00 2020-01-01 03:18:00 [DataSource(identifier=64, program='themis-asi... 224.424121 433.727070 [{'conjunction_type': 'nbtrace', 'e1_source': ...
18 nbtrace 2020-01-01 03:17:00 2020-01-01 03:18:00 [DataSource(identifier=64, program='themis-asi... 186.992979 344.140279 [{'conjunction_type': 'nbtrace', 'e1_source': ...
16 nbtrace 2020-01-01 03:50:00 2020-01-01 03:51:00 [DataSource(identifier=54, program='themis-asi... 106.219997 351.707007 [{'conjunction_type': 'nbtrace', 'e1_source': ...
44 nbtrace 2020-01-01 03:50:00 2020-01-01 03:51:00 [DataSource(identifier=54, program='themis-asi... 127.208169 287.958853 [{'conjunction_type': 'nbtrace', 'e1_source': ...
29 nbtrace 2020-01-01 03:51:00 2020-01-01 03:52:00 [DataSource(identifier=46, program='themis-asi... 139.462865 365.173735 [{'conjunction_type': 'nbtrace', 'e1_source': ...
4 nbtrace 2020-01-01 03:51:00 2020-01-01 03:52:00 [DataSource(identifier=46, program='themis-asi... 142.425348 433.674543 [{'conjunction_type': 'nbtrace', 'e1_source': ...
12 nbtrace 2020-01-01 03:53:00 2020-01-01 03:53:00 [DataSource(identifier=51, program='themis-asi... 219.412264 219.412264 [{'conjunction_type': 'nbtrace', 'e1_source': ...
39 nbtrace 2020-01-01 03:53:00 2020-01-01 03:53:00 [DataSource(identifier=51, program='themis-asi... 190.663238 190.663238 [{'conjunction_type': 'nbtrace', 'e1_source': ...
28 nbtrace 2020-01-01 04:04:00 2020-01-01 04:04:00 [DataSource(identifier=47, program='themis-asi... 368.898466 368.898466 [{'conjunction_type': 'nbtrace', 'e1_source': ...
45 nbtrace 2020-01-01 04:05:00 2020-01-01 04:06:00 [DataSource(identifier=65, program='themis-asi... 236.205457 341.436305 [{'conjunction_type': 'nbtrace', 'e1_source': ...
20 nbtrace 2020-01-01 04:49:00 2020-01-01 04:50:00 [DataSource(identifier=65, program='themis-asi... 323.719101 352.655457 [{'conjunction_type': 'nbtrace', 'e1_source': ...
48 nbtrace 2020-01-01 04:49:00 2020-01-01 04:50:00 [DataSource(identifier=65, program='themis-asi... 244.886114 355.591219 [{'conjunction_type': 'nbtrace', 'e1_source': ...
1 nbtrace 2020-01-01 05:23:00 2020-01-01 05:23:00 [DataSource(identifier=45, program='themis-asi... 336.102854 336.102854 [{'conjunction_type': 'nbtrace', 'e1_source': ...
25 nbtrace 2020-01-01 05:23:00 2020-01-01 05:23:00 [DataSource(identifier=45, program='themis-asi... 389.724805 389.724805 [{'conjunction_type': 'nbtrace', 'e1_source': ...
19 nbtrace 2020-01-01 06:54:00 2020-01-01 06:55:00 [DataSource(identifier=64, program='themis-asi... 256.732039 421.977224 [{'conjunction_type': 'nbtrace', 'e1_source': ...
46 nbtrace 2020-01-01 06:54:00 2020-01-01 06:55:00 [DataSource(identifier=64, program='themis-asi... 253.959112 302.213217 [{'conjunction_type': 'nbtrace', 'e1_source': ...
31 nbtrace 2020-01-01 06:56:00 2020-01-01 06:56:00 [DataSource(identifier=47, program='themis-asi... 196.531937 196.531937 [{'conjunction_type': 'nbtrace', 'e1_source': ...
6 nbtrace 2020-01-01 06:56:00 2020-01-01 06:56:00 [DataSource(identifier=47, program='themis-asi... 212.741402 212.741402 [{'conjunction_type': 'nbtrace', 'e1_source': ...

Search for conjunctions with metadata filters

In [5]:
# set up a search for conjunctions between any THEMIS-ASI or REGO instrument, and 
# any Swarm instrument with north B trace region = "north polar cap"
start = datetime.datetime(2019, 2, 1, 0, 0, 0)
end = datetime.datetime(2019, 2, 10, 23, 59, 59)
ground = [{
    "programs": ["themis-asi", "rego"]
}]
space = [{
    "programs": ["swarm"],
    "ephemeris_metadata_filters": {
        "logical_operator": "AND",
        "expressions": [
            {
                "key": "nbtrace_region",
                "operator": "=",
                "values": ["north polar cap"]
            }            
        ]
    }
}]
In [6]:
# perform search
s = pyaurorax.conjunctions.search(start,
                                  end,
                                  distance,
                                  ground=ground,
                                  space=space,
                                  verbose=True)
[2022-01-14 01:12:51.851135] Search object created
[2022-01-14 01:12:51.908313] Request submitted
[2022-01-14 01:12:51.908421] Request ID: 6827cc07-0a51-4232-9a64-cdde62f536ee
[2022-01-14 01:12:51.908432] Request details available at: https://api.aurorax.space/api/v1/conjunctions/requests/6827cc07-0a51-4232-9a64-cdde62f536ee
[2022-01-14 01:12:51.908438] Waiting for data ...
[2022-01-14 01:12:52.983510] Checking for data ...
[2022-01-14 01:12:54.055150] Checking for data ...
[2022-01-14 01:12:55.136435] Checking for data ...
[2022-01-14 01:12:56.215296] Checking for data ...
[2022-01-14 01:12:57.287229] Checking for data ...
[2022-01-14 01:12:58.354662] Checking for data ...
[2022-01-14 01:12:59.436693] Checking for data ...
[2022-01-14 01:13:00.509752] Checking for data ...
[2022-01-14 01:13:01.599192] Checking for data ...
[2022-01-14 01:13:01.685148] Data is now available
[2022-01-14 01:13:01.685299] Retrieving data ...
[2022-01-14 01:13:02.005317] Retrieved 2.0 MB of data containing 273 records
In [7]:
# output data as a pandas dataframe
conjunctions = [c.__dict__ for c in s.data]
df = pd.DataFrame(conjunctions)
df.sort_values("start")
Out[7]:
conjunction_type start end data_sources min_distance max_distance events
191 nbtrace 2019-02-01 02:20:00 2019-02-01 02:21:00 [DataSource(identifier=80, program='rego', pla... 153.987890 371.020379 [{'conjunction_type': 'nbtrace', 'e1_source': ...
90 nbtrace 2019-02-01 02:20:00 2019-02-01 02:21:00 [DataSource(identifier=53, program='themis-asi... 153.987890 371.020379 [{'conjunction_type': 'nbtrace', 'e1_source': ...
232 nbtrace 2019-02-01 02:21:00 2019-02-01 02:22:00 [DataSource(identifier=83, program='rego', pla... 267.685472 300.984658 [{'conjunction_type': 'nbtrace', 'e1_source': ...
177 nbtrace 2019-02-01 03:55:00 2019-02-01 03:56:00 [DataSource(identifier=78, program='rego', pla... 471.096543 490.131048 [{'conjunction_type': 'nbtrace', 'e1_source': ...
223 nbtrace 2019-02-01 03:57:00 2019-02-01 03:57:00 [DataSource(identifier=83, program='rego', pla... 496.774661 496.774661 [{'conjunction_type': 'nbtrace', 'e1_source': ...
... ... ... ... ... ... ... ...
27 nbtrace 2019-02-10 10:31:00 2019-02-10 10:31:00 [DataSource(identifier=51, program='themis-asi... 306.385115 306.385115 [{'conjunction_type': 'nbtrace', 'e1_source': ...
72 nbtrace 2019-02-10 10:31:00 2019-02-10 10:31:00 [DataSource(identifier=51, program='themis-asi... 284.073933 284.073933 [{'conjunction_type': 'nbtrace', 'e1_source': ...
224 nbtrace 2019-02-10 12:13:00 2019-02-10 12:13:00 [DataSource(identifier=83, program='rego', pla... 291.186735 291.186735 [{'conjunction_type': 'nbtrace', 'e1_source': ...
98 nbtrace 2019-02-10 12:14:00 2019-02-10 12:15:00 [DataSource(identifier=53, program='themis-asi... 441.735730 481.820741 [{'conjunction_type': 'nbtrace', 'e1_source': ...
190 nbtrace 2019-02-10 12:14:00 2019-02-10 12:15:00 [DataSource(identifier=80, program='rego', pla... 441.735730 481.820741 [{'conjunction_type': 'nbtrace', 'e1_source': ...

273 rows × 7 columns

Search for conjunctions with multiple ground and space instruments, and advanced distances

In [11]:
# search for conjunctions between any REGO instrument, any TREx instrument, 
# any Swarm spacecraft, and any THEMIS spacecraft
#
# we call this a search for "quadruple conjunctions"
start = datetime.datetime(2020, 1, 1, 0, 0, 0)
end = datetime.datetime(2020, 1, 4, 23, 59, 59)
ground = [
    {"programs": ["rego"]},
    {"programs": ["trex"]}
]
space = [
    {"programs": ["swarm"]},
    {"programs": ["themis"]}
]
advanced_distances = {
    "ground1-ground2": None,
    "ground1-space1": 500,
    "ground1-space2": 500,
    "ground2-space1": 500,
    "ground2-space2": 500,
    "space1-space2": None
}
In [12]:
# perform search
s = pyaurorax.conjunctions.search(start,
                                  end,
                                  advanced_distances,
                                  ground=ground,
                                  space=space,
                                  verbose=True)
[2022-01-14 01:16:19.176222] Search object created
[2022-01-14 01:16:19.256117] Request submitted
[2022-01-14 01:16:19.256310] Request ID: 6a23924d-cf31-472c-a2c7-cae0abe1b5c0
[2022-01-14 01:16:19.256334] Request details available at: https://api.aurorax.space/api/v1/conjunctions/requests/6a23924d-cf31-472c-a2c7-cae0abe1b5c0
[2022-01-14 01:16:19.256346] Waiting for data ...
[2022-01-14 01:16:20.335529] Checking for data ...
[2022-01-14 01:16:21.410486] Checking for data ...
[2022-01-14 01:16:22.495158] Checking for data ...
[2022-01-14 01:16:23.586497] Checking for data ...
[2022-01-14 01:16:24.654038] Checking for data ...
[2022-01-14 01:16:25.726484] Checking for data ...
[2022-01-14 01:16:26.804372] Checking for data ...
[2022-01-14 01:16:27.882619] Checking for data ...
[2022-01-14 01:16:28.954724] Checking for data ...
[2022-01-14 01:16:30.028347] Checking for data ...
[2022-01-14 01:16:30.103125] Data is now available
[2022-01-14 01:16:30.103344] Retrieving data ...
[2022-01-14 01:16:30.210806] Retrieved 84.0 kB of data containing 8 records
In [13]:
# output data as a pandas dataframe
conjunctions = [c.__dict__ for c in s.data]
df = pd.DataFrame(conjunctions)
df.sort_values("start")
Out[13]:
conjunction_type start end data_sources min_distance max_distance events
4 nbtrace 2020-01-02 13:00:00 2020-01-02 13:01:00 [DataSource(identifier=81, program='rego', pla... 384.347496 440.461162 [{'conjunction_type': 'nbtrace', 'e1_source': ...
7 nbtrace 2020-01-02 13:00:00 2020-01-02 13:01:00 [DataSource(identifier=81, program='rego', pla... 384.347496 440.461162 [{'conjunction_type': 'nbtrace', 'e1_source': ...
0 nbtrace 2020-01-03 12:33:00 2020-01-03 12:35:00 [DataSource(identifier=81, program='rego', pla... 111.324353 485.848555 [{'conjunction_type': 'nbtrace', 'e1_source': ...
1 nbtrace 2020-01-03 12:33:00 2020-01-03 12:35:00 [DataSource(identifier=81, program='rego', pla... 111.324353 485.848555 [{'conjunction_type': 'nbtrace', 'e1_source': ...
3 nbtrace 2020-01-03 12:33:00 2020-01-03 12:34:00 [DataSource(identifier=81, program='rego', pla... 122.118464 294.065540 [{'conjunction_type': 'nbtrace', 'e1_source': ...
6 nbtrace 2020-01-03 12:33:00 2020-01-03 12:34:00 [DataSource(identifier=81, program='rego', pla... 122.118464 294.065540 [{'conjunction_type': 'nbtrace', 'e1_source': ...
2 nbtrace 2020-01-03 12:40:00 2020-01-03 12:42:00 [DataSource(identifier=81, program='rego', pla... 255.883772 476.507384 [{'conjunction_type': 'nbtrace', 'e1_source': ...
5 nbtrace 2020-01-03 12:40:00 2020-01-03 12:42:00 [DataSource(identifier=81, program='rego', pla... 255.883772 476.507384 [{'conjunction_type': 'nbtrace', 'e1_source': ...

Search for conjunctions between spacecrafts only

In [16]:
# search for conjunctions between Swarm A or Swarm B, and 
# any THEMIS spacecraft with the south B trace region = "south polar cap"
start = datetime.datetime(2019, 1, 1, 0, 0, 0)
end = datetime.datetime(2019, 1, 1, 23, 59, 59)
space = [
    {"programs": ["themis"]},
    {
        "programs": ["swarm"],
        "platforms": ["swarma", "swarmb"],
        "hemisphere": ["southern"],
        "ephemeris_metadata_filters": {
            "logical_operator": "AND",
            "expressions": [
                {
                    "key": "sbtrace_region",
                    "operator": "=",
                    "values": ["south polar cap"]
                }
            ]
        }
    }
]
distance = 500
In [17]:
#perform search
s = pyaurorax.conjunctions.search(start,
                                  end,
                                  distance,
                                  space=space,
                                  verbose=True)
[2022-01-14 01:19:26.589502] Search object created
[2022-01-14 01:19:26.754382] Request submitted
[2022-01-14 01:19:26.754514] Request ID: 0b2dbdd3-d00c-4b4a-a7bb-400a7f2bf6b4
[2022-01-14 01:19:26.754525] Request details available at: https://api.aurorax.space/api/v1/conjunctions/requests/0b2dbdd3-d00c-4b4a-a7bb-400a7f2bf6b4
[2022-01-14 01:19:26.754532] Waiting for data ...
[2022-01-14 01:19:27.837675] Checking for data ...
[2022-01-14 01:19:27.899384] Data is now available
[2022-01-14 01:19:27.899527] Retrieving data ...
[2022-01-14 01:19:27.973476] Retrieved 17.2 kB of data containing 2 records
In [18]:
# output data as a pandas dataframe
conjunctions = [c.__dict__ for c in s.data]
df = pd.DataFrame(conjunctions)
df.sort_values("start")
Out[18]:
conjunction_type start end data_sources min_distance max_distance events
1 nbtrace 2019-01-01 10:01:00 2019-01-01 10:01:00 [DataSource(identifier=33, program='themis', p... 311.183877 311.183877 [{'conjunction_type': 'nbtrace', 'e1_source': ...
0 nbtrace 2019-01-01 12:08:00 2019-01-01 12:08:00 [DataSource(identifier=33, program='themis', p... 215.817544 215.817544 [{'conjunction_type': 'nbtrace', 'e1_source': ...

Do the search step-by-step

Under the hood, the AuroraX API performs a conjunction search asynchronously. Note that this does not mean that it can be done using a Python async method; it means that PyAuroraX does more than just a single HTTP request against the AuroraX API when doing a search. With the API operating this way, it adds some more complexity within PyAuroraX but also opens the search up to some very important capabilities. The main capability enabled by this architecture is the ablity to perform queries for a large timeframe, and/or between a large number of data sources. Queries like this can easily take several minutes. A conventional HTTP request would normally timeout because of this, ultimately failing to complete the search.

Instead of using the pyaurorax.conjunctions.search method which wraps all logic into an easy function, you can also perform a conjunction search step-by-step if you want more control over the process. Below, we do a search in this manner.

In [13]:
# set up the search parameters
start = datetime.datetime(2020, 1, 1, 0, 0, 0)
end = datetime.datetime(2020, 1, 1, 6, 59, 59)
ground = [
    {"programs": ["themis-asi"]}
]
space = [
    {"programs": ["swarm"]}
]
distance = 500
In [14]:
# create a Search object
s = pyaurorax.conjunctions.Search(start,
                                  end,
                                  distance,
                                  ground=ground,
                                  space=space)
print(s)
ConjunctionSearch(executed=False, completed=False, request_id='')
In [15]:
# execute the search
s.execute()
print(s)
ConjunctionSearch(executed=True, completed=False, request_id='d8845453-e1ed-47c9-b5ac-0a87e2b6ea90')
In [18]:
# get request status
s.update_status()
pprint.pprint(s.status)
{'logs': [{'level': 'debug',
           'summary': 'Search request arrived and saved',
           'timestamp': '2022-01-14T01:34:35.554156Z'},
          {'level': 'info',
           'summary': 'Starting conjunction search for query '
                      'd8845453-e1ed-47c9-b5ac-0a87e2b6ea90',
           'timestamp': '2022-01-14T01:34:35.568931Z'},
          {'level': 'debug',
           'summary': 'Start search for nbtrace conjunctions using query: Find '
                      'conjunctions of type (nbtrace) with epoch precision of '
                      '60 seconds between data sources of ground1=(program in '
                      '(themis-asi)) AND space1=(program in (swarm)) WHERE '
                      'epochs are between 2020-01-01T00:00:00 AND '
                      '2020-01-01T06:59:59 UTC HAVING max distances between '
                      'location points of ground1-space1=500 km.',
           'timestamp': '2022-01-14T01:34:35.577339Z'},
          {'level': 'debug',
           'summary': 'Querying the database 1 times for this overall '
                      'combination of criteria blocks and conjunction types. '
                      'This log message will repeat 1 times during this '
                      'search.',
           'timestamp': '2022-01-14T01:34:35.591566Z'},
          {'level': 'debug',
           'summary': 'Querying database for criteria combination [(program in '
                      '(themis-asi)), (program in (swarm))]',
           'timestamp': '2022-01-14T01:34:35.600836Z'},
          {'level': 'debug',
           'summary': 'Found 92 single epoch events',
           'timestamp': '2022-01-14T01:34:35.736566Z'},
          {'level': 'debug',
           'summary': 'Reduced single events into 49 continuous intervals',
           'timestamp': '2022-01-14T01:34:35.74363Z'},
          {'level': 'debug',
           'summary': 'Searching for super events across all data source '
                      'combinations: [[64, 3], [64, 29], [64, 30], [65, 3], '
                      '[65, 29], [65, 30], [66, 3], [66, 29], [66, 30], [71, '
                      '3], [71, 29], [71, 30], [73, 3], [73, 29], [73, 30], '
                      '[44, 3], [44, 29], [44, 30], [45, 3], [45, 29], [45, '
                      '30], [46, 3], [46, 29], [46, 30], [47, 3], [47, 29], '
                      '[47, 30], [48, 3], [48, 29], [48, 30], [49, 3], [49, '
                      '29], [49, 30], [50, 3], [50, 29], [50, 30], [51, 3], '
                      '[51, 29], [51, 30], [52, 3], [52, 29], [52, 30], [53, '
                      '3], [53, 29], [53, 30], [54, 3], [54, 29], [54, 30], '
                      '[55, 3], [55, 29], [55, 30], [56, 3], [56, 29], [56, '
                      '30], [57, 3], [57, 29], [57, 30], [58, 3], [58, 29], '
                      '[58, 30], [59, 3], [59, 29], [59, 30], [60, 3], [60, '
                      '29], [60, 30], [61, 3], [61, 29], [61, 30], [62, 3], '
                      '[62, 29], [62, 30]]',
           'timestamp': '2022-01-14T01:34:35.761214Z'},
          {'level': 'debug',
           'summary': 'Found 49 super events',
           'timestamp': '2022-01-14T01:34:35.770608Z'},
          {'level': 'debug',
           'summary': 'Saving results',
           'timestamp': '2022-01-14T01:34:36.285477Z'},
          {'level': 'info',
           'summary': 'Search completed',
           'timestamp': '2022-01-14T01:34:36.324394Z'},
          {'level': 'debug',
           'summary': 'File size is 373562 bytes.',
           'timestamp': '2022-01-14T01:34:36.331905Z'},
          {'level': 'info',
           'summary': 'Finished search in 0.78 seconds and found 49 records.',
           'timestamp': '2022-01-14T01:34:36.349581Z'}],
 'search_request': {'query': {'conjunction_types': ['nbtrace'],
                              'end': '2020-01-01T06:59:59',
                              'epoch_search_precision': 60,
                              'events': [],
                              'ground': [{'instrument_types': [],
                                          'platforms': [],
                                          'programs': ['themis-asi']}],
                              'max_distances': {'ground1-space1': 500},
                              'request_id': 'd8845453-e1ed-47c9-b5ac-0a87e2b6ea90',
                              'space': [{'hemisphere': [],
                                         'instrument_types': [],
                                         'platforms': [],
                                         'programs': ['swarm']}],
                              'start': '2020-01-01T00:00:00'},
                    'request_id': 'd8845453-e1ed-47c9-b5ac-0a87e2b6ea90',
                    'request_type': 'conjunction_multi',
                    'requested': '2022-01-14T01:34:35.53907Z'},
 'search_result': {'completed_timestamp': '2022-01-14T01:34:36.340121Z',
                   'data_uri': '/api/v1/conjunctions/requests/d8845453-e1ed-47c9-b5ac-0a87e2b6ea90/data',
                   'error_condition': False,
                   'file_size': 373562,
                   'query_duration': 775,
                   'result_count': 49,
                   'result_file_deleted_timestamp': None}}
In [19]:
# view just the logs for the request (update the status beforehand, but we do that in the above cell)
pprint.pprint(s.logs)
[{'level': 'debug',
  'summary': 'Search request arrived and saved',
  'timestamp': '2022-01-14T01:34:35.554156Z'},
 {'level': 'info',
  'summary': 'Starting conjunction search for query '
             'd8845453-e1ed-47c9-b5ac-0a87e2b6ea90',
  'timestamp': '2022-01-14T01:34:35.568931Z'},
 {'level': 'debug',
  'summary': 'Start search for nbtrace conjunctions using query: Find '
             'conjunctions of type (nbtrace) with epoch precision of 60 '
             'seconds between data sources of ground1=(program in '
             '(themis-asi)) AND space1=(program in (swarm)) WHERE epochs are '
             'between 2020-01-01T00:00:00 AND 2020-01-01T06:59:59 UTC HAVING '
             'max distances between location points of ground1-space1=500 km.',
  'timestamp': '2022-01-14T01:34:35.577339Z'},
 {'level': 'debug',
  'summary': 'Querying the database 1 times for this overall combination of '
             'criteria blocks and conjunction types. This log message will '
             'repeat 1 times during this search.',
  'timestamp': '2022-01-14T01:34:35.591566Z'},
 {'level': 'debug',
  'summary': 'Querying database for criteria combination [(program in '
             '(themis-asi)), (program in (swarm))]',
  'timestamp': '2022-01-14T01:34:35.600836Z'},
 {'level': 'debug',
  'summary': 'Found 92 single epoch events',
  'timestamp': '2022-01-14T01:34:35.736566Z'},
 {'level': 'debug',
  'summary': 'Reduced single events into 49 continuous intervals',
  'timestamp': '2022-01-14T01:34:35.74363Z'},
 {'level': 'debug',
  'summary': 'Searching for super events across all data source combinations: '
             '[[64, 3], [64, 29], [64, 30], [65, 3], [65, 29], [65, 30], [66, '
             '3], [66, 29], [66, 30], [71, 3], [71, 29], [71, 30], [73, 3], '
             '[73, 29], [73, 30], [44, 3], [44, 29], [44, 30], [45, 3], [45, '
             '29], [45, 30], [46, 3], [46, 29], [46, 30], [47, 3], [47, 29], '
             '[47, 30], [48, 3], [48, 29], [48, 30], [49, 3], [49, 29], [49, '
             '30], [50, 3], [50, 29], [50, 30], [51, 3], [51, 29], [51, 30], '
             '[52, 3], [52, 29], [52, 30], [53, 3], [53, 29], [53, 30], [54, '
             '3], [54, 29], [54, 30], [55, 3], [55, 29], [55, 30], [56, 3], '
             '[56, 29], [56, 30], [57, 3], [57, 29], [57, 30], [58, 3], [58, '
             '29], [58, 30], [59, 3], [59, 29], [59, 30], [60, 3], [60, 29], '
             '[60, 30], [61, 3], [61, 29], [61, 30], [62, 3], [62, 29], [62, '
             '30]]',
  'timestamp': '2022-01-14T01:34:35.761214Z'},
 {'level': 'debug',
  'summary': 'Found 49 super events',
  'timestamp': '2022-01-14T01:34:35.770608Z'},
 {'level': 'debug',
  'summary': 'Saving results',
  'timestamp': '2022-01-14T01:34:36.285477Z'},
 {'level': 'info',
  'summary': 'Search completed',
  'timestamp': '2022-01-14T01:34:36.324394Z'},
 {'level': 'debug',
  'summary': 'File size is 373562 bytes.',
  'timestamp': '2022-01-14T01:34:36.331905Z'},
 {'level': 'info',
  'summary': 'Finished search in 0.78 seconds and found 49 records.',
  'timestamp': '2022-01-14T01:34:36.349581Z'}]
In [21]:
# wait for the data
s.wait()
s.update_status()
In [26]:
# get data
s.get_data()

# show data as pandas dataframe
data_products = [d.__dict__ for d in s.data]
df = pd.DataFrame(data_products)
df.sort_values("start")
Out[26]:
conjunction_type start end data_sources min_distance max_distance events
43 nbtrace 2020-01-01 00:08:00 2020-01-01 00:09:00 [DataSource(identifier=53, program='themis-asi... 206.588207 260.819127 [{'conjunction_type': 'nbtrace', 'e1_source': ...
15 nbtrace 2020-01-01 00:08:00 2020-01-01 00:09:00 [DataSource(identifier=53, program='themis-asi... 192.029390 336.631805 [{'conjunction_type': 'nbtrace', 'e1_source': ...
11 nbtrace 2020-01-01 00:10:00 2020-01-01 00:11:00 [DataSource(identifier=51, program='themis-asi... 282.877438 285.744881 [{'conjunction_type': 'nbtrace', 'e1_source': ...
38 nbtrace 2020-01-01 00:10:00 2020-01-01 00:11:00 [DataSource(identifier=51, program='themis-asi... 195.554240 298.419001 [{'conjunction_type': 'nbtrace', 'e1_source': ...
30 nbtrace 2020-01-01 00:11:00 2020-01-01 00:13:00 [DataSource(identifier=46, program='themis-asi... 53.391843 441.814398 [{'conjunction_type': 'nbtrace', 'e1_source': ...
3 nbtrace 2020-01-01 00:12:00 2020-01-01 00:13:00 [DataSource(identifier=46, program='themis-asi... 89.436436 332.998863 [{'conjunction_type': 'nbtrace', 'e1_source': ...
17 nbtrace 2020-01-01 00:13:00 2020-01-01 00:13:00 [DataSource(identifier=54, program='themis-asi... 401.883399 401.883399 [{'conjunction_type': 'nbtrace', 'e1_source': ...
37 nbtrace 2020-01-01 00:13:00 2020-01-01 00:14:00 [DataSource(identifier=50, program='themis-asi... 215.337413 330.343161 [{'conjunction_type': 'nbtrace', 'e1_source': ...
10 nbtrace 2020-01-01 00:13:00 2020-01-01 00:15:00 [DataSource(identifier=50, program='themis-asi... 105.345328 488.349867 [{'conjunction_type': 'nbtrace', 'e1_source': ...
7 nbtrace 2020-01-01 00:44:00 2020-01-01 00:46:00 [DataSource(identifier=48, program='themis-asi... 114.890751 488.203200 [{'conjunction_type': 'nbtrace', 'e1_source': ...
33 nbtrace 2020-01-01 00:44:00 2020-01-01 00:45:00 [DataSource(identifier=48, program='themis-asi... 176.558673 365.537448 [{'conjunction_type': 'nbtrace', 'e1_source': ...
41 nbtrace 2020-01-01 00:46:00 2020-01-01 00:47:00 [DataSource(identifier=52, program='themis-asi... 275.851379 345.489291 [{'conjunction_type': 'nbtrace', 'e1_source': ...
13 nbtrace 2020-01-01 00:46:00 2020-01-01 00:47:00 [DataSource(identifier=52, program='themis-asi... 216.790371 385.043153 [{'conjunction_type': 'nbtrace', 'e1_source': ...
8 nbtrace 2020-01-01 00:47:00 2020-01-01 00:48:00 [DataSource(identifier=49, program='themis-asi... 332.998445 461.144528 [{'conjunction_type': 'nbtrace', 'e1_source': ...
34 nbtrace 2020-01-01 00:47:00 2020-01-01 00:48:00 [DataSource(identifier=49, program='themis-asi... 355.233113 396.151714 [{'conjunction_type': 'nbtrace', 'e1_source': ...
35 nbtrace 2020-01-01 00:50:00 2020-01-01 00:51:00 [DataSource(identifier=51, program='themis-asi... 117.379897 241.904346 [{'conjunction_type': 'nbtrace', 'e1_source': ...
24 nbtrace 2020-01-01 00:52:00 2020-01-01 00:52:00 [DataSource(identifier=46, program='themis-asi... 460.151231 460.151231 [{'conjunction_type': 'nbtrace', 'e1_source': ...
42 nbtrace 2020-01-01 00:53:00 2020-01-01 00:53:00 [DataSource(identifier=54, program='themis-asi... 430.171520 430.171520 [{'conjunction_type': 'nbtrace', 'e1_source': ...
21 nbtrace 2020-01-01 00:54:00 2020-01-01 00:55:00 [DataSource(identifier=44, program='themis-asi... 265.640223 333.568278 [{'conjunction_type': 'nbtrace', 'e1_source': ...
27 nbtrace 2020-01-01 01:29:00 2020-01-01 01:29:00 [DataSource(identifier=47, program='themis-asi... 493.180071 493.180071 [{'conjunction_type': 'nbtrace', 'e1_source': ...
2 nbtrace 2020-01-01 01:43:00 2020-01-01 01:45:00 [DataSource(identifier=45, program='themis-asi... 131.293608 465.392815 [{'conjunction_type': 'nbtrace', 'e1_source': ...
26 nbtrace 2020-01-01 01:43:00 2020-01-01 01:45:00 [DataSource(identifier=45, program='themis-asi... 198.022033 490.128034 [{'conjunction_type': 'nbtrace', 'e1_source': ...
23 nbtrace 2020-01-01 01:45:00 2020-01-01 01:46:00 [DataSource(identifier=44, program='themis-asi... 205.885002 420.474697 [{'conjunction_type': 'nbtrace', 'e1_source': ...
0 nbtrace 2020-01-01 01:46:00 2020-01-01 01:47:00 [DataSource(identifier=44, program='themis-asi... 284.420850 493.197476 [{'conjunction_type': 'nbtrace', 'e1_source': ...
36 nbtrace 2020-01-01 02:17:00 2020-01-01 02:18:00 [DataSource(identifier=50, program='themis-asi... 375.455878 459.284383 [{'conjunction_type': 'nbtrace', 'e1_source': ...
9 nbtrace 2020-01-01 02:17:00 2020-01-01 02:18:00 [DataSource(identifier=50, program='themis-asi... 347.656216 390.934039 [{'conjunction_type': 'nbtrace', 'e1_source': ...
40 nbtrace 2020-01-01 02:19:00 2020-01-01 02:20:00 [DataSource(identifier=52, program='themis-asi... 197.889134 494.591201 [{'conjunction_type': 'nbtrace', 'e1_source': ...
14 nbtrace 2020-01-01 02:20:00 2020-01-01 02:21:00 [DataSource(identifier=52, program='themis-asi... 228.831208 480.716179 [{'conjunction_type': 'nbtrace', 'e1_source': ...
22 nbtrace 2020-01-01 02:28:00 2020-01-01 02:29:00 [DataSource(identifier=45, program='themis-asi... 156.167998 288.063655 [{'conjunction_type': 'nbtrace', 'e1_source': ...
5 nbtrace 2020-01-01 03:15:00 2020-01-01 03:16:00 [DataSource(identifier=47, program='themis-asi... 412.812856 489.362899 [{'conjunction_type': 'nbtrace', 'e1_source': ...
32 nbtrace 2020-01-01 03:15:00 2020-01-01 03:16:00 [DataSource(identifier=47, program='themis-asi... 385.355069 414.231784 [{'conjunction_type': 'nbtrace', 'e1_source': ...
47 nbtrace 2020-01-01 03:17:00 2020-01-01 03:18:00 [DataSource(identifier=64, program='themis-asi... 224.424121 433.727070 [{'conjunction_type': 'nbtrace', 'e1_source': ...
18 nbtrace 2020-01-01 03:17:00 2020-01-01 03:18:00 [DataSource(identifier=64, program='themis-asi... 186.992979 344.140279 [{'conjunction_type': 'nbtrace', 'e1_source': ...
16 nbtrace 2020-01-01 03:50:00 2020-01-01 03:51:00 [DataSource(identifier=54, program='themis-asi... 106.219997 351.707007 [{'conjunction_type': 'nbtrace', 'e1_source': ...
44 nbtrace 2020-01-01 03:50:00 2020-01-01 03:51:00 [DataSource(identifier=54, program='themis-asi... 127.208169 287.958853 [{'conjunction_type': 'nbtrace', 'e1_source': ...
29 nbtrace 2020-01-01 03:51:00 2020-01-01 03:52:00 [DataSource(identifier=46, program='themis-asi... 139.462865 365.173735 [{'conjunction_type': 'nbtrace', 'e1_source': ...
4 nbtrace 2020-01-01 03:51:00 2020-01-01 03:52:00 [DataSource(identifier=46, program='themis-asi... 142.425348 433.674543 [{'conjunction_type': 'nbtrace', 'e1_source': ...
12 nbtrace 2020-01-01 03:53:00 2020-01-01 03:53:00 [DataSource(identifier=51, program='themis-asi... 219.412264 219.412264 [{'conjunction_type': 'nbtrace', 'e1_source': ...
39 nbtrace 2020-01-01 03:53:00 2020-01-01 03:53:00 [DataSource(identifier=51, program='themis-asi... 190.663238 190.663238 [{'conjunction_type': 'nbtrace', 'e1_source': ...
28 nbtrace 2020-01-01 04:04:00 2020-01-01 04:04:00 [DataSource(identifier=47, program='themis-asi... 368.898466 368.898466 [{'conjunction_type': 'nbtrace', 'e1_source': ...
45 nbtrace 2020-01-01 04:05:00 2020-01-01 04:06:00 [DataSource(identifier=65, program='themis-asi... 236.205457 341.436305 [{'conjunction_type': 'nbtrace', 'e1_source': ...
20 nbtrace 2020-01-01 04:49:00 2020-01-01 04:50:00 [DataSource(identifier=65, program='themis-asi... 323.719101 352.655457 [{'conjunction_type': 'nbtrace', 'e1_source': ...
48 nbtrace 2020-01-01 04:49:00 2020-01-01 04:50:00 [DataSource(identifier=65, program='themis-asi... 244.886114 355.591219 [{'conjunction_type': 'nbtrace', 'e1_source': ...
1 nbtrace 2020-01-01 05:23:00 2020-01-01 05:23:00 [DataSource(identifier=45, program='themis-asi... 336.102854 336.102854 [{'conjunction_type': 'nbtrace', 'e1_source': ...
25 nbtrace 2020-01-01 05:23:00 2020-01-01 05:23:00 [DataSource(identifier=45, program='themis-asi... 389.724805 389.724805 [{'conjunction_type': 'nbtrace', 'e1_source': ...
19 nbtrace 2020-01-01 06:54:00 2020-01-01 06:55:00 [DataSource(identifier=64, program='themis-asi... 256.732039 421.977224 [{'conjunction_type': 'nbtrace', 'e1_source': ...
46 nbtrace 2020-01-01 06:54:00 2020-01-01 06:55:00 [DataSource(identifier=64, program='themis-asi... 253.959112 302.213217 [{'conjunction_type': 'nbtrace', 'e1_source': ...
31 nbtrace 2020-01-01 06:56:00 2020-01-01 06:56:00 [DataSource(identifier=47, program='themis-asi... 196.531937 196.531937 [{'conjunction_type': 'nbtrace', 'e1_source': ...
6 nbtrace 2020-01-01 06:56:00 2020-01-01 06:56:00 [DataSource(identifier=47, program='themis-asi... 212.741402 212.741402 [{'conjunction_type': 'nbtrace', 'e1_source': ...
In [ ]: