Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.times is None:
self.times = time_seconds(self._data["timecode"], self.year)
scanline_nb = len(self.times)
scan_points = np.arange(0, 2048, 32)
# scan_points = np.arange(2048)
sgeom = avhrr(scanline_nb, scan_points, apply_offset=False)
# no attitude error
rpy = [0, 0, 0]
s_times = sgeom.times(
self.times[:, np.newaxis]).ravel()
# s_times = (np.tile(sgeom._times[0, :], (scanline_nb, 1)).astype(
# 'timedelta64[s]') + self.times[:, np.newaxis]).ravel()
orb = Orbital(self.platform_name)
pixels_pos = compute_pixels(orb, sgeom, s_times, rpy)
lons, lats, alts = get_lonlatalt(pixels_pos, s_times)
self.lons, self.lats = geo_interpolate(
lons.reshape((scanline_nb, -1)), lats.reshape((scanline_nb, -1)))
return self.lons, self.lats
def update_graph_live():
satellite = Orbital('TERRA')
data = {
'time': [],
'Latitude': [],
'Longitude': [],
'Altitude': []
}
# Collect some data
for i in range(180):
time = datetime.datetime.now() - datetime.timedelta(seconds=i*20)
lon, lat, alt = satellite.get_lonlatalt(
time
)
data['Longitude'].append(lon)
data['Latitude'].append(lat)
data['Altitude'].append(alt)
def update_graph_live(n):
satellite = Orbital("TERRA")
data = {"time": [], "Latitude": [], "Longitude": [], "Altitude": []}
# Collect some data
for i in range(180):
time = datetime.datetime.now() - datetime.timedelta(seconds=i * 20)
lon, lat, alt = satellite.get_lonlatalt(time)
data["Longitude"].append(lon)
data["Latitude"].append(lat)
data["Altitude"].append(alt)
data["time"].append(time)
# Create the graph with subplots
fig = plotly.tools.make_subplots(rows=2, cols=1, vertical_spacing=0.2)
fig["layout"]["margin"] = {"l": 30, "r": 10, "b": 30, "t": 10}
fig["layout"]["legend"] = {"x": 0, "y": 1, "xanchor": "left"}
def get_lonlat(scene, row, col):
"""Get the longitutes and latitudes for the give *rows* and *cols*.
"""
try:
filename = get_filename(scene, "granules")
except IOError:
#from mpop.satin.eps1a import get_lonlat_avhrr
# return get_lonlat_avhrr(scene, row, col)
from pyorbital.orbital import Orbital
import pyproj
from datetime import timedelta
start_time = scene.time_slot
end_time = scene.time_slot + timedelta(minutes=3)
orbital = Orbital("METOP-A")
track_start = orbital.get_lonlatalt(start_time)
track_end = orbital.get_lonlatalt(end_time)
geod = pyproj.Geod(ellps='WGS84')
az_fwd, az_back, dist = geod.inv(track_start[0], track_start[1],
track_end[0], track_end[1])
del dist
M02_WIDTH = 2821885.8962408099
pos = ((col - 1024) * M02_WIDTH) / 2048.0
if row > 520:
lonlatdist = geod.fwd(track_end[0], track_end[1],
az_back - 86.253533216206648, -pos)
else:
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import datetime
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly
from dash.dependencies import Input, Output
from pyorbital.orbital import Orbital
satellite = Orbital("TERRA")
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(
html.Div(
[
html.H4("TERRA Satellite Live Feed"),
html.Div(id="live-update-text"),
dcc.Graph(id="live-update-graph"),
dcc.Interval(
id="interval-component",
interval=1 * 1000, # in milliseconds
n_intervals=0,
),
]
def navigate(timecodes, satellite):
orb = Orbital(satellite)
first_time = timecode(timecodes[0])
first_time = datetime(first_time.year, first_time.month, first_time.day)
hrpttimes = [timecode(x) - first_time for x in timecodes]
hrpttimes = np.array([x.seconds + x.microseconds / 1000000.0
for x in hrpttimes])
scan_points = np.arange(2048)
if satellite == "noaa 16":
scan_angle = 55.25
else:
scan_angle = 55.37
scans_nb = len(hrpttimes)
avhrr_inst = np.vstack(((scan_points / 1023.5 - 1)
import datetime
import dash
from dash.dependencies import Input, Output, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly
# pip install pyorbital
from pyorbital.orbital import Orbital
satellite = Orbital('TERRA')
app = dash.Dash(__name__)
app.layout = html.Div(
html.Div([
html.H4('TERRA Satellite Live Feed'),
html.Div(id='live-update-text'),
dcc.Graph(id='live-update-graph'),
dcc.Interval(
id='interval-component',
interval=1*1000 # in milliseconds
)
])
)
# The `dcc.Interval` component emits an event called "interval"
# every `interval` number of milliseconds.
def get_orbital(self):
from pyorbital.orbital import Orbital
from pyorbital import tlefile
from pyorbital.tlefile import get_norad_line
sat_line = get_norad_line(self.satname, self.number)
self.orbital = Orbital(sat_line)
return self.orbital