Skip to main content

Toolkit for using USGS Isis in Python.

Project description

https://badge.fury.io/py/pysis.svg https://travis-ci.org/wtolson/pysis.svg?branch=master https://pypip.in/d/pysis/badge.png

Toolkit for using USGS Isis in Python.

How to install

At the command line:

$ easy_install pysis

Or, if you have virtualenvwrapper installed:

$ mkvirtualenv pysis
$ pip install pysis

Dependencies

For working with ISIS commands, you must firts have USGS ISIS 3 installed on your machine. See the ISIS 3 installation guide for further instructions. Remember to set your environmental variables (see step 4 of USGS ISIS guide) so Pysis knows where your installation is.

Quickstart Guide

How to write ISIS 3 code in python using Pysis.

Using ISIS 3 at the command line you might want to run the following basic commands (examples for the MDIS camera on the MESSENGER mission):

mdis2isis from=filename.IMG to=filename.cub spiceinit from=filename.cub mdiscal from=filename.cub to=filename.cal.cub

using Pysis the syntax is:

from pysis.isis import mdis2isis, spiceinit, mdiscal
from pysis.util import file_variations

def calibrate_mids(img_name):
    (cub_name, cal_name) = file_variations(img_name, ['.cub', '.cal.cub'])

    mdis2isis(from_=img_name, to=cub_name)
    spiceinit(from_=cub_name)
    mdiscal(from_=cub_name, to=cal_name)

You will notice that we use the keyword from_ when we call a command because from is a reserved word in python.

Numerical and String Arguments

Here is an example of the maptemplate and cam2map commands in Pysis:

from pysis import isis

isis.maptemplate(map='MDIS_eqr.map', projection='equirectangular',
                 clon=0.0, clat=0.0, resopt='mpp', resolution=1000,
                 rngopt='user', minlat=-10.0, maxlat=10.0, minlon=-10.0,
                 maxlon=10.0)

isis.cam2map(from_=cal_name, to=proj_name, pixres='map',
             map='MDIS_eqr.map',defaultrange='map')

Getting values from ISIS commands

Pysis commands will return the command’s STDOUT as a byte string. If the command returns a nonzero exit code, a ProcessError will be thrown. This example command uses getkey to receive values from the label of an ISIS cube:

from pysis.isis import getkey

value = getkey(from_='W1467351325_4.map.cal.cub',
               keyword='minimumringradius', grp='mapping')

Multiprocessing Isis Commands with IsisPool

Pysis has built-in support to make multiprocessing isis commands simple. To run the above MDIS calibration script for multiple images in multiple processes we could rewrite the function as so:

from pysis import IsisPool
from pysis.util import ImageName

def calibrate_mdis(images):
    images = [ImageName(filename) for filename in images]

    with IsisPool() as isis_pool:
        for filename in images:
            isis_pool.mdis2isis(from_=filename.IMG, to=filename.cub)

    with IsisPool() as isis_pool:
        for filename in images:
            isis_pool.spiceinit(from_=filename.cub)

    with IsisPool() as isis_pool:
        for filename in images:
            isis_pool.mdiscal(from_=filename.cub, to=filename.cal.cub)

When using IsisPool we can’t determine which order commands will be executed in so we much run each command for all the files as a group before moving to the next command and creating a new IsisPool.

History

0.5.0 (2015-04-18)

  • Add support for python 2.6/3.3/3.4

  • Simplified command api.

  • Labels package now shares the json module api.

  • Label parser now fully conforms to the PVL spec.

  • Add label encoder.

0.4.0 (2015-03-21)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysis-0.5.0.tar.gz (187.9 kB view details)

Uploaded Source

Built Distribution

pysis-0.5.0-py2.py3-none-any.whl (17.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pysis-0.5.0.tar.gz.

File metadata

  • Download URL: pysis-0.5.0.tar.gz
  • Upload date:
  • Size: 187.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pysis-0.5.0.tar.gz
Algorithm Hash digest
SHA256 4e0a653a0b12e01fd2056de05873f742b5811afb5041d4f639f6e0d14304d8e7
MD5 0c55ccf9d694f9d01e41bc4dc5d2234e
BLAKE2b-256 efd49dc6c80aaa488ac73c78eaad60fcb3a82042ffbf6650e893c31fb868a2cf

See more details on using hashes here.

Provenance

File details

Details for the file pysis-0.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pysis-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a8cfbcb30de191fd05a49c228bd619b80b95409d645d79432e6002f02b790be2
MD5 fef2fdb7dd811ee9f547393a47777217
BLAKE2b-256 df33260b3c07c2b5aeb815dde01d5ca437689c99008877e916ec33506f46a5e6

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page