Commit 387ad8d3 authored by Jerome Touvier's avatar Jerome Touvier

Merge branch 'update' into 'master'

fix automontage bynet

See merge request !14
parents 66d7cd0b 79c4ad9b
Pipeline #49171 passed with stage
in 1 minute and 24 seconds
import os
# global constants
FROM_CLIENT = False
FROM_CLIENT = True
FDSN_CLIENT = "RESIF"
DATA_DIR = "/mnt/auto/archive"
USER_AGENT_TIMESERIES = "resifws-timeseries"
......
......@@ -140,8 +140,10 @@ def get_output(params):
st = get_signal(params)
logging.info(f"Get data in {tictac(tic1)} seconds.")
if st is None or len(st) == 0:
if st is None:
return None
if not st:
return error_nodata(params)
npoints = sum([len(tr.data) for tr in st])
if npoints > MAX_DATA_POINTS:
......@@ -159,8 +161,6 @@ def get_output(params):
return error_nodata(params, Error.RESPONSE)
st = get_processed_signal(st, params)
if not st:
return error_nodata(params)
if params["iplot"]:
response = dynamic_plots(params, st)
......
......@@ -7,7 +7,7 @@ import time
from difflib import SequenceMatcher
from datetime import datetime, timedelta
from flask import current_app, make_response, request, Response
from flask import make_response, request, Response
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter, MaxNLocator
......@@ -393,14 +393,14 @@ def is_open_file(filenames):
if not filenames:
return None
values = ", ".join(f"'{f}'" for f in filenames)
values = ", ".join(f"('{f}')" for f in filenames)
select = f"""SELECT name
FROM rbud, ( SELECT * FROM (VALUES ({values})) AS t(name) ) AS t1
FROM rbud, ( SELECT * FROM (VALUES {values}) AS t(name) ) AS t1
WHERE source_file=t1.name AND channel_id != 0 AND availability = 't' UNION SELECT name
FROM rall, ( SELECT * FROM (VALUES ({values})) AS t(name) ) AS t1
FROM rall, ( SELECT * FROM (VALUES {values}) AS t(name) ) AS t1
WHERE source_file=t1.name AND channel_id != 0 AND availability = 't';"""
with psycopg2.connect(current_app.config["DATABASE_URI"]) as conn:
with psycopg2.connect("") as conn:
logging.debug(conn.get_dsn_parameters())
logging.debug(f"Postgres version : {conn.server_version}")
with conn.cursor() as curs:
......@@ -425,7 +425,7 @@ def extend(params):
select = f"""SELECT DISTINCT network, s.station, location, channel FROM networks AS n, station AS s, channel AS c WHERE n.network_id = s.network_id AND s.station_id = c.station_id AND ({is_like_or_equal(params, "network")}) AND ({is_like_or_equal(params, "station")}) AND ({is_like_or_equal(params, "channel")}) AND ({is_like_or_equal(params, "location")}) ORDER BY network, station, channel, location;"""
select = select.replace("?", "_").replace("*", "%")
with psycopg2.connect(current_app.config["DATABASE_URI"]) as conn:
with psycopg2.connect("") as conn:
logging.debug(conn.get_dsn_parameters())
logging.debug(f"Postgres version : {conn.server_version}")
with conn.cursor() as curs:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment