- add Laakirchen sensors
This commit is contained in:
parent
fb010174b7
commit
49d348678f
84
automatic_inclinometer/firebird_queries.sql
Normal file
84
automatic_inclinometer/firebird_queries.sql
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
SELECT a.CATENA, a.SENSORE, a.DATA, a.ORA, a.TENSIONE, a.ASSORBIMENTO, c.NOME
|
||||||
|
FROM ALIMENTAZIONI as a, CATENE as c
|
||||||
|
WHERE c.CHIAVE = a.CATENA AND
|
||||||
|
c.NOME = 'Sibratsgfall';
|
||||||
|
|
||||||
|
|
||||||
|
SELECT "DATI_ACQUISITI"."PITCH", "DATI_ACQUISITI"."ROLL", "DATI_ACQUISITI"."ORA", "DATI_ACQUISITI"."SENSORE", "DATI_ACQUISITI"."DATA", "DATI_ACQUISITI"."TEMPERATURA", "DATI_ACQUISITI"."CATENA", "CATENE_1"."CHIAVE", "CATENE_1"."NOME"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA" LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "DATI_ACQUISITI"."SENSORE" = 1 AND "CATENE"."NOME" = 'Sibratsgfall'
|
||||||
|
|
||||||
|
|
||||||
|
SELECT COUNT(*), SENSORE
|
||||||
|
FROM DATI_ACQUISITI GROUP BY SENSORE
|
||||||
|
|
||||||
|
SELECT "DATI_ACQUISITI"."SENSORE", "CATENE_1"."NOME"
|
||||||
|
|
||||||
|
SELECT COUNT(*), "DATI_ACQUISITI"."SENSORE"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA" LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "CATENE_1"."NOME" = 'GSA01A-033-0909'
|
||||||
|
GROUP BY "DATI_ACQUISITI"."SENSORE"
|
||||||
|
|
||||||
|
SELECT COUNT(*), "DATI_ACQUISITI"."SENSORE"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "CATENE_1"."NOME" = 'Sibratsgfall'
|
||||||
|
GROUP BY "DATI_ACQUISITI"."SENSORE"
|
||||||
|
|
||||||
|
SELECT "DATI_ACQUISITI"."PITCH", "DATI_ACQUISITI"."ROLL", "DATI_ACQUISITI"."SENSORE"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA" LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "CATENE_1"."NOME" = 'Sibratsgfall'
|
||||||
|
|
||||||
|
|
||||||
|
SELECT COUNT(*), "DATI_ACQUISITI"."SENSORE"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA" LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "CATENE_1"."NOME" = 'GSA02B-007-0911'
|
||||||
|
GROUP BY "DATI_ACQUISITI"."SENSORE"
|
||||||
|
|
||||||
|
SELECT "DATI_ACQUISITI"."PITCH", "DATI_ACQUISITI"."ROLL", "DATI_ACQUISITI"."SENSORE"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA" LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "CATENE_1"."NOME" = 'GSA02B-007-0911'
|
||||||
|
|
||||||
|
SELECT CHIAVE, NOME, NUMERO_SENSORI, SITO
|
||||||
|
FROM CATENE ORDER BY CHIAVE ;
|
||||||
|
|
||||||
|
SELECT a.CATENA, a.SENSORE, a.DATA, a.ORA, a.TENSIONE, a.ASSORBIMENTO, c.NOME
|
||||||
|
FROM ALIMENTAZIONI as a, CATENE as c
|
||||||
|
WHERE c.CHIAVE = a.CATENA AND
|
||||||
|
c.NOME = 'TAC003-020-0517';
|
||||||
|
|
||||||
|
SELECT COUNT(*), "DATI_ACQUISITI"."SENSORE"
|
||||||
|
FROM "DATI_ACQUISITI"
|
||||||
|
JOIN "CATENE" ON "CATENE"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
LEFT OUTER JOIN "CATENE" AS "CATENE_1" ON "CATENE_1"."CHIAVE" = "DATI_ACQUISITI"."CATENA"
|
||||||
|
WHERE "CATENE_1"."NOME" = 'TAC003-020-0517'
|
||||||
|
GROUP BY "DATI_ACQUISITI"."SENSORE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CHIAVE NOME NUMERO_SENSORI SITO x y
|
||||||
|
2 Sibratsgfall 17 Sibratsgfaell 47.4279229,10.0360845
|
||||||
|
3 GSA01A-033-0909 34 Gschliefgraben (Gmunden) 47.8845629,13.8199351
|
||||||
|
5 GSA002-017-0510 17 Rosano 43.7685394,11.4232703
|
||||||
|
6 GSA02A-010-1210 10 Ampflwang - KB1 48.0889892,13.5583703
|
||||||
|
7 GSA02B-007-1210 17 Ampflwang - KB2 48.088,13.5583
|
||||||
|
8 GSA02B-007-0911 19 Laakirchen 47.9789118,13.8141457
|
||||||
|
9 Copy of GSA002-017-0510 17 Rosano 43.7685394,11.4232703
|
||||||
|
10 GSA02B-007-0613 17 Pechgraben Haus 47.9193704,14.5242307
|
||||||
|
11 Copy of GSA02B-007-0911 19 Laakirchen 47.9789118,13.8141457
|
||||||
|
12 GSA02A-010-0613 10 Pechgraben Wiese 47.9193704,14.5242307
|
||||||
|
13 TAC003-020-0713 20 Pechgraben 47.9193704,14.5242307
|
||||||
|
14 TAC003-020-1213 20 Pechgraben KB1 47.9193704,14.5242307
|
||||||
|
15 GSA02A-010-1213 10 Pechgraben KB2 47.9193704,14.5242307
|
||||||
|
16 TAC003-020-0414 20 Pechgraben KB1 47.9193704,14.5242307
|
||||||
|
17 TAC003-020-0517 20 Wolfsegg KB1 48.1064354,13.6731638
|
||||||
|
18 GSA02A-010-0517 10 Wolfsegg KB3 48.1064354,13.6731638
|
||||||
|
19 TAC005-013-0517 14 Wolfsegg KB2 48.1064354,13.6731638
|
||||||
|
20 GSA003-020-0517 34 Wolfsegg KB5 48.1064354,13.6731638
|
||||||
|
21 Copy of TAC003-020-0517 20 Wolfsegg KB1 48.1064354,13.6731638
|
|
@ -27,7 +27,7 @@ def main():
|
||||||
feature_of_interest = 'TAC003-020-0517' # Wolfsegg KB1
|
feature_of_interest = 'TAC003-020-0517' # Wolfsegg KB1
|
||||||
# sensor name in postgis db
|
# sensor name in postgis db
|
||||||
sensor = 'wolfsegg_kb1_0'
|
sensor = 'wolfsegg_kb1_0'
|
||||||
platform = 'wolfsegg'
|
platform = 'wolfsegg_inclinometer'
|
||||||
|
|
||||||
firebird_session: session = create_session()
|
firebird_session: session = create_session()
|
||||||
# db_observation = session.query(Observation) \
|
# db_observation = session.query(Observation) \
|
||||||
|
|
|
@ -0,0 +1,238 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""This module does blah blah."""
|
||||||
|
|
||||||
|
from ast import List
|
||||||
|
import requests
|
||||||
|
# from insert_sensor.transactional import insert_sensor
|
||||||
|
from insert_sensor.wrapper import (Offering, FoI, Procedure, SensorType)
|
||||||
|
# import json
|
||||||
|
|
||||||
|
|
||||||
|
class Sos():
|
||||||
|
"""
|
||||||
|
A class to represent a sos service.
|
||||||
|
...
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
sosurl : str
|
||||||
|
first name of the person
|
||||||
|
token : str
|
||||||
|
token to access soso service
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, url, token=''):
|
||||||
|
self.sosurl = str(url) # url to access the SOS
|
||||||
|
self.token = str(token) # security token, optional
|
||||||
|
# Test if URL exists
|
||||||
|
try:
|
||||||
|
test = requests.get(self.sosurl)
|
||||||
|
test.raise_for_status()
|
||||||
|
except requests.HTTPError:
|
||||||
|
print("The URL is not valid")
|
||||||
|
|
||||||
|
# Python3 code here creating class
|
||||||
|
|
||||||
|
|
||||||
|
class Sensor:
|
||||||
|
"""
|
||||||
|
A class to represent an input sensor.
|
||||||
|
...
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
name : str
|
||||||
|
first name of the person
|
||||||
|
x : float
|
||||||
|
token to access soso service
|
||||||
|
y : float
|
||||||
|
token to access soso service
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, name: str, x_coord: float, y_coord: float):
|
||||||
|
self.name = name
|
||||||
|
self.x_coord = x_coord
|
||||||
|
self.y_coord = y_coord
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
main function
|
||||||
|
"""
|
||||||
|
sos_url = 'https://geomon.geologie.ac.at/52n-sos-webapp/service'
|
||||||
|
|
||||||
|
# creating list
|
||||||
|
sensor_list: List[Sensor] = []
|
||||||
|
|
||||||
|
# appending instances to list
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_0', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_1', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_2', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_3', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_4', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_5', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_6', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_7', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_8', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_9', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_10', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_11', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_12', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_13', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_14', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_15', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_16', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_17', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_18', 13.8141457, 47.9789118))
|
||||||
|
sensor_list.append(
|
||||||
|
Sensor('laakirchen_19', 13.8141457, 47.9789118))
|
||||||
|
|
||||||
|
sensor: Sensor
|
||||||
|
for sensor in sensor_list:
|
||||||
|
# platform laakirchen_inclinometer
|
||||||
|
# offering = Offering(
|
||||||
|
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
|
||||||
|
# sensor.name,
|
||||||
|
# "Bohrloch, Wolfsegg Inklinometer"
|
||||||
|
# )
|
||||||
|
# procedure = Procedure(sensor.name, sensor.name)
|
||||||
|
# foi = FoI("degree", "m", (sensor.x_coord, sensor.y_coord, 0.0),
|
||||||
|
# "TAC003-020-0517", "Wolfsegg KB1")
|
||||||
|
######################## Laakirchen
|
||||||
|
offering = Offering(
|
||||||
|
"https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
|
||||||
|
sensor.name,
|
||||||
|
"Inklinometer, Laakirchen Sensor"
|
||||||
|
)
|
||||||
|
procedure = Procedure( sensor.name, sensor.name,)
|
||||||
|
|
||||||
|
foi = FoI("degree", "m", (sensor.x_coord, sensor.y_coord, 0.0),
|
||||||
|
"GSA02B-007-0911", "Massenbewegung Laakirchen")
|
||||||
|
|
||||||
|
# now insert sensor via rest service:
|
||||||
|
sensor_type=SensorType("inclinometer")
|
||||||
|
post_data=insert_sensor(offering, procedure, foi, sensor_type)
|
||||||
|
# print(post_data)
|
||||||
|
headers={'Accept': 'application/json'}
|
||||||
|
request=requests.post(sos_url, headers = headers, json = post_data)
|
||||||
|
print(request.text)
|
||||||
|
|
||||||
|
# # platform Wolfsegg
|
||||||
|
# offering = Offering(
|
||||||
|
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
|
||||||
|
# "wolfsegg_1",
|
||||||
|
# "Bohrloch, Wolfsegg Inklinometer"
|
||||||
|
# )
|
||||||
|
# procedure = Procedure("wolfsegg_1", "wolfsegg_1")
|
||||||
|
# foi = FoI("degree", "m", (13.6731638, 48.1064354, 0.0),
|
||||||
|
# "TAC003-020-0517", "Wolfsegg KB1")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def insert_sensor(offering, procedure, foi, sensor_type):
|
||||||
|
"""
|
||||||
|
Prepares the body of a InsertSensor request for JSON biding.
|
||||||
|
:param offering: an instance of class Offering.Type object.
|
||||||
|
:param Procedure: instance of class Procedure. type object.
|
||||||
|
:param foi: feature of interest. Instance of FoI
|
||||||
|
:param sensor_type: SensorType object
|
||||||
|
:return: valid body for an InsertSensor request.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# shortName = offering.name # string
|
||||||
|
# longName = 'Sibratsgfall test' # string
|
||||||
|
|
||||||
|
# Offering values
|
||||||
|
gml_id='\"' + str(procedure.id) + '\"' # Offering name, double quoted
|
||||||
|
offering_name=offering.name
|
||||||
|
offering_label=offering.label
|
||||||
|
# offID = offering.fullId # URL format of full id
|
||||||
|
|
||||||
|
# featureName = featureID = cordX = cordY = height = h_unit = z_unit = coordinates = ""
|
||||||
|
# check if feature of interest should be declare
|
||||||
|
if foi is not None:
|
||||||
|
# feature_id = 'https://geomon.geologie.ac.at/52n-sos-webapp/api/features/' + \
|
||||||
|
# str(foi.fid) # URL format
|
||||||
|
cord_x=str(foi.x) # longitude degrees, float
|
||||||
|
cord_y=str(foi.y) # latitude degrees, float
|
||||||
|
coordinates=cord_x + " " + cord_y
|
||||||
|
height=str(foi.z) # altitude in meters, float
|
||||||
|
# h_unit = foi.Hunit # units for horizontal coordinates
|
||||||
|
# z_unit = foi.Vunit # units for altitude
|
||||||
|
feature_id=foi.fid # "feature location"
|
||||||
|
feature_name=foi.name # "feature location"
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
procedure_name=procedure.name
|
||||||
|
procedure_identifier=procedure.id # URL,
|
||||||
|
obs_types=[]
|
||||||
|
output_list='' # output list element for describe procedure
|
||||||
|
properties_list=[]
|
||||||
|
for attr in sensor_type.pattern["attributes"]:
|
||||||
|
obs_prop_name='\"' + attr[0] + '\"' # attribute name
|
||||||
|
# print(obs_prop_name)
|
||||||
|
unit_name=sensor_type.om_types[attr[1]] # om type
|
||||||
|
# magnitud = a # ??
|
||||||
|
|
||||||
|
obs_name=obs_prop_name.replace('\"', '')
|
||||||
|
obs_name="".join(obs_name.split()) # observable property name
|
||||||
|
output='<sml:output name=' + obs_prop_name + '><swe:Quantity definition=' + \
|
||||||
|
'\"' + (obs_name) + '\"' + \
|
||||||
|
'></swe:Quantity></sml:output>'
|
||||||
|
output_list=output_list + output
|
||||||
|
# add property identifier to the list.
|
||||||
|
properties_list.append(obs_name)
|
||||||
|
# prepare list of measurement types
|
||||||
|
# A sensor can not registry duplicated sensor types.
|
||||||
|
this_type="http://www.opengis.net/def/observationType/OGC-OM/2.0/"+unit_name
|
||||||
|
if this_type not in obs_types: # when new type appears
|
||||||
|
obs_types.append(this_type)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Unit of measurement:
|
||||||
|
unit_name='\"' + procedure.name + '\"' # double quoted string
|
||||||
|
# unit = omType # one of the MO measurement types
|
||||||
|
|
||||||
|
body={
|
||||||
|
"request": "InsertSensor",
|
||||||
|
"service": "SOS",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"procedureDescriptionFormat": "http://www.opengis.net/sensorml/2.0",
|
||||||
|
"procedureDescription": f'<sml:PhysicalSystem gml:id={gml_id} xmlns:swes=\"http://www.opengis.net/swes/2.0\" xmlns:sos=\"http://www.opengis.net/sos/2.0\" xmlns:swe=\"http://www.opengis.net/swe/2.0\" xmlns:sml=\"http://www.opengis.net/sensorml/2.0\" xmlns:gml=\"http://www.opengis.net/gml/3.2\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:gco=\"http://www.isotc211.org/2005/gco\" xmlns:gmd=\"http://www.isotc211.org/2005/gmd\"><gml:identifier codeSpace=\"uniqueID\">{procedure_identifier}</gml:identifier><sml:identification><sml:IdentifierList><sml:identifier><sml:Term definition=\"urn:ogc:def:identifier:OGC:1.0:longName\"><sml:label>longName</sml:label><sml:value>{procedure_name}</sml:value></sml:Term></sml:identifier><sml:identifier><sml:Term definition=\"urn:ogc:def:identifier:OGC:1.0:shortName\"><sml:label>shortName</sml:label><sml:value>{procedure_name}</sml:value></sml:Term></sml:identifier></sml:IdentifierList></sml:identification><sml:capabilities name=\"offerings\"><sml:CapabilityList><sml:capability name=\"offeringID\"><swe:Text definition=\"urn:ogc:def:identifier:OGC:offeringID\"><swe:label>{offering_label}</swe:label><swe:value>{offering_name}</swe:value></swe:Text></sml:capability></sml:CapabilityList></sml:capabilities><sml:capabilities name=\"metadata\"><sml:CapabilityList><!-- status indicates, whether sensor is insitu (true) or remote (false) --><sml:capability name=\"insitu\"><swe:Boolean definition=\"insitu\"><swe:value>true</swe:value></swe:Boolean></sml:capability><!-- status indicates, whether sensor is mobile (true) or fixed/stationary (false) --><sml:capability name=\"mobile\"><swe:Boolean definition=\"mobile\"><swe:value>false</swe:value></swe:Boolean></sml:capability></sml:CapabilityList></sml:capabilities><sml:featuresOfInterest><sml:FeatureList definition=\"http://www.opengis.net/def/featureOfInterest/identifier\"><swe:label>featuresOfInterest</swe:label><sml:feature><sams:SF_SpatialSamplingFeature xmlns:sams=\"http://www.opengis.net/samplingSpatial/2.0\" gml:id=\"ssf_b3a826dd44012201b01323232323041f7a92e0cc47260eb9888f6a4e9f747\"><gml:identifier codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_id}</gml:identifier><gml:name codeSpace=\"http://www.opengis.net/def/nil/OGC/0/unknown\">{feature_name}</gml:name><sf:type xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint\"/><sf:sampledFeature xmlns:sf=\"http://www.opengis.net/sampling/2.0\" xlink:href=\"http://www.opengis.net/def/nil/OGC/0/unknown\"/><sams:shape><ns:Point xmlns:ns=\"http://www.opengis.net/gml/3.2\" ns:id=\"Point_ssf_b3a826dd44012201b013c90c51da28c041f7a92e0cc47260eb9888f6a4e9f747\"><ns:pos srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">{coordinates}</ns:pos></ns:Point></sams:shape></sams:SF_SpatialSamplingFeature></sml:feature></sml:FeatureList></sml:featuresOfInterest><sml:outputs><sml:OutputList><sml:output name=\"Slope\"><swe:Quantity definition=\"Slope\"><swe:label>Slope</swe:label><swe:uom code=\"deg\"/></swe:Quantity></sml:output><sml:output name=\"Roll\"><swe:Quantity definition=\"Roll\"><swe:label>Roll</swe:label><swe:uom code=\"deg\"/></swe:Quantity></sml:output><sml:output name=\"InSystemTemperature\"><swe:Quantity definition=\"InSystemTemperature\"><swe:label>InSystemTemperature</swe:label><swe:uom code=\"degC\"/></swe:Quantity></sml:output></sml:OutputList></sml:outputs><sml:position><swe:Vector referenceFrame=\"urn:ogc:def:crs:EPSG::4326\"><swe:coordinate name=\"easting\"><swe:Quantity axisID=\"x\"><swe:uom code=\"degree\"/><swe:value>{cord_x}</swe:value></swe:Quantity></swe:coordinate><swe:coordinate name=\"northing\"><swe:Quantity axisID=\"y\"><swe:uom code=\"degree\"/><swe:value>{cord_y}</swe:value></swe:Quantity></swe:coordinate><swe:coordinate name=\"altitude\"><swe:Quantity axisID=\"z\"><swe:uom code=\"m\"/><swe:value>{height}</swe:value></swe:Quantity></swe:coordinate></swe:Vector></sml:position></sml:PhysicalSystem>',
|
||||||
|
"observableProperty": [
|
||||||
|
"Slope",
|
||||||
|
"Roll",
|
||||||
|
"InSystemTemperature"
|
||||||
|
],
|
||||||
|
"observationType": [
|
||||||
|
"http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"
|
||||||
|
],
|
||||||
|
"featureOfInterestType":
|
||||||
|
"http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint"
|
||||||
|
}
|
||||||
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -108,7 +108,7 @@ def main():
|
||||||
|
|
||||||
sensor: Sensor
|
sensor: Sensor
|
||||||
for sensor in sensor_list:
|
for sensor in sensor_list:
|
||||||
# platform wolfsegg
|
# platform wolfsegg_inclinometer
|
||||||
offering = Offering(
|
offering = Offering(
|
||||||
"https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
|
"https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
|
||||||
sensor.name,
|
sensor.name,
|
||||||
|
|
|
@ -77,6 +77,8 @@ def main():
|
||||||
.first()
|
.first()
|
||||||
slope_dataset.fk_platform_id = sensor_platform.id
|
slope_dataset.fk_platform_id = sensor_platform.id
|
||||||
|
|
||||||
|
pg_session.commit()
|
||||||
|
|
||||||
format_exists: bool = pg_session.query(Format.id).filter_by(
|
format_exists: bool = pg_session.query(Format.id).filter_by(
|
||||||
definition="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"
|
definition="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"
|
||||||
).scalar() is not None
|
).scalar() is not None
|
||||||
|
@ -86,6 +88,7 @@ def main():
|
||||||
"http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement") \
|
"http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement") \
|
||||||
.first()
|
.first()
|
||||||
slope_dataset.fk_format_id = sensor_format.id
|
slope_dataset.fk_format_id = sensor_format.id
|
||||||
|
pg_session.commit()
|
||||||
|
|
||||||
# create all the observation for the given sensor names
|
# create all the observation for the given sensor names
|
||||||
create_observations(sensor, slope_dataset)
|
create_observations(sensor, slope_dataset)
|
||||||
|
|
|
@ -47,13 +47,13 @@ def main():
|
||||||
slope_dataset.value_type = "quantity"
|
slope_dataset.value_type = "quantity"
|
||||||
pg_session.commit()
|
pg_session.commit()
|
||||||
|
|
||||||
platform_exists: bool = pg_session.query(Platform.id).filter_by(
|
# platform_exists: bool = pg_session.query(Platform.id).filter_by(
|
||||||
sta_identifier=platform_sta_identifier).scalar() is not None
|
# sta_identifier=platform_sta_identifier).scalar() is not None
|
||||||
if platform_exists:
|
# if platform_exists:
|
||||||
sensor_platform = pg_session.query(Platform.id) \
|
# sensor_platform = pg_session.query(Platform.id) \
|
||||||
.filter(Platform.sta_identifier == platform_sta_identifier) \
|
# .filter(Platform.sta_identifier == platform_sta_identifier) \
|
||||||
.first()
|
# .first()
|
||||||
slope_dataset.fk_platform_id = sensor_platform.id
|
# slope_dataset.fk_platform_id = sensor_platform.id
|
||||||
|
|
||||||
# create all the observation for the given sensor names
|
# create all the observation for the given sensor names
|
||||||
create_observations(sensor, slope_dataset)
|
create_observations(sensor, slope_dataset)
|
||||||
|
|
|
@ -105,23 +105,23 @@ def main():
|
||||||
|
|
||||||
# appending instances to list
|
# appending instances to list
|
||||||
sensor_list.append(
|
sensor_list.append(
|
||||||
Sensor('gschliefgraben_bohrloch_1', 13.808378638676, 47.882871028831,
|
Sensor('gschliefgraben_piezometer_1', 13.808378638676, 47.882871028831,
|
||||||
"bohrloch1-glasfaser-gschliefgraben", "Piezometer1 am Gschliefgraben"))
|
"bohrloch1-piezometer-gschliefgraben", "Piezometer1 am Gschliefgraben"))
|
||||||
sensor_list.append(
|
sensor_list.append(
|
||||||
Sensor('gschliefgraben_bohrloch_2', 13.80957276439, 47.882524348741,
|
Sensor('gschliefgraben_piezometer_2', 13.80957276439, 47.882524348741,
|
||||||
"bohrloch2-glasfaser-gschliefgraben", "Piezometer2 am Gschliefgraben"))
|
"bohrloch2-piezometer-gschliefgraben", "Piezometer2 am Gschliefgraben"))
|
||||||
sensor_list.append(
|
sensor_list.append(
|
||||||
Sensor('gschliefgraben_bohrloch_3', 13.809990909737, 47.882824994038,
|
Sensor('gschliefgraben_piezometer_3', 13.809990909737, 47.882824994038,
|
||||||
"bohrloch3-glasfaser-gschliefgraben", "Piezometer3 am Gschliefgraben"))
|
"bohrloch3-piezometer-gschliefgraben", "Piezometer3 am Gschliefgraben"))
|
||||||
sensor_list.append(
|
sensor_list.append(
|
||||||
Sensor('gschliefgraben_bohrloch_4', 13.809379587392, 47.883098856837,
|
Sensor('gschliefgraben_piezometer_4', 13.809379587392, 47.883098856837,
|
||||||
"bohrloch4-glasfaser-gschliefgraben", "Piezometer4 am Gschliefgraben"))
|
"bohrloch4-piezometer-gschliefgraben", "Piezometer4 am Gschliefgraben"))
|
||||||
sensor_list.append(
|
sensor_list.append(
|
||||||
Sensor('gschliefgraben_bohrloch_5', 13.81120655331, 47.884145740545,
|
Sensor('gschliefgraben_piezometer_5', 13.81120655331, 47.884145740545,
|
||||||
"bohrloch5-glasfaser-gschliefgraben", "Piezometer5 am Gschliefgraben"))
|
"bohrloch5-piezometer-gschliefgraben", "Piezometer5 am Gschliefgraben"))
|
||||||
sensor_list.append(
|
sensor_list.append(
|
||||||
Sensor('gschliefgraben_bohrloch_6', 13.811537883268, 47.885082327907,
|
Sensor('gschliefgraben_piezometer_6', 13.811537883268, 47.885082327907,
|
||||||
"bohrloch6-glasfaser-gschliefgraben", "Piezometer6 am Gschliefgraben"))
|
"bohrloch6-piezometer-gschliefgraben", "Piezometer6 am Gschliefgraben"))
|
||||||
|
|
||||||
sensor: Sensor
|
sensor: Sensor
|
||||||
for sensor in sensor_list:
|
for sensor in sensor_list:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user