This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outputdf = pd.DataFrame() | |
outputdf['satid'] = satname['satid'] | |
outputdf['satname'] = satname['satname'] | |
outputdf['satlat'] = satpos['satlatitude'] | |
outputdf['satlon'] = satpos['satlongitude'] | |
outputdf['azimuth'] = satpos['azimuth'] | |
outputdf['elevation'] = satpos['elevation'] | |
outputdf['ra'] = satpos['ra'] | |
outputdf['decval'] = satpos['dec'] | |
outputdf['postimestamp'] = satpos['timestamp'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outputdf[["satid"]] = outputdf[["satid"]].apply(np.int32) | |
outputdf[["satlat", "satlon", "azimuth", "elevation", "ra", "decval"]] = outputdf[["satlat", "satlon", "azimuth", "elevation", "ra", "decval"]].apply(np.float32) | |
outputdf[["postimestamp"]] = pd.to_datetime(outputdf["postimestamp"], unit='s') | |
outputdf.dtypes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An Ibis connection object (con) is created on notebook startup, which | |
# includes a pymapd.connection object as a property (con.con). | |
# If you receive a session invalid or object not found error using it, | |
# please close the Jupyter Lab browser tab, relaunch from Immerse, | |
# and run this cell to recreate your con object using the | |
# omnisci_connect function. | |
con = omnisci_connect() | |
con.list_tables() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outputdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = ibis.pandas.connect({'satelliteblog': outputdf}) | |
dftbl = p.table('satelliteblog') | |
dftbl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE satelliteblog ( | |
satid INTEGER, | |
satname TEXT ENCODING DICT(32), | |
satlat FLOAT, | |
satlon FLOAT, | |
azimuth FLOAT, | |
elevation FLOAT, | |
ra FLOAT, | |
decval FLOAT, | |
postimestamp TIMESTAMP(0)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if dftbl.schema() == t.schema(): | |
print ('schemas match, exiting') | |
else: | |
print ('schemas dont match') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"info":{"satname":"SPACE STATION","satid":25544,"transactionscount":0},"positions":[{"satlatitude":48.35294684,"satlongitude":111.35490663,"sataltitude":424.63,"azimuth":355.11,"elevation":-43.01,"ra":232.42210261,"dec":5.25374852,"timestamp":1621527986,"eclipsed":true}]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
outputdf = getsatpos(satid) | |
con.con.load_table(t.name, outputdf) | |
time.sleep(5) # Sleep for 5 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW v_satellitecurrentlocation AS ( | |
SELECT | |
* | |
FROM | |
satellitelocations t1 | |
INNER JOIN ( | |
SELECT | |
MAX(postimestamp) as postimestamp, | |
satid | |
FROM |