# If the date has changed, we have to process the last day's data if ((measure_date.day > last.day) or (measure_date.month > last.month)): # Displays X and y depending on the temperature (Z) and humidity (colors) #scat = ax.scatter(X, y, map(lambda x: float(get_weather(last, int(x), "temperature")), X), c = map(lambda x: 1 - float(get_weather(last, int(x), "humidex")), X)) # Displays X and y depending on the temperature (Z) and tide (colors) scat = ax.scatter(X, y, map(lambda x: float(get_weather(last, int(x), "temperature")), X), c = map(lambda x: float(tides[str(last.year)][str(last.month)][str(last.day)][str(int(x))][int(x * 4.0) % 4]), X)) if (measure_date.month > last.month) and len(X) and 0: plt.colorbar() plt.figure() X = [] y = [] if (not oh or oh.is_open(measure_date)): # Counting the measure on the current day, in the concerned hour X.append(float(measure_date.strftime("%H")) + float(measure_date.strftime("%M")) / 60.0) try: y.append(len(measure['value'])) except: y.append(measure['value']) before = last last = measure_date sys.stdout.write('\r') sys.stdout.flush() fig.colorbar(scat) plt.show()
scat = ax.scatter( X, y, map(lambda x: float(get_weather(last, int(x), "temperature")), X), c=map( lambda x: float(tides[str(last.year)][str(last.month)][str( last.day)][str(int(x))][int(x * 4.0) % 4]), X)) if (measure_date.month > last.month) and len(X) and 0: plt.colorbar() plt.figure() X = [] y = [] if (not oh or oh.is_open(measure_date)): # Counting the measure on the current day, in the concerned hour X.append( float(measure_date.strftime("%H")) + float(measure_date.strftime("%M")) / 60.0) try: y.append(len(measure['value'])) except: y.append(measure['value']) before = last last = measure_date sys.stdout.write('\r') sys.stdout.flush()
hour = str(hour) try: return weather[id][date.year][date.month][date.day][what][hour] except Exception as e: return 0 ################################ # AVAILABLE FEATURES ################################ adder = {} adder["Day_of_week"] = lambda date, p: week_day[date.strftime("%a")] adder["Holidays"] = lambda date, p: 2 + hd.is_open(date + dt.timedelta(days = int(p))) if hd.is_open(date) else hd.is_open(date + dt.timedelta(days = int(p))) adder["Hour_of_day"] = lambda date, p: date.hour + float(date.minute) / 60.0 adder["Month"] = lambda date, p: date.month adder["Previous"] = lambda date, p: get_prev(date, int(p)) adder["Roads"] = lambda date, p: get_roads_affluence(date, p) adder["Simple_hour"] = lambda date, p: date.hour adder["Simple_mins"] = lambda date, p: date.minute adder["Tide"] = lambda date, p: tides[date.year][date.month][date.day][date.hour][int(date.minute / 15)] adder["Weather"] = lambda date, p: get_weather(placeid, date, date.hour, p if len(p) else "weather") ################################ # PROCESSING ################################
def check_happy_hours(chaine, jour_heure): definition = OpeningHours(chaine) if bouchon : return definition.is_open("fr", "19:00") return definition.is_open(jour_heure[0], jour_heure[1])