Skip to content

Commit d5c3899

Browse files
committed
Enhance tutorial with additional explanations and structure for PDS Index files
1 parent 3e5c025 commit d5c3899

File tree

1 file changed

+67
-43
lines changed

1 file changed

+67
-43
lines changed

notebooks/pds_indexes_examples.ipynb

Lines changed: 67 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,21 @@
1818
"contained in this tree."
1919
]
2020
},
21+
{
22+
"cell_type": "markdown",
23+
"id": "e2cdf568",
24+
"metadata": {},
25+
"source": [
26+
"# Working with PDS Index files\n",
27+
"\n",
28+
"One of the major features of `planetarypy` is the ability to work with PDS Index files, or, more generally, identify data of interest for you.\n",
29+
"\n",
30+
"To this end, `planetarypy` provides a set of functions that allow you to work with PDS Index files:"
31+
]
32+
},
2133
{
2234
"cell_type": "code",
23-
"execution_count": 1,
35+
"execution_count": 4,
2436
"id": "6f33832a",
2537
"metadata": {},
2638
"outputs": [],
@@ -39,12 +51,17 @@
3951
"id": "50b4612a",
4052
"metadata": {},
4153
"source": [
42-
"Note: The names under the instrument name space are the names of available PDS3 Index files."
54+
"Using `list_available_indexes()` you can get a list of all available PDS Index files.\n",
55+
"\n",
56+
"Note that the names under the instrument name space are the names of available PDS3 Index files.\n",
57+
"\n",
58+
"Those can have various names, depending on the instrument and the mission and if the responsible PDS node created any extra index files\n",
59+
"that were not initially provided by the instrument team."
4360
]
4461
},
4562
{
4663
"cell_type": "code",
47-
"execution_count": 2,
64+
"execution_count": 5,
4865
"id": "77d6ac48",
4966
"metadata": {},
5067
"outputs": [
@@ -109,7 +126,7 @@
109126
},
110127
{
111128
"cell_type": "code",
112-
"execution_count": 3,
129+
"execution_count": 6,
113130
"id": "d2e7949d",
114131
"metadata": {},
115132
"outputs": [
@@ -119,7 +136,7 @@
119136
"['cassini', 'go', 'lro', 'mro']"
120137
]
121138
},
122-
"execution_count": 3,
139+
"execution_count": 6,
123140
"metadata": {},
124141
"output_type": "execute_result"
125142
}
@@ -130,7 +147,7 @@
130147
},
131148
{
132149
"cell_type": "code",
133-
"execution_count": 4,
150+
"execution_count": 7,
134151
"id": "eb4b8c39",
135152
"metadata": {},
136153
"outputs": [
@@ -140,7 +157,7 @@
140157
"['crism', 'ctx', 'hirise']"
141158
]
142159
},
143-
"execution_count": 4,
160+
"execution_count": 7,
144161
"metadata": {},
145162
"output_type": "execute_result"
146163
}
@@ -151,7 +168,7 @@
151168
},
152169
{
153170
"cell_type": "code",
154-
"execution_count": 5,
171+
"execution_count": 8,
155172
"id": "1982c21b",
156173
"metadata": {},
157174
"outputs": [
@@ -161,7 +178,7 @@
161178
"['edr']"
162179
]
163180
},
164-
"execution_count": 5,
181+
"execution_count": 8,
165182
"metadata": {},
166183
"output_type": "execute_result"
167184
}
@@ -175,18 +192,25 @@
175192
"id": "dc79f628",
176193
"metadata": {},
177194
"source": [
195+
"### Dotted index names\n",
196+
"The names of the indexes are dotted names, where the first part is the mission, then the instrument name, and finally the name of the index file, which can be retrieved using the `list_indexs()` function.\n",
197+
"\n",
178198
"## Retrieving the index as a pandas DataFrame\n",
179199
"\n",
180-
"The first time the index is requested, it will be downloaded, read as a pandas DataFrame,\n",
181-
"convert the time strings to datetime objects and store it as a parquet file on the disk.\n",
182-
"The below `get_index` function will then return the DataFrame as well.\n",
200+
"The first time the index is requested, it will \n",
201+
"- downloaded the label and table file belonging to an index,\n",
202+
"- import it into a `pandas.DataFrame`,\n",
203+
"- convert the time strings to datetime objects and\n",
204+
"- store it as a parquet file on the disk.\n",
205+
" \n",
206+
"The `get_index` function shown below will then return the DataFrame to the user.\n",
183207
"\n",
184-
"At the next time the index is requested, it will be read from the parquet file on the disk, if no newer file is available on the PDS server, otherwise the updated index will be acquired."
208+
"The next time the index is being requested, it will be read from the parquet file on the disk, if no newer file is available on the PDS server, otherwise the updated index will be acquired."
185209
]
186210
},
187211
{
188212
"cell_type": "code",
189-
"execution_count": 6,
213+
"execution_count": 9,
190214
"id": "b7b74ac0",
191215
"metadata": {},
192216
"outputs": [
@@ -413,7 +437,7 @@
413437
"[5 rows x 51 columns]"
414438
]
415439
},
416-
"execution_count": 6,
440+
"execution_count": 9,
417441
"metadata": {},
418442
"output_type": "execute_result"
419443
}
@@ -437,7 +461,7 @@
437461
},
438462
{
439463
"cell_type": "code",
440-
"execution_count": 7,
464+
"execution_count": 10,
441465
"id": "366ce35b",
442466
"metadata": {},
443467
"outputs": [
@@ -447,7 +471,7 @@
447471
"['index', 'inventory', 'moon_summary', 'ring_summary', 'saturn_summary']"
448472
]
449473
},
450-
"execution_count": 7,
474+
"execution_count": 10,
451475
"metadata": {},
452476
"output_type": "execute_result"
453477
}
@@ -458,7 +482,7 @@
458482
},
459483
{
460484
"cell_type": "code",
461-
"execution_count": 8,
485+
"execution_count": 11,
462486
"id": "05c44ce4",
463487
"metadata": {},
464488
"outputs": [
@@ -706,7 +730,7 @@
706730
"[5 rows x 140 columns]"
707731
]
708732
},
709-
"execution_count": 8,
733+
"execution_count": 11,
710734
"metadata": {},
711735
"output_type": "execute_result"
712736
}
@@ -718,7 +742,7 @@
718742
},
719743
{
720744
"cell_type": "code",
721-
"execution_count": 9,
745+
"execution_count": 12,
722746
"id": "1f083047",
723747
"metadata": {},
724748
"outputs": [
@@ -782,7 +806,7 @@
782806
" 'PRODUCT_TYPE', 'STANDARD_DATA_PRODUCT_ID'], dtype=object)"
783807
]
784808
},
785-
"execution_count": 9,
809+
"execution_count": 12,
786810
"metadata": {},
787811
"output_type": "execute_result"
788812
}
@@ -793,7 +817,7 @@
793817
},
794818
{
795819
"cell_type": "code",
796-
"execution_count": 10,
820+
"execution_count": 13,
797821
"id": "d0d8fddd",
798822
"metadata": {},
799823
"outputs": [],
@@ -803,7 +827,7 @@
803827
},
804828
{
805829
"cell_type": "code",
806-
"execution_count": 11,
830+
"execution_count": 14,
807831
"id": "03069644",
808832
"metadata": {},
809833
"outputs": [
@@ -1044,7 +1068,7 @@
10441068
"[5 rows x 35 columns]"
10451069
]
10461070
},
1047-
"execution_count": 11,
1071+
"execution_count": 14,
10481072
"metadata": {},
10491073
"output_type": "execute_result"
10501074
}
@@ -1055,7 +1079,7 @@
10551079
},
10561080
{
10571081
"cell_type": "code",
1058-
"execution_count": 12,
1082+
"execution_count": 15,
10591083
"id": "588217a9",
10601084
"metadata": {},
10611085
"outputs": [
@@ -1085,7 +1109,7 @@
10851109
" 'CENTER_DISTANCE', 'CENTER_PHASE_ANGLE'], dtype=object)"
10861110
]
10871111
},
1088-
"execution_count": 12,
1112+
"execution_count": 15,
10891113
"metadata": {},
10901114
"output_type": "execute_result"
10911115
}
@@ -1094,9 +1118,17 @@
10941118
"moons.columns.values"
10951119
]
10961120
},
1121+
{
1122+
"cell_type": "markdown",
1123+
"id": "0663b9e7",
1124+
"metadata": {},
1125+
"source": [
1126+
"Let's have a look which columns are common between these different indexes."
1127+
]
1128+
},
10971129
{
10981130
"cell_type": "code",
1099-
"execution_count": 13,
1131+
"execution_count": 17,
11001132
"id": "c63a09b4",
11011133
"metadata": {},
11021134
"outputs": [
@@ -1114,14 +1146,14 @@
11141146
"source": [
11151147
"# Get common columns using set intersection\n",
11161148
"common_columns = set(index.columns).intersection(set(moons.columns))\n",
1117-
"print(f\"Common columns between df and moons:\")\n",
1149+
"print(\"Common columns between df and moons:\")\n",
11181150
"for col in sorted(common_columns):\n",
11191151
" print(f\"- {col}\")"
11201152
]
11211153
},
11221154
{
11231155
"cell_type": "code",
1124-
"execution_count": 14,
1156+
"execution_count": 18,
11251157
"id": "64638a23",
11261158
"metadata": {},
11271159
"outputs": [
@@ -1136,7 +1168,7 @@
11361168
"Name: FILE_SPECIFICATION_NAME, dtype: string"
11371169
]
11381170
},
1139-
"execution_count": 14,
1171+
"execution_count": 18,
11401172
"metadata": {},
11411173
"output_type": "execute_result"
11421174
}
@@ -1147,7 +1179,7 @@
11471179
},
11481180
{
11491181
"cell_type": "code",
1150-
"execution_count": 15,
1182+
"execution_count": 19,
11511183
"id": "9fdd06e6",
11521184
"metadata": {},
11531185
"outputs": [
@@ -1162,29 +1194,21 @@
11621194
"Name: FILE_SPECIFICATION_NAME, dtype: string"
11631195
]
11641196
},
1165-
"execution_count": 15,
1197+
"execution_count": 19,
11661198
"metadata": {},
11671199
"output_type": "execute_result"
11681200
}
11691201
],
11701202
"source": [
11711203
"moons.FILE_SPECIFICATION_NAME.head()"
11721204
]
1173-
},
1174-
{
1175-
"cell_type": "code",
1176-
"execution_count": null,
1177-
"id": "05591cc9",
1178-
"metadata": {},
1179-
"outputs": [],
1180-
"source": []
11811205
}
11821206
],
11831207
"metadata": {
11841208
"kernelspec": {
1185-
"display_name": "Python [conda env:py313] *",
1209+
"display_name": "py39",
11861210
"language": "python",
1187-
"name": "conda-env-py313-py"
1211+
"name": "python3"
11881212
},
11891213
"language_info": {
11901214
"codemirror_mode": {
@@ -1196,7 +1220,7 @@
11961220
"name": "python",
11971221
"nbconvert_exporter": "python",
11981222
"pygments_lexer": "ipython3",
1199-
"version": "3.13.3"
1223+
"version": "3.9.22"
12001224
}
12011225
},
12021226
"nbformat": 4,

0 commit comments

Comments
 (0)