Skip to content
Snippets Groups Projects
Commit d43140ff authored by Sabine Schröder's avatar Sabine Schröder
Browse files

found matching radius for merging stations, completed translation tables for...

found matching radius for merging stations, completed translation tables for controlled vocabulary (type_of_environment and type_of_area)
parent 8c568e4d
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,9 @@ from io import StringIO
import json
import requests
from urllib3.exceptions import InsecureRequestWarning
TOAR_SERVICE_URL = 'http://127.0.0.1:8000/'
TOAR_SERVICE_URL = 'https://join-dev.fz-juelich.de:8443/'
# from old database:
# station_coordinate_status:
......@@ -67,18 +68,31 @@ tr_climatic_zone = {
12 : 'TropicalDry' }
tr_type_of_environment = {
'unknown' : 'Unknown',
'background' : 'Background',
'traffic' : 'Traffic',
'industrial' : 'Industrial',
'other' : 'Other' }
'unknown' : 'Unknown',
'' : 'Unknown',
'traffic' : 'Traffic',
'industrial' : 'Industrial',
'other' : 'Other',
'urban' : 'Other',
'commercial' : 'Other',
'background' : 'Background',
'agricultural' : 'Background',
'other-marine' : 'Background',
'other-agricultural': 'Background' }
tr_type_of_area = {
'unknown' : 'Unknown',
'urban' : 'Urban',
'suburban' : 'Suburban',
'rural' : 'Rural',
'remote' : 'Remote' }
'unknown' : 'Unknown',
'' : 'Unknown',
'urban' : 'Urban',
'suburban' : 'Suburban',
'rural' : 'Rural',
'rural-remote' : 'Rural',
'rural-nearcity' : 'Rural',
'rural-regional' : 'Rural',
'alpine grasslands': 'Rural',
'forest' : 'Rural',
'remote' : 'Remote',
'marine' : 'Remote' }
if __name__ == "__main__":
......@@ -88,7 +102,11 @@ if __name__ == "__main__":
headers = { 'Content-Type': 'application/json',
'accept': 'application/json',
'Authorization': 'Token ' + access_token }
insecure_ssl=True
# insecure_ssl=True
insecure_ssl=False
# Suppress only the single warning from urllib3 needed.
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
column_names = [
'numid',
......
......@@ -116,7 +116,7 @@ def create_stationmeta(db: Session, engine: Engine, stationmeta: StationmetaCrea
db_stationmeta.additional_metadata = str(db_stationmeta.additional_metadata).replace("'",'"')
fake_conn = engine.raw_connection()
fake_cur = fake_conn.cursor()
radius = 100
radius = 10
db_cmd = f"select * from stationmeta_core where ST_DistanceSphere(stationmeta_core.coordinates, '{db_stationmeta.coordinates}') < {radius}"
fake_cur.execute(db_cmd)
records = fake_cur.fetchall()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment