{ "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 read, write, dbase, cdf_utils" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0;31mSignature:\u001b[0m \u001b[0mdbase\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[0mrecursive\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\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 ~/Library/CloudStorage/OneDrive-ESA/work/bepi/software/pds4_utils/pds4_utils/dbase.py\n", "\u001b[0;31mType:\u001b[0m function\n" ] } ], "source": [ "dbase.index_products?" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "INFO 2022-10-21 15:33:36,705 (pds4_utils.dbase): 202 PDS4 labels indexed\n" ] } ], "source": [ "idx = dbase.index_products(directory='/Users/mbentley/Desktop/bc_mtm_mcam/')" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
filenameproduct_typelidvidstart_timestop_timebundlecollectionproduct_id
0/Users/mbentley/Desktop/bc_mtm_mcam/browse/cru...Product_Browseurn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3...1.0NaTNaTbc_mtm_mcambrowsecam_raw_sc_cam3_browse_20220822t000002_61_f__t...
1/Users/mbentley/Desktop/bc_mtm_mcam/browse/cru...Product_Browseurn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3...1.0NaTNaTbc_mtm_mcambrowsecam_raw_sc_cam3_browse_20220823t000002_61_f__t...
2/Users/mbentley/Desktop/bc_mtm_mcam/browse/cru...Product_Browseurn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3...1.0NaTNaTbc_mtm_mcambrowsecam_raw_sc_cam3_browse_20220823t082732_10_f__t...
3/Users/mbentley/Desktop/bc_mtm_mcam/browse/cru...Product_Browseurn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3...1.0NaTNaTbc_mtm_mcambrowsecam_raw_sc_cam3_browse_20220823t082744_11_f__t...
4/Users/mbentley/Desktop/bc_mtm_mcam/browse/cru...Product_Browseurn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3...1.0NaTNaTbc_mtm_mcambrowsecam_raw_sc_cam3_browse_20220823t094046_20_f__t...
\n", "
" ], "text/plain": [ " filename product_type \\\n", "0 /Users/mbentley/Desktop/bc_mtm_mcam/browse/cru... Product_Browse \n", "1 /Users/mbentley/Desktop/bc_mtm_mcam/browse/cru... Product_Browse \n", "2 /Users/mbentley/Desktop/bc_mtm_mcam/browse/cru... Product_Browse \n", "3 /Users/mbentley/Desktop/bc_mtm_mcam/browse/cru... Product_Browse \n", "4 /Users/mbentley/Desktop/bc_mtm_mcam/browse/cru... Product_Browse \n", "\n", " lid vid start_time \\\n", "0 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3... 1.0 NaT \n", "1 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3... 1.0 NaT \n", "2 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3... 1.0 NaT \n", "3 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3... 1.0 NaT \n", "4 urn:esa:psa:bc_mtm_mcam:browse:cam_raw_sc_cam3... 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_cam3_browse_20220822t000002_61_f__t... \n", "1 cam_raw_sc_cam3_browse_20220823t000002_61_f__t... \n", "2 cam_raw_sc_cam3_browse_20220823t082732_10_f__t... \n", "3 cam_raw_sc_cam3_browse_20220823t082744_11_f__t... \n", "4 cam_raw_sc_cam3_browse_20220823t094046_20_f__t... " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "idx.head()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
filenameproduct_typelidvidstart_timestop_timebundlecollectionproduct_id
102/Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c...Product_Observationalurn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...1.02022-08-22 00:00:02.7822022-08-22 00:00:02.786bc_mtm_mcamdata_rawcam_raw_sc_cam3_image_20220822t000002_61_f__t0004
103/Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c...Product_Observationalurn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...1.02022-08-23 00:00:02.7832022-08-23 00:00:02.787bc_mtm_mcamdata_rawcam_raw_sc_cam3_image_20220823t000002_61_f__t0004
104/Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c...Product_Observationalurn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...1.02022-08-23 08:27:32.0682022-08-23 08:27:32.083bc_mtm_mcamdata_rawcam_raw_sc_cam3_image_20220823t082732_10_f__t0015
105/Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c...Product_Observationalurn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...1.02022-08-23 08:27:44.1652022-08-23 08:27:44.185bc_mtm_mcamdata_rawcam_raw_sc_cam3_image_20220823t082744_11_f__t0020
106/Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c...Product_Observationalurn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca...1.02022-08-23 09:40:46.5942022-08-23 09:40:46.609bc_mtm_mcamdata_rawcam_raw_sc_cam3_image_20220823t094046_20_f__t0015
\n", "
" ], "text/plain": [ " filename product_type \\\n", "102 /Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c... Product_Observational \n", "103 /Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c... Product_Observational \n", "104 /Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c... Product_Observational \n", "105 /Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c... Product_Observational \n", "106 /Users/mbentley/Desktop/bc_mtm_mcam/data_raw/c... Product_Observational \n", "\n", " lid vid \\\n", "102 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", "103 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", "104 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", "105 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", "106 urn:esa:psa:bc_mtm_mcam:data_raw:cam_raw_sc_ca... 1.0 \n", "\n", " start_time stop_time bundle collection \\\n", "102 2022-08-22 00:00:02.782 2022-08-22 00:00:02.786 bc_mtm_mcam data_raw \n", "103 2022-08-23 00:00:02.783 2022-08-23 00:00:02.787 bc_mtm_mcam data_raw \n", "104 2022-08-23 08:27:32.068 2022-08-23 08:27:32.083 bc_mtm_mcam data_raw \n", "105 2022-08-23 08:27:44.165 2022-08-23 08:27:44.185 bc_mtm_mcam data_raw \n", "106 2022-08-23 09:40:46.594 2022-08-23 09:40:46.609 bc_mtm_mcam data_raw \n", "\n", " product_id \n", "102 cam_raw_sc_cam3_image_20220822t000002_61_f__t0004 \n", "103 cam_raw_sc_cam3_image_20220823t000002_61_f__t0004 \n", "104 cam_raw_sc_cam3_image_20220823t082732_10_f__t0015 \n", "105 cam_raw_sc_cam3_image_20220823t082744_11_f__t0020 \n", "106 cam_raw_sc_cam3_image_20220823t094046_20_f__t0015 " ] }, "execution_count": 9, "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.10.6" } }, "nbformat": 4, "nbformat_minor": 4 }