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
Data variables: (12/24)
    stw                 (mjd) int64 598913554 598913602 ... 598914762 598914863
    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
    ...                  ...
    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
    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.96021000e-01, -7.17819270e-01,  1.70371019e-02],
       [ 6.95656237e-01, -7.18224779e-01,  1.46822149e-02],
       [ 6.95284574e-01, -7.18630052e-01,  1.22559680e-02],
       [ 6.94914827e-01, -7.19024518e-01,  9.85524298e-03],
       [ 6.94528150e-01, -7.19427409e-01,  7.40624777e-03],
       [ 6.94149375e-01, -7.19813500e-01,  5.01707671e-03],
       [ 6.93735660e-01, -7.20225488e-01,  2.46568737e-03],
       [ 6.93329727e-01, -7.20620489e-01, -3.48634212e-05],
       [ 6.92935134e-01, -7.20995866e-01, -2.42111297e-03],
       [ 6.92542393e-01, -7.21361172e-01, -4.80554499e-03],
       [ 6.92141246e-01, -7.21726141e-01, -7.20231789e-03],
       [ 6.91723490e-01, -7.22098024e-01, -9.64663975e-03],
       [ 6.91288927e-01, -7.22477103e-01, -1.21018874e-02],
       [ 6.90725278e-01, -7.22954014e-01, -1.53650227e-02],
       [ 6.90287264e-01, -7.23314566e-01, -1.78754815e-02],
       [ 6.89820786e-01, -7.23690001e-01, -2.04955303e-02],
       [ 6.89341715e-01, -7.24065200e-01, -2.31859252e-02],
       [ 6.88830536e-01, -7.24456168e-01, -2.59952700e-02],
       [ 6.88279851e-01, -7.24866326e-01, -2.89768227e-02],
       [ 6.87579446e-01, -7.25370407e-01, -3.27456549e-02],
       [ 6.86902561e-01, -7.25842081e-01, -3.63062530e-02],
       [ 6.86072354e-01, -7.26398050e-01, -4.06275401e-02],
       [ 6.85132021e-01, -7.26997726e-01, -4.54798996e-02],
       [ 6.84011346e-01, -7.27671019e-01, -5.12188129e-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.79543392,  2715909.73754952,  6258025.75034525],
       [-1410515.09937542,  2702301.43917898,  6267461.61861551],
       [-1394688.42878909,  2688663.08810965,  6276829.28299736],
       [-1379178.38661241,  2675270.17546903,  6285940.27119958],
       [-1363331.87880057,  2661559.60899312,  6295176.75157329],
       [-1347806.78851058,  2648100.15695065,  6304154.8412481 ],
       [-1331280.49192844,  2633743.44795343,  6313638.38986957],
       [-1315078.01183283,  2619639.19664045,  6322862.49543575],
       [-1299518.4977968 ,  2606067.79497687,  6331651.14091231],
       [-1283929.60963458,  2592442.73088568,  6340386.49684442],
       [-1268322.51697616,  2578776.27395961,  6349060.516585  ],
       [-1252358.3769611 ,  2564768.99231264,  6357865.52559949],
       [-1236368.0350076 ,  2550711.11931075,  6366612.80338334],
       [-1214972.91515561,  2531858.15795401,  6378205.20403754],
       [-1198538.8932184 ,  2517341.41514536,  6387021.11225288],
       [-1181366.85413574,  2502142.77076485,  6396150.25766338],
       [-1163769.99044262,  2486534.9416949 ,  6405422.71098155],
       [-1145373.29347099,  2470180.21087156,  6415024.92629261],
       [-1125826.97430844,  2452763.42033029,  6425123.45874035],
       [-1101133.76423662,  2430701.23945043,  6437724.49058903],
       [-1077742.55982099,  2409741.26554837,  6449509.30008967],
       [-1049332.06901405,  2384203.35078605,  6463618.79471143],
       [-1017496.05306651,  2355481.92499578,  6479158.95169729],
       [ -981765.85854983,  2323116.12286567,  6496272.72096662]])
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([ 9356.55841476, 11816.36394669, 14068.13781949, 16200.95558411,
       18378.2316834 , 20531.65455832, 22790.61123101, 25002.42043392,
       27160.11823404, 29333.23996456, 31469.58746095, 33668.32845769,
       35836.85782256, 38799.26697192, 41052.4296007 , 43402.33540845,
       45790.68948273, 48284.49075121, 50930.72693182, 54248.90697218,
       57403.21712241, 61223.56291341, 65447.67404297, 69359.16861327])
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 0x7f8ae855ee10>
../_images/examples_os_examples_9_1.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)