{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PyVIMS\n", "\n", "This notebook provide and a set of example of how to manipulate the Cassini VIMS data using the python [`pyvims`](https://pypi.org/project/pyvims/) module.\n", "\n", "## Get some data\n", "To start this example your need to download some data.\n", "\n", "Here we will start with a cube ([`1487096932_1`](https://pds-imaging.jpl.nasa.gov/data/cassini/cassini_orbiter/covims_0006/data/2005044T205815_2005045T210148/v1487096932_1.lbl)) calibrated with [USGS-ISIS3](https://isis.astrogeology.usgs.gov/fixit/projects/isis/wiki/Working_with_Cassini_VIMS) sofware and available on the [vims.univ-nantes.fr](https://vims.univ-nantes.fr) data portal:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import os,wget\n", "\n", "url = 'https://vims.univ-nantes.fr/data/isis'\n", "flyby = 'T3'\n", "image_id = '1487096932_1'\n", "channel = 'ir'\n", "\n", "f_cal = 'C' + image_id + '_' + channel + '.cub'\n", "f_nav = 'N' + image_id + '_' + channel + '.cub'\n", "\n", "if not os.path.isfile(f_cal):\n", " wget.download(url + '/' + flyby + '/' + f_cal) # Calibrated cube (IR)\n", "if not os.path.isfile(f_nav):\n", " wget.download(url + '/' + flyby + '/' + f_nav) # Navigation cube (IR)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading a cube file\n", "Import the `VIMS` class from the `pyvims` package" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "VIMS cube: 1487096932_1 [ISIS3]\n" ] } ], "source": [ "from pyvims import VIMS\n", "cube = VIMS('1487096932_1')\n", "\n", "print(repr(cube))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Extract some metadata\n", "\n", "The `VIMS` object provide a direct access to a subset of the cube metedata (extracted from the file header with the [`pvl`](https://github.com/planetarypy/pvl) module).\n", "\n", "Here is a list of the metadata available about the capture time:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Start: 2005-02-14 18:02:29.023000\n", "Stop: 2005-02-14 18:07:32.930000\n", "Mid-Time: 2005-02-14 18:05:00.976500 / 2005-02-14T18:05:00.976500\n", "Year: 2005\n", "DOY: 45\n", "Decimal year: 2005.12054795\n", "Date: 2005/02/14\n" ] } ], "source": [ "# Acquisition start time (as `datetime` object)\n", "print('Start: {}'.format(cube.start))\n", "\n", "# Acquisition stop time (as `datetime` object)\n", "print('Stop: {}'.format(cube.stop))\n", "\n", "# Acquisition mid-time (as `datetime` object or `%Y-%m-%dT%H:%M:%S.%f` format)\n", "print('Mid-Time: {} / {}'.format(cube.dtime,cube.time))\n", "\n", "# Image year\n", "print('Year: {}'.format(cube.year))\n", "\n", "# Image day of the year\n", "print('DOY: {}'.format(cube.doy))\n", "\n", "# Image decimal year\n", "print('Decimal year: {}'.format(cube.year_d))\n", "\n", "# Image date (as `%Y/%m/%d` format)\n", "print('Date: {}'.format(cube.date))" ] } ], "metadata": { "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }