Optical Spectrograph Data Example

[1]:
%matplotlib inline
from osirisl1services.readlevel1 import open_level1_spectrograph
from osirisl1services.services import Level1Services
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm

FIG_SIZE = (15, 6)

Load the Spectrograph data for orbit 6432, scan 12

[2]:
spectrograph = open_level1_spectrograph(scanno=6432012)

The data and added variables are returned as xarray Datasets

[3]:
print(spectrograph)
<xarray.Dataset>
Dimensions:             (mjd: 24, pixel: 1353)
Coordinates:
  * pixel               (pixel) int64 0 1 2 3 4 5 ... 1348 1349 1350 1351 1352
  * mjd                 (mjd) float64 5.239e+04 5.239e+04 ... 5.239e+04
    stw                 (mjd) int64 598913554 598913602 ... 598914762 598914863
Data variables:
    exposureTime        (mjd) float64 0.0334 0.0336 0.0336 ... 2.489 3.189 3.969
    temperature         (mjd) float64 -12.52 -12.57 -12.46 ... -12.46 -12.47
    tempavg             (mjd) float64 -12.53 -12.48 -12.51 ... -12.47 -12.48
    opticstemp          (mjd) float64 22.83 22.83 22.83 ... 22.83 22.83 22.83
    straptemp           (mjd) float64 -18.22 -18.22 -18.21 ... -18.19 -18.19
    mode                (mjd) int64 4094 4094 4094 4094 ... 4094 4094 4094 4094
    scienceprog         (mjd) int64 21 21 21 21 21 21 21 ... 21 21 21 21 21 21
    roe                 (mjd) int64 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
    shuttermode         (mjd) int64 2 2 2 2 2 2 2 2 2 2 ... 2 2 2 2 2 2 2 2 2 2
    spm_baserow         (mjd) int64 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
    spm_numrows         (mjd) int64 32 32 32 32 32 32 32 ... 32 32 32 32 32 32
    spm_processingMode  (mjd) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1
    targetIndex         (mjd) int64 57615 57615 57615 ... 58407 58407 58671
    exceptions          (mjd) int64 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
    processingflags     (mjd) int64 15 15 15 15 15 15 15 ... 15 15 15 15 15 15
    numcolumns          (mjd) int64 1353 1353 1353 1353 ... 1353 1353 1353 1353
    numrows             (mjd) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1
    data                (mjd, pixel) float64 9.979e+10 1.286e+11 ... 8.467e+09
    error               (mjd, pixel) float64 3.002e+10 5.304e+10 ... 3.638e+08
    flags               (mjd, pixel) int64 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
    scanno              int64 6432012
    radiationhit        (mjd, pixel) float64 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
    wavelength          (pixel) float64 275.0 275.4 275.7 ... 814.0 814.4 814.8
    fwhm                (pixel) float64 0.7763 0.7799 0.7834 ... 0.8287 0.8278

The corresponding pointing, position, tangent point, and sza info can be accessed through the ‘l1’ xarray accessor

[4]:
print(spectrograph.l1.look_ecef)
print(spectrograph.l1.position_ecef)
print(spectrograph.l1.altitude)
<xarray.DataArray (mjd: 24, xyz: 3)>
array([[ 6.960210e-01, -7.178193e-01,  1.703710e-02],
       [ 6.956562e-01, -7.182248e-01,  1.468221e-02],
       [ 6.952846e-01, -7.186301e-01,  1.225597e-02],
       [ 6.949148e-01, -7.190245e-01,  9.855243e-03],
       [ 6.945281e-01, -7.194274e-01,  7.406248e-03],
       [ 6.941494e-01, -7.198135e-01,  5.017077e-03],
       [ 6.937357e-01, -7.202255e-01,  2.465687e-03],
       [ 6.933297e-01, -7.206205e-01, -3.486342e-05],
       [ 6.929351e-01, -7.209959e-01, -2.421113e-03],
       [ 6.925424e-01, -7.213612e-01, -4.805545e-03],
       [ 6.921412e-01, -7.217261e-01, -7.202318e-03],
       [ 6.917235e-01, -7.220980e-01, -9.646640e-03],
       [ 6.912889e-01, -7.224771e-01, -1.210189e-02],
       [ 6.907253e-01, -7.229540e-01, -1.536502e-02],
       [ 6.902873e-01, -7.233146e-01, -1.787548e-02],
       [ 6.898208e-01, -7.236900e-01, -2.049553e-02],
       [ 6.893417e-01, -7.240652e-01, -2.318593e-02],
       [ 6.888305e-01, -7.244562e-01, -2.599527e-02],
       [ 6.882799e-01, -7.248663e-01, -2.897682e-02],
       [ 6.875794e-01, -7.253704e-01, -3.274565e-02],
       [ 6.869026e-01, -7.258421e-01, -3.630625e-02],
       [ 6.860724e-01, -7.263981e-01, -4.062754e-02],
       [ 6.851320e-01, -7.269977e-01, -4.547990e-02],
       [ 6.840113e-01, -7.276710e-01, -5.121881e-02]])
