Commit 11b9a9af authored by Dorian's avatar Dorian

Changement Nom de table Q2

parent eabb1176
......@@ -37,7 +37,7 @@ def getStatisticsQ2(indicator, hour, day, month, year) :
cluster = Cluster(['localhost'])
session = cluster.connect('dbermond_projet')
query = "SELECT " + indicator.lower() + " FROM weatherQ2 WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s "
query = "SELECT " + indicator.lower() + " FROM weatherByTime WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s "
#print("Query = "+query)
results = session.execute(query, t)
nQ2 = 0
......@@ -124,7 +124,7 @@ def getPointsAndColor(indicator, hour, day, month, year, numberOfPoint, colorRan
query = """
SELECT
""" + indicator.lower() + """, latitude, longitude
FROM weatherQ2
FROM weatherByTime
WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s
"""
results = session.execute(query, t)
......@@ -287,7 +287,7 @@ def computeQuantile(indicator, hour, day, month, year, numberOfQuantiles, theore
)
query = """
SELECT %s
FROM weatherQ2
FROM weatherByTime
WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s
"""
nQ2 = 0
......@@ -321,7 +321,7 @@ def getCumulativeDistributionFunctionQ2(indicator, hour, day, month, year, numbe
query = """
SELECT %s
FROM weatherQ2
FROM weatherByTime
WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s
"""
results = session.execute(query, t)
......
......@@ -124,25 +124,25 @@ def loadataQ2(filename):
def initTableForQ2(session) :
query = '''
DROP TABLE IF EXISTS weatherQ2 ;
DROP TABLE IF EXISTS weatherByTime ;
'''
session.execute(query)
query = '''
CREATE TABLE weatherQ2(
CREATE TABLE weatherByTime(
Station text,
DhmYear varint,
DhmMonth varint,
DhmDay varint,
DhmHour varint,
DhmMinute varint,
Longitude float,
Latitude float,
Temperature float,
DewPoint float,
RelativeHumidity float,
......@@ -153,31 +153,31 @@ def initTableForQ2(session) :
-- mslp float,
Visibility float,
-- gust float,
-- skyc1 text,
-- skyc2 text,
-- skyc3 text,
-- skyc4 text,
-- skyl1 float,
-- skyl2 float,
-- skyl3 float,
-- skyl4 float,
-- wxcodes text,
-- ice_accretion_1hr float,
-- ice_accretion_3hr float,
-- ice_accretion_6hr float,
-- peak_wind_gust float,
-- peak_wind_drct float,
-- peak_wind_time float,
ApparentTemperature float,
-- metar text,
PRIMARY KEY ((DhmYear, DhmMonth, DhmDay), DhmHour, DhmMinute, Latitude, Longitude)
);
'''
......@@ -238,19 +238,19 @@ def getWeatherQ2(csvfilename, limit):
# r["metar"],
)
query = """
INSERT INTO weatherQ2(
INSERT INTO weatherByTime(
Station,
DhmYear,
DhmMonth,
DhmDay,
DhmHour,
DhmMinute,
Longitude,
Latitude,
Temperature,
DewPoint,
RelativeHumidity,
......@@ -261,30 +261,30 @@ def getWeatherQ2(csvfilename, limit):
-- mslp float,
Visibility,
-- gust float,
-- skyc1 text,
-- skyc2 text,
-- skyc3 text,
-- skyc4 text,
-- skyl1 float,
-- skyl2 float,
-- skyl3 float,
-- skyl4 float,
-- wxcodes text,
-- ice_accretion_1hr float,
-- ice_accretion_3hr float,
-- ice_accretion_6hr float,
-- peak_wind_gust float,
-- peak_wind_drct float,
-- peak_wind_time float,
ApparentTemperature
-- metar
-- metar
)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
"""
......
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