-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
373 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,373 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# pds4_utils example\n", | ||
"\n", | ||
"This is a work-in-progress notebook demonstrating how to use the psd4_utils module." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pds4_utils import pds4_utils" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"\u001b[0;31mSignature:\u001b[0m \u001b[0mpds4_utils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex_products\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdirectory\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'.'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpattern\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'*.xml'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | ||
"\u001b[0;31mDocstring:\u001b[0m\n", | ||
"Accepts a directory containing PDS4 products, indexes the labels and returns a \n", | ||
"Pandas data-frame containng meta-data for each product.\n", | ||
"\u001b[0;31mFile:\u001b[0m ~/Dropbox/work/bepi/software/pds4_utils/pds4_utils/pds4_utils.py\n", | ||
"\u001b[0;31mType:\u001b[0m function\n" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"pds4_utils.index_products?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"INFO 2020-05-25 17:36:02 (pds4_utils.pds4_utils): 406 PDS4 labels indexed\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"idx = pds4_utils.index_products(directory='/home/mbentley/Desktop/bc_mtm_mcam/')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>filename</th>\n", | ||
" <th>product_type</th>\n", | ||
" <th>lid</th>\n", | ||
" <th>vid</th>\n", | ||
" <th>start_time</th>\n", | ||
" <th>stop_time</th>\n", | ||
" <th>bundle</th>\n", | ||
" <th>collection</th>\n", | ||
" <th>product_id</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/browse/crui...</td>\n", | ||
" <td>Product_Browse</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>browse</td>\n", | ||
" <td>cam_raw_sc_cam1_browse_20200515t024802_00_f__t...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/browse/crui...</td>\n", | ||
" <td>Product_Browse</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>browse</td>\n", | ||
" <td>cam_raw_sc_cam1_browse_20200515t025757_00_f__t...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/browse/crui...</td>\n", | ||
" <td>Product_Browse</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>browse</td>\n", | ||
" <td>cam_raw_sc_cam1_browse_20200515t030752_00_f__t...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>3</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/browse/crui...</td>\n", | ||
" <td>Product_Browse</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>browse</td>\n", | ||
" <td>cam_raw_sc_cam1_browse_20200515t031747_00_f__t...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>4</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/browse/crui...</td>\n", | ||
" <td>Product_Browse</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>NaT</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>browse</td>\n", | ||
" <td>cam_raw_sc_cam1_browse_20200515t032742_00_f__t...</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" filename product_type \\\n", | ||
"0 /home/mbentley/Desktop/bc_mtm_mcam/browse/crui... Product_Browse \n", | ||
"1 /home/mbentley/Desktop/bc_mtm_mcam/browse/crui... Product_Browse \n", | ||
"2 /home/mbentley/Desktop/bc_mtm_mcam/browse/crui... Product_Browse \n", | ||
"3 /home/mbentley/Desktop/bc_mtm_mcam/browse/crui... Product_Browse \n", | ||
"4 /home/mbentley/Desktop/bc_mtm_mcam/browse/crui... Product_Browse \n", | ||
"\n", | ||
" lid vid start_time \\\n", | ||
"0 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1... 1.0 NaT \n", | ||
"1 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1... 1.0 NaT \n", | ||
"2 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1... 1.0 NaT \n", | ||
"3 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1... 1.0 NaT \n", | ||
"4 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam1... 1.0 NaT \n", | ||
"\n", | ||
" stop_time bundle collection \\\n", | ||
"0 NaT bc_mtm_mcam browse \n", | ||
"1 NaT bc_mtm_mcam browse \n", | ||
"2 NaT bc_mtm_mcam browse \n", | ||
"3 NaT bc_mtm_mcam browse \n", | ||
"4 NaT bc_mtm_mcam browse \n", | ||
"\n", | ||
" product_id \n", | ||
"0 cam_raw_sc_cam1_browse_20200515t024802_00_f__t... \n", | ||
"1 cam_raw_sc_cam1_browse_20200515t025757_00_f__t... \n", | ||
"2 cam_raw_sc_cam1_browse_20200515t030752_00_f__t... \n", | ||
"3 cam_raw_sc_cam1_browse_20200515t031747_00_f__t... \n", | ||
"4 cam_raw_sc_cam1_browse_20200515t032742_00_f__t... " | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"idx.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>filename</th>\n", | ||
" <th>product_type</th>\n", | ||
" <th>lid</th>\n", | ||
" <th>vid</th>\n", | ||
" <th>start_time</th>\n", | ||
" <th>stop_time</th>\n", | ||
" <th>bundle</th>\n", | ||
" <th>collection</th>\n", | ||
" <th>product_id</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>204</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr...</td>\n", | ||
" <td>Product_Observational</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>2020-05-15 02:48:02.940</td>\n", | ||
" <td>2020-05-15 02:48:02.960</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>data_raw</td>\n", | ||
" <td>cam_raw_sc_cam1_image_20200515t024802_00_f__t0020</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>205</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr...</td>\n", | ||
" <td>Product_Observational</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>2020-05-15 02:57:57.930</td>\n", | ||
" <td>2020-05-15 02:57:57.950</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>data_raw</td>\n", | ||
" <td>cam_raw_sc_cam1_image_20200515t025757_00_f__t0020</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>206</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr...</td>\n", | ||
" <td>Product_Observational</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>2020-05-15 03:07:52.930</td>\n", | ||
" <td>2020-05-15 03:07:52.950</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>data_raw</td>\n", | ||
" <td>cam_raw_sc_cam1_image_20200515t030752_00_f__t0020</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>207</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr...</td>\n", | ||
" <td>Product_Observational</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>2020-05-15 03:17:47.940</td>\n", | ||
" <td>2020-05-15 03:17:47.960</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>data_raw</td>\n", | ||
" <td>cam_raw_sc_cam1_image_20200515t031747_00_f__t0020</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>208</th>\n", | ||
" <td>/home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr...</td>\n", | ||
" <td>Product_Observational</td>\n", | ||
" <td>urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...</td>\n", | ||
" <td>1.0</td>\n", | ||
" <td>2020-05-15 03:27:42.940</td>\n", | ||
" <td>2020-05-15 03:27:42.960</td>\n", | ||
" <td>bc_mtm_mcam</td>\n", | ||
" <td>data_raw</td>\n", | ||
" <td>cam_raw_sc_cam1_image_20200515t032742_00_f__t0020</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" filename product_type \\\n", | ||
"204 /home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr... Product_Observational \n", | ||
"205 /home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr... Product_Observational \n", | ||
"206 /home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr... Product_Observational \n", | ||
"207 /home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr... Product_Observational \n", | ||
"208 /home/mbentley/Desktop/bc_mtm_mcam/data_raw/cr... Product_Observational \n", | ||
"\n", | ||
" lid vid \\\n", | ||
"204 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", | ||
"205 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", | ||
"206 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", | ||
"207 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", | ||
"208 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", | ||
"\n", | ||
" start_time stop_time bundle collection \\\n", | ||
"204 2020-05-15 02:48:02.940 2020-05-15 02:48:02.960 bc_mtm_mcam data_raw \n", | ||
"205 2020-05-15 02:57:57.930 2020-05-15 02:57:57.950 bc_mtm_mcam data_raw \n", | ||
"206 2020-05-15 03:07:52.930 2020-05-15 03:07:52.950 bc_mtm_mcam data_raw \n", | ||
"207 2020-05-15 03:17:47.940 2020-05-15 03:17:47.960 bc_mtm_mcam data_raw \n", | ||
"208 2020-05-15 03:27:42.940 2020-05-15 03:27:42.960 bc_mtm_mcam data_raw \n", | ||
"\n", | ||
" product_id \n", | ||
"204 cam_raw_sc_cam1_image_20200515t024802_00_f__t0020 \n", | ||
"205 cam_raw_sc_cam1_image_20200515t025757_00_f__t0020 \n", | ||
"206 cam_raw_sc_cam1_image_20200515t030752_00_f__t0020 \n", | ||
"207 cam_raw_sc_cam1_image_20200515t031747_00_f__t0020 \n", | ||
"208 cam_raw_sc_cam1_image_20200515t032742_00_f__t0020 " | ||
] | ||
}, | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"idx[idx.product_type=='Product_Observational'].head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "bepi", | ||
"language": "python", | ||
"name": "bepi" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |