forked from thegraphnetwork/epigraphhub_py
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added geo file upload function.
- Loading branch information
Showing
8 changed files
with
456 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import atexit | ||
|
||
from sshtunnel import SSHTunnelForwarder | ||
|
||
|
||
class Tunnel: | ||
def __init__(self): | ||
self.host = "epigraphhub.org" | ||
self.server = None | ||
atexit.register(self.close_tunnel) | ||
|
||
def open_tunnel(self, user="epigraph", ssh_key_passphrase=""): | ||
""" | ||
Opens a tunnel to EpigraphHub database | ||
""" | ||
self.server = SSHTunnelForwarder( | ||
self.host, | ||
ssh_username=user, | ||
ssh_password="epigraph", | ||
ssh_private_key_password=ssh_key_passphrase, | ||
remote_bind_address=("127.0.0.1", 5432), | ||
) | ||
|
||
self.server.start() | ||
|
||
def __repr__(self): | ||
if self.server is None: | ||
return "Tunnel is closed." | ||
else: | ||
return f"Port {self.server.local_bind_port} is being forwarded to {self.host}:5432" | ||
|
||
def close_tunnel(self): | ||
if not self.server is None: | ||
print("Closing Tunnel...") | ||
self.server.stop() | ||
self.server = None |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import arviz as az | ||
import pandas as pd | ||
import pymc3 as pm |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import geopandas as gpd | ||
import pandas as pd | ||
|
||
|
||
def upload_geo_file(fname): | ||
gdf = gpd.read_file(fname) |
Oops, something went wrong.