Skip to main content

reads and plots THEMIS ASI video data of aurora.

Project description

Zenodo DOI Travis-CI status Coverage Build status Maintainability pypi versions Xarray badge PyPi Download stats

Themis ASI Reader

Read & plot 256x256 "high resolution" THEMIS ASI ground-based imager data, from Python ≥ 3.6.

It also reads the THEMIS ASI star registered plate scale, giving azimuth and elevation for each pixel.

Install

  1. install cdflib, which only uses Numpy to read CDF:
    pip install -r requirements.txt
    
  2. install this program
    pip install -e .
    

You can test the basic functionality by from the top cdflib directory:

pytest

Usage

One of the main ways analysts might use THEMIS-ASI data is by loading it into a 3-D array (time, x, y).

Single time

This example is where the ASI video files are in ~/data/themis, and the Gakona site is selected at the time shown.

import themisasi as ta

dat = ta.load('~/data/themis', site='gako', treq='2011-01-06T17:00:03')

This returns the camera image from Gakona camera closest to the requested time, and the 'az', 'el' calibration data, if available.

THEMIS-ASI output xarray.Dataset, which is used throughout geosciences and astronomy as a "smart" Numpy array. The simple image data stack is obtained by:

imgs = dat['imgs']

dat.time contains the approximate time of each image (consider the finite exposure time). dat.x and dat.y are simple pixel indices, perhaps not often needed.

Image + Azimuth, Elevation

Loading calibration data gives azimuth, elevation for each pixel and lat, lon of each camera.

import themisasi as ta

dat = ta.load('~/data/themis', site='gako', treq='2011-01-06T17:00:03')

If an appropriate calibration file exists, dat additionally contains 'az', 'el', 'lat', 'lon' and so on to allow using data for multi-camera analyses. Convert azimuth/elevation to ra/dec using pymap3d.

Download, Read and Plot THEMIS ASI Data

Get video data from Themis all-sky imager data repository. The plate scale data is also downloaded. The calibration files are named *asc*.cdf or *skymap*.sav.

Example: February 4, 2012, 8 UT Gakona

DownloadThemis 2012-02-04T08 gako ~/data

or via the API:

import themisasi as ta

ta.download('2012-02-04T08', 'gako', '~/data')

with the API, it is convenient to for-loop over many sites at the same time(s):

sites = ['fykn', 'gako']

for site in sites:
   ta.download('2012-02-04T08', site, '~/data')

With the calibration data, verify that the time range of the calibration data is appropriate for the time range of the image data. For example, calibration data from 1999 may not be valid for 2018 if the camera was ever moved in the enclosure during maintanence.https://github.com/dib-lab/khmer/pull/1430

You can optionally download from within Python:

import themisasi as ta

ta.download('2012-03-12T12', 'fykn', '~/data')

Video Playback / PNG conversion

This example plays the video content.

Use the -o option to dump the frames to individual PNGs for easier back-and-forth viewing. The calibration file (second filename) is optional.

PlotThemis ~/data/themis/thg_l1_asf_fykn_2013041408_v01.cdf

Plot time series of pixel(s)

Again, be sure the calibration file is appropriate for the time range of the video--the camera may have been moved / reoriented during maintenance.

The pixels can be specified by (azimuth, elevation) or (lat, lon, projection altitude [km])

Azimuth / Elevation:

PlotThemisPixels tests/thg_l1_ast_gako_20110505_v01.cdf -az 65 70 -el 48 68

Latitude, Longitude, Projection Altitude [kilometers]: Typically the brightest aurora is in the 100-110 km altitude range, so a common approximate is to assume "all" of the brightness comes from a single altitude in this region.

PlotThemisPixels tests/thg_l1_ast_gako_20110505_v01.cdf -lla 65 -145 100.

Notes

Themis site map (2009)

Themis site map

Resources

Matlab

The Matlab code is obsolete, the Python version has so much more:

readTHEMIS('thg_l1_asf_fykn_2013041408_v01.cdf')

data corruption

I discovered that IDL 8.0 had a problem saving structured arrays of bytes. While current versions of IDL can read these corrupted .sav files, GDL 0.9.4 and SciPy 0.16.1 cannot. I submitted a patch to SciPy to allow reading these files, which was incorporated into SciPy 0.18.0.

As a fallback, read and rewrite the corrupted file with the IDL script in the idl directory.

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
themisasi-0.8.3.1.tar.gz (20.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page