chom api ok but there is to much delais in data
This commit is contained in:
parent
cf4e506523
commit
c2b3f9650b
166
chom.json
Normal file
166
chom.json
Normal file
@ -0,0 +1,166 @@
|
||||
{
|
||||
"shom_id": "386",
|
||||
"name": "BALISE_A",
|
||||
"longitude": 0.110667,
|
||||
"latitude": 49.431833,
|
||||
"state": "OK",
|
||||
"reseau": "REFMAR",
|
||||
"alertCustom": false,
|
||||
"delai_alerte": "06:00",
|
||||
"members": [
|
||||
{
|
||||
"individual_name": "HAROPA PORT | Rouen",
|
||||
"organization_name": "HAROPA PORT | Rouen",
|
||||
"voice": "",
|
||||
"delivery_point": "",
|
||||
"city": "",
|
||||
"postal_code": "",
|
||||
"electronic_mail_address": "scan@rouen.port.fr"
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"id": "1855",
|
||||
"tide_gauge_id": "386",
|
||||
"content": "P\u00e9riode d'\u00e9chantillonnage = 1 seconde\nDur\u00e9e d'int\u00e9gration = 61 secondes\nP\u00e9riode d'archivage = 5 minutes\n\nLa p\u00e9riode d'archivage n'est pas centr\u00e9e sur la dur\u00e9e d'int\u00e9gration mais uniquement sur la derni\u00e8re observation.",
|
||||
"creation_date": "2023-08-30T12:21:06.000Z",
|
||||
"due_date": "2015-01-01T01:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"organismes": [
|
||||
{
|
||||
"nom": "HAROPA PORT | Rouen",
|
||||
"logo": "https://services.data.shom.fr/static/logo/DDM/logo_GPM_le_havre.png",
|
||||
"url": "https://www.haropaport.com/fr"
|
||||
}
|
||||
],
|
||||
"verticalRef": {
|
||||
"nom_ref": "IGN69",
|
||||
"zero_hydro": "zero_hydrographique",
|
||||
"zh_ref": "-4.38"
|
||||
},
|
||||
"date_prem_obs": "1985-03-31",
|
||||
"fuseau_horaire": "0",
|
||||
"gestionnaire": "Grand Port Maritime Rouen",
|
||||
"id_ram": "PK 364,775 : Balise A",
|
||||
"info_maregraphe": "https://refmar.shom.fr/donnees/386",
|
||||
"journal_de_bord": "https://refmar.shom.fr/donnees/386",
|
||||
"niveau_moyen": "4.91",
|
||||
"npbma": "0.21",
|
||||
"nphma": "8.64",
|
||||
"sect_geographique": "FH",
|
||||
"spm": "BALISE_A",
|
||||
"ville_d_hebergement": "Le Havre"
|
||||
}
|
||||
2025-04-24 16:11:23,976 - INFO - Hauteur de la marée : -4.38 mètres
|
||||
print: -4.38
|
||||
2025-04-24 16:11:34,227 - INFO - {
|
||||
"shom_id": "386",
|
||||
"name": "BALISE_A",
|
||||
"longitude": 0.110667,
|
||||
"latitude": 49.431833,
|
||||
"state": "OK",
|
||||
"reseau": "REFMAR",
|
||||
"alertCustom": false,
|
||||
"delai_alerte": "06:00",
|
||||
"members": [
|
||||
{
|
||||
"individual_name": "HAROPA PORT | Rouen",
|
||||
"organization_name": "HAROPA PORT | Rouen",
|
||||
"voice": "",
|
||||
"delivery_point": "",
|
||||
"city": "",
|
||||
"postal_code": "",
|
||||
"electronic_mail_address": "scan@rouen.port.fr"
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"id": "1855",
|
||||
"tide_gauge_id": "386",
|
||||
"content": "P\u00e9riode d'\u00e9chantillonnage = 1 seconde\nDur\u00e9e d'int\u00e9gration = 61 secondes\nP\u00e9riode d'archivage = 5 minutes\n\nLa p\u00e9riode d'archivage n'est pas centr\u00e9e sur la dur\u00e9e d'int\u00e9gration mais uniquement sur la derni\u00e8re observation.",
|
||||
"creation_date": "2023-08-30T12:21:06.000Z",
|
||||
"due_date": "2015-01-01T01:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"organismes": [
|
||||
{
|
||||
"nom": "HAROPA PORT | Rouen",
|
||||
"logo": "https://services.data.shom.fr/static/logo/DDM/logo_GPM_le_havre.png",
|
||||
"url": "https://www.haropaport.com/fr"
|
||||
}
|
||||
],
|
||||
"verticalRef": {
|
||||
"nom_ref": "IGN69",
|
||||
"zero_hydro": "zero_hydrographique",
|
||||
"zh_ref": "-4.38"
|
||||
},
|
||||
"date_prem_obs": "1985-03-31",
|
||||
"fuseau_horaire": "0",
|
||||
"gestionnaire": "Grand Port Maritime Rouen",
|
||||
"id_ram": "PK 364,775 : Balise A",
|
||||
"info_maregraphe": "https://refmar.shom.fr/donnees/386",
|
||||
"journal_de_bord": "https://refmar.shom.fr/donnees/386",
|
||||
"niveau_moyen": "4.91",
|
||||
"npbma": "0.21",
|
||||
"nphma": "8.64",
|
||||
"sect_geographique": "FH",
|
||||
"spm": "BALISE_A",
|
||||
"ville_d_hebergement": "Le Havre"
|
||||
}
|
||||
2025-04-24 16:11:34,227 - INFO - Hauteur de la marée : -4.38 mètres
|
||||
print: -4.38
|
||||
2025-04-24 16:11:44,339 - INFO - {
|
||||
"shom_id": "386",
|
||||
"name": "BALISE_A",
|
||||
"longitude": 0.110667,
|
||||
"latitude": 49.431833,
|
||||
"state": "OK",
|
||||
"reseau": "REFMAR",
|
||||
"alertCustom": false,
|
||||
"delai_alerte": "06:00",
|
||||
"members": [
|
||||
{
|
||||
"individual_name": "HAROPA PORT | Rouen",
|
||||
"organization_name": "HAROPA PORT | Rouen",
|
||||
"voice": "",
|
||||
"delivery_point": "",
|
||||
"city": "",
|
||||
"postal_code": "",
|
||||
"electronic_mail_address": "scan@rouen.port.fr"
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"id": "1855",
|
||||
"tide_gauge_id": "386",
|
||||
"content": "P\u00e9riode d'\u00e9chantillonnage = 1 seconde\nDur\u00e9e d'int\u00e9gration = 61 secondes\nP\u00e9riode d'archivage = 5 minutes\n\nLa p\u00e9riode d'archivage n'est pas centr\u00e9e sur la dur\u00e9e d'int\u00e9gration mais uniquement sur la derni\u00e8re observation.",
|
||||
"creation_date": "2023-08-30T12:21:06.000Z",
|
||||
"due_date": "2015-01-01T01:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"organismes": [
|
||||
{
|
||||
"nom": "HAROPA PORT | Rouen",
|
||||
"logo": "https://services.data.shom.fr/static/logo/DDM/logo_GPM_le_havre.png",
|
||||
"url": "https://www.haropaport.com/fr"
|
||||
}
|
||||
],
|
||||
"verticalRef": {
|
||||
"nom_ref": "IGN69",
|
||||
"zero_hydro": "zero_hydrographique",
|
||||
"zh_ref": "-4.38"
|
||||
},
|
||||
"date_prem_obs": "1985-03-31",
|
||||
"fuseau_horaire": "0",
|
||||
"gestionnaire": "Grand Port Maritime Rouen",
|
||||
"id_ram": "PK 364,775 : Balise A",
|
||||
"info_maregraphe": "https://refmar.shom.fr/donnees/386",
|
||||
"journal_de_bord": "https://refmar.shom.fr/donnees/386",
|
||||
"niveau_moyen": "4.91",
|
||||
"npbma": "0.21",
|
||||
"nphma": "8.64",
|
||||
"sect_geographique": "FH",
|
||||
"spm": "BALISE_A",
|
||||
"ville_d_hebergement": "Le Havre"
|
||||
}
|
||||
17
main.py
17
main.py
@ -8,7 +8,9 @@ import json
|
||||
import subprocess
|
||||
|
||||
# Configuration de l'API REFMAR
|
||||
API_URL = "https://services.data.shom.fr/maregraphie/service/completetidegauge"
|
||||
# API_URL = "https://services.data.shom.fr/maregraphie/service/completetidegauge"
|
||||
API_URL = "https://services.data.shom.fr/maregraphie/observation/json"
|
||||
# curl -X GET "https://services.data.shom.fr/maregraphie/observation/json/386?sources=1&dtStart=2025-05-22T15%3A56%3A00Z&dtEnd=2025-05-22T15%3A57%3A00Z&interval=1" -H "accept: application/json"
|
||||
# API_KEY = "votre_cle_api" # Remplacez par votre clé API
|
||||
STATION = '386' # Identifiant de la station du Havre
|
||||
|
||||
@ -26,8 +28,10 @@ def fetch_data():
|
||||
# "Ocp-Apim-Subscription-Key": API_KEY,
|
||||
}
|
||||
params = {
|
||||
# "station": STATION,
|
||||
# "time": "current", # Vous pouvez ajuster ce paramètre selon vos besoins
|
||||
"sources": 1,
|
||||
"dtStart": "2025-05-22T10:00:00Z",
|
||||
"dtEnd": "2025-05-22T17:00:00Z",
|
||||
# "interval": 1
|
||||
}
|
||||
try:
|
||||
response = requests.get(API_URL+"/"+STATION, headers=headers, params=params)
|
||||
@ -58,12 +62,13 @@ def main():
|
||||
|
||||
try:
|
||||
while True:
|
||||
print('/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / /')
|
||||
data = fetch_data()
|
||||
logging.info(json.dumps(data, indent=2))
|
||||
# print(data)
|
||||
if data:
|
||||
process_data(data)
|
||||
time.sleep(10) # 300 Attendre 5 minutes
|
||||
# if data:
|
||||
# process_data(data)
|
||||
time.sleep(60) # 300 Attendre 5 minutes
|
||||
except KeyboardInterrupt:
|
||||
print("Arrêt du script, fermeture de Pure Data...")
|
||||
pd_process.terminate()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user