Exemple #1
0
def main():
    parser = argparse.ArgumentParser(
        description='Get Constraint Payment information for yesterday')
    parser.add_argument('--date',
                        action='store',
                        type=mkdate,
                        help='Date to get results for')
    parser.add_argument('--period',
                        action='store',
                        help='Period to get data for')
    args = parser.parse_args()

    data = {}
    ud = UnitData({'date': args.date or date.today() - timedelta(days=2)})
    pr = [args.period] or range(1, 49)
    for period in pr:
        ud.period = period
        if ud.get_data():
            data[period] = ud.data
        else:
            print("Unable to get data for %s, period %d" %
                  (ud.date.strftime("%d %b %Y"), period))

    for period, units in sorted(data.iteritems()):
        print("Period: ", period)
        for unit in sorted(units, key=lambda x: x['ngc']):
            print("  ", unit['ngc'], unit['lead'])
            if unit['bid'].has_key('volume'):
                print("      BID:   ", unit['bid']['volume'] + 'MWh  ',
                      unit['bid']['cashflow'])
            if unit['offer'].has_key('volume'):
                print("      OFFER: ", unit['offer']['volume'] + 'MWh  ',
                      unit['offer']['cashflow'])
Exemple #2
0
def bm_unitdata(args):
    """ BMReport Unit Constraint Data
    The data can be filtered by date and or period using the --date and --period flags.

    :Example:
    To obtain data for period 5, 1st Jan 2016

    .. code-block:
    $ pywind bm_unitdata --date 2016-01-01 --period 5

    """

    if args.date is not None:
        udd = UnitData(date=args.date)
    else:
        udd = UnitData()
        print("No date supplied, getting information for yesterday, {}.\n".format(udd.date))

    if args.period is not None:
        udd.period = args.period

    if udd.get_data() is False:
        print("Unable to get unit data.")
        sys.exit(0)

    print("Data is for period {}, {}".format(udd.period, udd.date))
    fmt = StdoutFormatter('9s', '30s', '>10.4f', '>10s', '>10.4f', '>10s', '>10.4f', '>10.4f', '>10.4f', ">10.4f")
    print("{:43s}     Bid Volume              Offer Volume           Cashflow".format(' '))
    print(fmt.titles("NGC", 'Lead', 'Original', 'Tagged', 'Original', 'Tagged', 'Bid', 'Offer', 'Bid Rate', 'Offer Rate'))
    for bmu in udd.data:
        print(fmt.row(bmu.id, bmu.lead,
                      bmu.bid_volume,
                      multi_level_get(bmu.volume, 'bid_values.tagged.total.value', 'n/a'),
                      bmu.offer_volume,
                      multi_level_get(bmu.volume, 'offer_values.tagged.total.value', 'n/a'),
                      bmu.bid_cashflow,
                      bmu.offer_cashflow,
                      bmu.rate("bid"),
                      bmu.rate("offer")))
    return udd
Exemple #3
0
def main():
    parser = argparse.ArgumentParser(description='Get Constraint Payment information for yesterday')
    parser.add_argument('--date', action='store', type=mkdate, help='Date to get results for')
    parser.add_argument('--period', action='store', help='Period to get data for')
    args = parser.parse_args()

    data = {}
    ud = UnitData({'date': args.date or date.today() - timedelta(days=2)})
    pr = [args.period] or range(1,49)
    for period in pr:
        ud.period = period
        if ud.get_data():
            data[period] = ud.data
        else:
            print "Unable to get data for %s, period %d" % (ud.date.strftime("%d %b %Y"), period)

    for period, units in sorted(data.iteritems()):
        print "Period: ", period
        for unit in sorted(units, key=lambda x: x['ngc']):
            print "  ", unit['ngc'], unit['lead']
            if unit['bid'].has_key('volume'):
                print "      BID:   ", unit['bid']['volume']+'MWh  ', unit['bid']['cashflow']
            if unit['offer'].has_key('volume'):
                print "      OFFER: ", unit['offer']['volume']+'MWh  ', unit['offer']['cashflow']
Exemple #4
0
def bm_unitdata(args):
    """ BMReport Unit Constraint Data
    The data can be filtered by date and or period using the --date and --period flags.

    :Example:
    To obtain data for period 5, 1st Jan 2016

    .. code-block:
    $ pywind bm_unitdata --date 2016-01-01 --period 5

    """

    if args.date is not None:
        udd = UnitData(date=args.date)
    else:
        udd = UnitData()
        print("No date supplied, getting information for yesterday, {}.\n".
              format(udd.date))

    if args.period is not None:
        udd.period = args.period

    if udd.get_data() is False:
        print("Unable to get unit data.")
        sys.exit(0)

    print("Data is for period {}, {}".format(udd.period, udd.date))
    fmt = StdoutFormatter('9s', '30s', '>10.4f', '>10s', '>10.4f', '>10s',
                          '>10.4f', '>10.4f', '>10.4f', ">10.4f")
    print("{:43s}     Bid Volume              Offer Volume           Cashflow".
          format(' '))
    print(
        fmt.titles("NGC", 'Lead', 'Original', 'Tagged', 'Original', 'Tagged',
                   'Bid', 'Offer', 'Bid Rate', 'Offer Rate'))
    for bmu in udd.data:
        print(
            fmt.row(
                bmu.id, bmu.lead, bmu.bid_volume,
                multi_level_get(bmu.volume, 'bid_values.tagged.total.value',
                                'n/a'), bmu.offer_volume,
                multi_level_get(bmu.volume, 'offer_values.tagged.total.value',
                                'n/a'), bmu.bid_cashflow, bmu.offer_cashflow,
                bmu.rate("bid"), bmu.rate("offer")))
    return udd