Beispiel #1
0
def tobs():
    session = Session(engine)
    tobs_info = session.query(Measurement.tobs).\
    order_by(Measurement.tobs).all()
    print()
    print("Temperature Results")
    return jsonify(tobs_info)
def precipitation():
    prcp_results = session.query(Measurement.date, Measurement.tobs)\
    .filter(Measurement.date >= '2017-01-01').all()
    p_dict = dict(prcp_results)
    print()
    print("Results for Precipitation")
    return jsonify(p_dict)
Beispiel #3
0
def precipitation():
    session = Session(engine)
    prcp_info = session.query(Measurement.date, Measurement.tobs).\
    filter(Measurement.date >= '2017-08-23').all()
    prcp_dict=dict(prcp_info)
    print()
    print("Precipitation results")
    return jsonify(prcp_dict)
def stations():
    station_list = session.query(Station.station).order_by(
        Station.station).all()
    print()
    print("Station List:")
    for row in station_list:
        print(row[0])
    return jsonify(station_list)
Beispiel #5
0
def station():
    session = Session(engine)
    station_info = session.query(Station.station).\
    order_by(Station.station).all()
    print()
    print("Station results")
    for row in station_list:
        print (row[0])
    return jsonify(station_list)
Beispiel #6
0
def start():
    session = Session(engine)
    start_info = session.query(station.id,
                        station.station,
                        func.min(Measurement.tobs),
                        func.max(Measurement.tobs),
                        func.avg(Measurement.tobs),
                        filter(Measurement.station) == Station.station).\
                        filer(Measurement.date>=start).all()
        )
def combined_start_stats(start):
    q = session.query(Station.id, Station.station, func.min(Measurement.tobs),
                      func.max(Measurement.tobs),
                      func.avg(Measurement.tobs)).filter(
                          Measurement.station == Station.station).filter(
                              Measurement.date >= start).all()
    print()
    print("Query Temps Combinded Stations with Start ({start}) Date")
    for row in q:
        print()
        print(row)
    return jsonify(q)
def station_start_end_stats(start, end):
    q = session.query(
        Station.id, Station.station, func.min(Measurement.tobs),
        func.max(Measurement.tobs), func.avg(Measurement.tobs)).filter(
            Measurement.station == Station.station).filter(
                Measurement.date <= end).filter(
                    Measurement.date >= start).group_by(
                        Station.station).order_by(Station.id).all()
    print()
    print(
        f"Query Temps for Stations with Start ({start}) and End ({end}) Date")
    for row in q:
        print()
        print(row)
    return jsonify(q)
def tobs():
    temp_obs = session.query(Measurement.tobs).order_by(Measurement.date).all()
    print()
    print("Temperature Results for All Stations")
    return jsonify(temp_obs)