Esempio n. 1
0
def events(request, date=None):
    today = day = datetime.now().date()
    try:
        reqday = datetime.strptime(date, "%Y-%m-%d").date()
        if request.user.is_authenticated() or (reqday - day).days in range(7):
            day = reqday
    except:
        # just use today date
        pass
    days = helpers.get_days(0)
    daylabels = [(days[0], 'Today'), (days[1], 'Tomorrow')]
    for d in days[2:]:
        daylabels.append((d, d.strftime('%A')))
    article, tags = None, []
    show_edit_links = False
    if request.user.is_authenticated():
        show_edit_links = True
    article,tags=helpers.get_article(today)
    return  render_to_response(request, 'ladypenh/day.html',
                               dict(theme_name=helpers.get_theme(helpers.today()),
                                    day=day,                               
                                    daylabels=daylabels,
                                    highlights=helpers.get_highlights(days),
                                    events=helpers.get_events(day),
                                    reminders=helpers.get_reminders(day),
                                    show_edit_links=show_edit_links,
                                    article=article,
                                    tags=tags
                                    ))
Esempio n. 2
0
def feed_atom(request):
    "Phnom Penh events of the day"
    today = helpers.today()
    return  render_to_response(request, 'ladypenh/atom.xml',
                               dict(events=helpers.get_events(today),
                                    today=today),
                               mimetype='application/atom+xml; charset=utf8')
Esempio n. 3
0
def year_info():
    """ Returns json object of timeline data """

    database_years = Years.query.all()
    years = get_years(database_years)
    n = len(years)
    database_events = Events.query.all()
    events = get_events(n, database_events)
    database_people = People.query.all()
    people = get_people(n, database_people)

    data = {}
    for i in range(1, n + 1):
        year_id = str(i)

        year_info = {}
        year_info["events"] = events[i - 1]
        year_info["people"] = people[i - 1]
        year_info["year_info"] = years[i - 1]

        data[year_id] = year_info

    return jsonify(data)
Esempio n. 4
0
# event_identifiers = [20, 21]
event_identifiers = [20, 21, 22, 23, 24]
# locations_available = ['c3']
locations_available = ['s3', 's5', 's6']
data_types = ['trend', 'sensor']
event_metadata = 'data/experiment_list.csv'
ic_path = 'data/initial_conditions.csv'

workdir = 'Q:/Messdaten/floodVisionData/core_2018_cq/4_experiments/CliBU008/simple_model/190712_less_params'
# define log file
log_file = os.path.join(workdir, 'results_uncalibrated.csv')
if os.path.isfile(log_file) and overwrite:
    os.remove(log_file)

events = h.get_events(identifiers=event_identifiers,
                      metadata_path=event_metadata,
                      initial_condition_path=ic_path)

for event_number in event_identifiers:
    print('#  Running uncalibrated Experiment {}'.format(event_number))

    # define calibration event
    calibration_event = events[event_number]

    # define directory
    exp_dir = os.path.join(workdir, '_uncalibrated', str(event_number))

    # check if processing already performed for directory
    if os.path.isfile(os.path.join(exp_dir,
                                   'calibration_chain.png')) and not overwrite:
        print('Processing already performed')
Esempio n. 5
0
def printable_listing(request, dayspan=0):
    days = helpers.get_days(dayspan)
    return  render_to_response(request, 'ladypenh/print.html',
                               dict(events=helpers.get_events(days)))