In [2]:
# These first two lines configure the notebook to embed any plots graphed
# in the body of the notebook
%matplotlib inline
%config InlineBackend.figure_formats=['svg']
# Standard csv and file io python libraries
import csv
import io
import os
# Library for loading data from a webpage (Python 2 and 3 compatible)
from future.standard_library import install_aliases
install_aliases()
from urllib.request import urlopen, Request
# Main python library for mathematical calculations
import numpy as np
# Plotting related python libraries
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
# Python libraries for manipulating dates and times as objects
import time
import datetime as dt
from matplotlib.dates import date2num
In [3]:
def getDataInTimeRange(data,times,tstart,tstop):
data_array = np.array(data)
t_array = np.array([t.timestamp() for t in times])
tstart_sec = tstart.timestamp()
tstop_sec = tstop.timestamp()
value_indices = np.where((t_array>=tstart_sec)&(t_array<=tstop_sec))
data_select = data_array[value_indices]
return data_select.tolist()
In [ ]: