示例#1
0
def daily_query_split(*stations):
    q, dt = daily_base_query()

    for s in stations:
        gage_name = s.station_name_web
        navd88correction = s.convert_to_navd88_feet
        dry_value = s.dry_elevation

        flag, val, _raw = daily_columns(gage_name,
                                        dry_value,
                                        navd88correction=navd88correction)

        # split to 3 columns: Observed, Estimated, Dry. Missing is just missing.
        q = q.column(
            expression.case(value=flag, whens={
                'O': val
            }, else_=None).label(gage_name + " avg"))
        q = q.column(
            expression.case(value=flag, whens={
                'E': val
            }, else_=None).label(gage_name + " est"))
        q = q.column(
            expression.case(value=flag, whens={
                'D': val
            }, else_=None).label(gage_name + " dry"))

    return q, dt
def daily_query(*stations):
    q, dt = daily_base_query()

    for s in stations:
        gage_name = s.station_name_web
        navd88correction = s.convert_to_navd88_feet
        dry_value = s.dry_elevation

        flag, val, _raw = daily_columns(gage_name, dry_value, navd88correction=navd88correction)

        q = q.column(val.label(gage_name + " avg"))
        q = q.column(flag.label(gage_name + " flag"))

    return q, dt
示例#3
0
def daily_query(*stations):
    q, dt = daily_base_query()

    for s in stations:
        gage_name = s.station_name_web
        navd88correction = s.convert_to_navd88_feet
        dry_value = s.dry_elevation

        flag, val, _raw = daily_columns(gage_name,
                                        dry_value,
                                        navd88correction=navd88correction)

        q = q.column(val.label(gage_name + " avg"))
        q = q.column(flag.label(gage_name + " flag"))

    return q, dt
def daily_query_split(*stations):
    q, dt = daily_base_query()

    for s in stations:
        gage_name = s.station_name_web
        navd88correction = s.convert_to_navd88_feet
        dry_value = s.dry_elevation

        flag, val, _raw = daily_columns(gage_name, dry_value, navd88correction=navd88correction)

        # split to 3 columns: Observed, Estimated, Dry. Missing is just missing.
        q = q.column(expression.case(value=flag,
                                     whens={'O': val},
                                     else_=None).label(gage_name + " avg"))
        q = q.column(expression.case(value=flag,
                                     whens={'E': val},
                                     else_=None).label(gage_name + " est"))
        q = q.column(expression.case(value=flag,
                                     whens={'D': val},
                                     else_=None).label(gage_name + " dry"))

    return q, dt