- letzte Ausbesserungen bei den Piezometerdaten im Gschliefgraben

This commit is contained in:
Arno Kaimbacher 2022-03-17 14:34:43 +01:00
parent b4d7ce40b3
commit c2f2dc1b41
2 changed files with 66 additions and 11 deletions

View File

@ -39,15 +39,65 @@ def main():
# Gschliefgraben Piezometer
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "bohrloch",
# "Bohrlöcher, Gschliefgraben Piezometer"
# )
# procedure = Procedure("bohrloch1", "bohrloch1")
# foi = FoI("degree", "m", (13.774966, 47.910849, 0.0),
# "bohrloch1-glasfaser-gschliefgraben",
# "Piezometer1 am Gschliefgraben")
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "bohrloch2",
# "Bohrloch2, Gschliefgraben Piezometer"
# )
# procedure = Procedure("bohrloch2", "bohrloch2")
# foi = FoI("degree", "m", (13.80957276439, 47.882524348741, 0.0),
# "bohrloch2-glasfaser-gschliefgraben",
# "Piezometer2 am Gschliefgraben")
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "bohrloch3",
# "Bohrloch, Gschliefgraben Piezometer"
# )
# procedure = Procedure("bohrloch3", "bohrloch3")
# foi = FoI("degree", "m", (13.809990909737, 47.882824994038, 0.0),
# "bohrloch3-glasfaser-gschliefgraben",
# "Piezometer3 am Gschliefgraben")
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "bohrloch4",
# "Bohrloch, Gschliefgraben Piezometer"
# )
# procedure = Procedure("bohrloch4", "bohrloch4")
# foi = FoI("degree", "m", (13.809379587392, 47.883098856837, 0.0),
# "bohrloch4-glasfaser-gschliefgraben",
# "Piezometer4 am Gschliefgraben")
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "bohrloch5",
# "Bohrloch, Gschliefgraben Piezometer"
# )
# procedure = Procedure("bohrloch5", "bohrloch5")
# foi = FoI("degree", "m", (13.81120655331, 47.884145740545, 0.0),
# "bohrloch5-glasfaser-gschliefgraben",
# "Piezometer5 am Gschliefgraben")
offering = Offering(
"https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
"bohrloch",
"Bohrlöcher, Gschliefgraben Piezometer"
"bohrloch6",
"Bohrloch, Gschliefgraben Piezometer"
)
procedure = Procedure("bohrloch1", "bohrloch1")
foi = FoI("degree", "m", (13.774966, 47.910849, 0.0),
"bohrloch1-glasfaser-gschliefgraben",
"Piezometer1 am Gschliefgraben")
procedure = Procedure("bohrloch6", "bohrloch6")
foi = FoI("degree", "m", (13.811537883268, 47.885082327907, 0.0),
"bohrloch6-glasfaser-gschliefgraben",
"Piezometer6 am Gschliefgraben")
sensor_type = SensorType("piezometer")
post_data = insert_sensor(offering, procedure, foi, sensor_type)

View File

@ -51,7 +51,7 @@ def main():
elevation_dataset.is_hidden = 0
elevation_dataset.dataset_type = "timeseries"
elevation_dataset.observation_type = "simple"
elevation_dataset.value_type = "text"
elevation_dataset.value_type = "quantity"
pg_session.commit()
platform_exists: bool = pg_session.query(Platform.id).filter_by(
@ -61,7 +61,7 @@ def main():
# .filter(Platform.sta_identifier == platform_sta_identifier) \
# .first()
# elevation_dataset.fk_platform_id = sensor_platform.id
if not platform_exists:
sensor_platform = Platform()
max_id = pg_session.query(func.max(Platform.id)).scalar()
@ -88,7 +88,7 @@ def main():
if sensor in data:
create_observation(elevation_dataset, sensor, data, pg_session)
pg_session.commit()
first_elevation_observation = pg_session.query(Observation) \
.filter(Observation.fk_dataset_id == elevation_dataset.id) \
.order_by(asc('sampling_time_start')) \
@ -105,7 +105,7 @@ def main():
elevation_dataset.last_time = last_elevation_observation.sampling_time_start
elevation_dataset.last_value = last_elevation_observation.value_quantity
elevation_dataset.fk_last_observation_id = last_elevation_observation.id
pg_session.commit()
pg_session.close()
@ -115,7 +115,7 @@ def create_observation(elevation_dataset: Dataset,
data: json,
db_session: session):
''' create observation in db'''
print("Sesnor key exist in JSON data")
# print("Sesnor key exist in JSON data")
sensor_object = data[sensor_key]
zeitstempel = sensor_object["zeitstempel"]
abstich = sensor_object["abstich"]
@ -141,6 +141,11 @@ def create_observation(elevation_dataset: Dataset,
new_observation.value_quantity = abstich
new_observation.fk_dataset_id = elevation_dataset.id
db_session.add(new_observation)
print(f"new observation with result time {new_observation.result_time} "
f"for drill hole {sensor_key} succesfully imported!")
else:
print(f"observation with result time {existing_observation.result_time} "
f"for drill hole {sensor_key} already exists!")
def test():