Coordinates:
  * mjd      (mjd) float64 5.239e+04 5.239e+04 5.239e+04 ... 5.239e+04 5.239e+04
  * xyz      (xyz) <U1 'x' 'y' 'z'
<xarray.DataArray (mjd: 24, xyz: 3)>
array([[-1426337.795434,  2715909.73755 ,  6258025.750345],
       [-1410515.099375,  2702301.439179,  6267461.618616],
       [-1394688.428789,  2688663.08811 ,  6276829.282997],
       [-1379178.386612,  2675270.175469,  6285940.2712  ],
       [-1363331.878801,  2661559.608993,  6295176.751573],
       [-1347806.788511,  2648100.156951,  6304154.841248],
       [-1331280.491928,  2633743.447953,  6313638.38987 ],
       [-1315078.011833,  2619639.19664 ,  6322862.495436],
       [-1299518.497797,  2606067.794977,  6331651.140912],
       [-1283929.609635,  2592442.730886,  6340386.496844],
       [-1268322.516976,  2578776.27396 ,  6349060.516585],
       [-1252358.376961,  2564768.992313,  6357865.525599],
       [-1236368.035008,  2550711.119311,  6366612.803383],
       [-1214972.915156,  2531858.157954,  6378205.204038],
       [-1198538.893218,  2517341.415145,  6387021.112253],
       [-1181366.854136,  2502142.770765,  6396150.257663],
       [-1163769.990443,  2486534.941695,  6405422.710982],
       [-1145373.293471,  2470180.210872,  6415024.926293],
       [-1125826.974308,  2452763.42033 ,  6425123.45874 ],
       [-1101133.764237,  2430701.23945 ,  6437724.490589],
       [-1077742.559821,  2409741.265548,  6449509.30009 ],
       [-1049332.069014,  2384203.350786,  6463618.794711],
       [-1017496.053067,  2355481.924996,  6479158.951697],
       [ -981765.85855 ,  2323116.122866,  6496272.720967]])
Coordinates:
  * mjd      (mjd) float64 5.239e+04 5.239e+04 5.239e+04 ... 5.239e+04 5.239e+04
  * xyz      (xyz) <U1 'x' 'y' 'z'
<xarray.DataArray (mjd: 24)>
array([ 9353.564125, 11813.369658, 14065.143531, 16197.961296, 18375.237395,
       20528.66027 , 22787.616943, 24999.426146, 27157.123946, 29330.245677,
       31466.593173, 33665.334169, 35833.863534, 38796.272683, 41049.435311,
       43399.341118, 45787.695192, 48281.496459, 50927.732639, 54245.912678,
       57400.222827, 61220.568616, 65444.679743, 69356.17431 ])
Coordinates:
  * mjd      (mjd) float64 5.239e+04 5.239e+04 5.239e+04 ... 5.239e+04 5.239e+04

Plot the data

[5]:
spectrograph.data.plot(x='pixel', y='mjd', norm=LogNorm(), vmin=1e10, vmax=1e14, figsize=FIG_SIZE)
[5]:
<matplotlib.collections.QuadMesh at 0x7ff863949518>
/opt/conda/envs/doc_env/lib/python3.6/site-packages/matplotlib/colors.py:1110: RuntimeWarning: invalid value encountered in less_equal
  mask |= resdat <= 0
../_images/examples_os_examples_9_2.png

Load the Spectrograph data for orbit 6432, scan 12 with the RSAS correction

[6]:
spect_rsas = open_level1_spectrograph(scanno=6432012, apply_rsas=True)