In [1]:
%matplotlib inline
import mpld3
mpld3.enable_notebook()
import matplotlib.pyplot as plt
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:29:09.278298. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [2]:
# import ifg.shis.rdr.valid as val
from pyfbf import Workspace
import numpy as np
W = Workspace('rdr20170328T161512end20170328T231525sdr20170329T002148')
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:29:14.740144. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [3]:
pitch,roll,segments,smp,sequences = W['Pitch'][:], W['Roll'][:], W['segments'][:], W['sceneMirrorPosition'][:], W['intactMirrorSequences'][:]
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:29:16.756083. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [5]:
gudrex = np.argwhere(smp==ord('E'))

fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
# ax.plot(seg, color='blue')
ax.plot(gudrex, segments[gudrex], color='green')
# ax.legend(['test segmentize', 'original segments'])
ax.set_title('segments.int4 test for E views sh170328')
Out[5]:
<matplotlib.text.Text at 0x7f4a09aa9910>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:29:30.565198. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [6]:
' '.join(str(x) for x in sorted(set(segments)))
Out[6]:
'-58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 66'
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:29:36.241107. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [7]:
fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(roll, alpha=0.7, color='blue', linewidth=0.5)
ax.plot(pitch, alpha=0.7, color='green', linewidth=0.5)
ax.legend(['Roll', 'Pitch'])
# ax.set_title()
Out[7]:
<matplotlib.legend.Legend at 0x7f4a100a63d0>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:29:41.709841. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [13]:
s,e = 16000,30000

fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(roll[s:e], alpha=0.7, linewidth=0.5, color='blue')
ax.plot(roll[s:e], alpha=0.7, linewidth=0.5, color='green')
ax.plot(np.sign(segments[s:e]) * 20, linewidth=0.5, color='red')
# plot(np.require(ok[s:e], dtype=np.int32) * 25)
ax.legend(['Roll', 'Pitch', 'segments sign'])
ax.set_title('Attitude excerpt sh170328')
ax.set_xlabel('record offset')
ax.set_ylabel('degrees')
Out[13]:
<matplotlib.text.Text at 0x7f4a09b0f510>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:32:36.859498. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [9]:
unroll, turnroll, flatroll, calroll = np.array(roll), np.array(roll), np.array(roll), np.array(roll)
eview = smp==ord('E')
unroll[(segments!=0) | ~eview] = np.NAN
turnroll[(segments>=0) | ~eview] = np.NAN
flatroll[(segments<=0) | ~eview] = np.NAN
calroll[eview] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid') 
ax.plot(calroll, alpha=0.7, linewidth=0.5, color='purple')
ax.plot(unroll, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatroll, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnroll, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('Roll for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[9]:
<matplotlib.legend.Legend at 0x7f4a0a226b50>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:30:09.374246. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [10]:
unpitch, turnpitch, flatpitch, calpitch = np.array(pitch), np.array(pitch), np.array(pitch), np.array(pitch)
eview = smp==ord('E')
unpitch[(segments!=0) | ~eview] = np.NAN
turnpitch[(segments>=0) | ~eview] = np.NAN
flatpitch[(segments<=0) | ~eview] = np.NAN
calpitch[eview] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(calpitch, alpha=0.6, linewidth=0.5, color='purple')
ax.plot(unpitch, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatpitch, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnpitch, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('pitch for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[10]:
<matplotlib.legend.Legend at 0x7f4a08c52f90>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:30:20.398039. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [11]:
lat, lon = W['instrumentLatitude'][:], W['instrumentLongitude'][:]

unlat, turnlat, flatlat, callat = np.array(lat), np.array(lat), np.array(lat), np.array(lat)
eview = smp==ord('E')
unlat[(segments!=0) | (lat==0) | ~eview] = np.NAN
turnlat[(segments>=0) | (lat==0) | ~eview] = np.NAN
flatlat[(segments<=0) | (lat==0) | ~eview] = np.NAN
callat[eview | (lon==0)] = np.NAN

unlon, turnlon, flatlon, callon = np.array(lon), np.array(lon), np.array(lon), np.array(lon)
eview = smp==ord('E')
unlon[(segments!=0) | (lon==0) | ~eview] = np.NAN
turnlon[(segments>=0) | (lon==0) | ~eview] = np.NAN
flatlon[(segments<=0) | (lon==0) | ~eview] = np.NAN
callon[eview | (lon==0)] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(callon, callat, alpha=0.6, linewidth=0.5, color='purple')
ax.plot(unlon, unlat, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatlon, flatlat, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnlon, turnlat, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('flight track for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[11]:
<matplotlib.legend.Legend at 0x7f4a09aede50>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:30:27.576921. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [14]:
import netCDF4 as nc4
nc = nc4.Dataset('rdr20170328T161512end20170328T231525sdr20170329T002148/dist/goes16_SHIS_20170328_161512_20170328_231525_sdr20170329T002148_rad.nc')
lat, lon, segments, eview = nc.variables['instrumentLatitude'][:], nc.variables['instrumentLongitude'][:], nc.variables['segments'][:], True
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:34:41.767639. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [15]:
unlat, turnlat, flatlat, callat = np.array(lat), np.array(lat), np.array(lat), np.array(lat)
unlat[(segments!=0) | (lat==0)] = np.NAN
turnlat[(segments>=0) | (lat==0)] = np.NAN
flatlat[(segments<=0) | (lat==0)] = np.NAN

unlon, turnlon, flatlon, callon = np.array(lon), np.array(lon), np.array(lon), np.array(lon)
unlon[(segments!=0) | (lon==0)] = np.NAN
turnlon[(segments>=0) | (lon==0)] = np.NAN
flatlon[(segments<=0) | (lon==0)] = np.NAN

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(unlon, unlat, alpha=0.9, linewidth=0.5, color='red')
ax.plot(flatlon, flatlat, alpha=0.9, linewidth=0.5, color='blue')
ax.plot(turnlon, turnlat, alpha=0.9, linewidth=0.5, color='green')

ax.set_title('NetCDF flight track for Segment-Categorized Views')
ax.legend(['segments==0', 'segments>0', 'segments<0'])
Out[15]:
<matplotlib.legend.Legend at 0x7f4a08ccc7d0>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:34:52.592961. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [16]:
' '.join(str(x) for x in sorted(set(segments)))
Out[16]:
'-58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 66'
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:35:03.786746. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [17]:
fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')
ax.plot(segments)
Out[17]:
[<matplotlib.lines.Line2D at 0x7f4a01e3d350>]
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:35:06.957308. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [18]:
s,e = 6000, 14000

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, axisbg='#EEEEEE')
ax.grid(color='white', linestyle='solid')

ax.plot(unlon[s:e], unlat[s:e], alpha=0.6, linewidth=10, color='red')
ax.plot(flatlon[s:e], flatlat[s:e], alpha=0.6, linewidth=10, color='blue')
ax.plot(turnlon[s:e], turnlat[s:e], alpha=0.6, linewidth=10, color='green')

fovlat, fovlon = nc['Latitude'][:], nc['Longitude'][:]

funlat, fturnlat, fflatlat, fcallat = np.array(fovlat), np.array(fovlat), np.array(fovlat), np.array(fovlat)
funlat[(segments!=0) | (lat==0)] = np.NAN
fturnlat[(segments>=0) | (lat==0)] = np.NAN
fflatlat[(segments<=0) | (lat==0)] = np.NAN

funlon, fturnlon, fflatlon, fcallon = np.array(fovlon), np.array(fovlon), np.array(fovlon), np.array(fovlon)
funlon[(segments!=0) | (lon==0)] = np.NAN
fturnlon[(segments>=0) | (lon==0)] = np.NAN
fflatlon[(segments<=0) | (lon==0)] = np.NAN

ax.plot(funlon[s:e], funlat[s:e], '.', alpha=0.9, linewidth=0.5, color='red')
ax.plot(fflatlon[s:e], fflatlat[s:e], '.', alpha=0.9, linewidth=0.5, color='blue')
ax.plot(fturnlon[s:e], fturnlat[s:e], '.', alpha=0.9, linewidth=0.5, color='green')

ax.set_title('FOV track for Segment-Categorized Views')
ax.legend(['not earth', 'segments==0', 'segments>0', 'segments<0'])
Out[18]:
<matplotlib.legend.Legend at 0x7f4a08b70a10>
/home/rayg/.conda/envs/shis/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-29 01:35:34.661131. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)
In [ ]: