Example #1
0
def _run_fire(fire, fuel_loadings_manager, msg_level):
    logging.debug("Consume consumption - fire {}".format(fire.id))

    # TODO: set burn type to 'activity' if fire.fuel_type == 'piles' ?
    if fire.fuel_type == 'piles':
        raise ValueError("Consume can't be used for fuel type 'piles'")
    burn_type = fire.fuel_type

    # TODO: can I run consume on all fuelbeds at once and get per-fuelbed
    # results?  If it is simply a matter of parsing separated values from
    # the results, make sure that running all at once produces any performance
    # gain; if it doesn't,then it might not be worth the trouble
    for a in fire.activity:
        season = datetimeutils.season_from_date(a.get('start'))
        for fb in a['fuelbeds']:
            _run_fuelbed(fb, fuel_loadings_manager, season, a['location'],
                         burn_type, msg_level)
        # Aggregate consumption and heat over all fuelbeds in the activity window
        # include only per-phase totals, not per category > sub-category > phase
        a['consumption'] = datautils.summarize([a],
                                               'consumption',
                                               include_details=False)
        a['heat'] = datautils.summarize([a], 'heat', include_details=False)

    # Aggregate consumption and heat over all fuelbeds in *all* activity windows;
    # include only per-phase totals, not per category > sub-category > phase
    fire.consumption = datautils.summarize(fire.activity,
                                           'consumption',
                                           include_details=False)
    fire.heat = datautils.summarize(fire.activity,
                                    'heat',
                                    include_details=False)
Example #2
0
def _run_fire(fire, fuel_loadings_manager, msg_level):
    logging.debug("Consume consumption - fire {}".format(fire.id))

    # TODO: set burn type to 'activity' if fire.fuel_type == 'piles' ?
    if fire.fuel_type == 'piles':
        raise ValueError("Consume can't be used for fuel type 'piles'")
    burn_type = fire.fuel_type

    # TODO: can I run consume on all fuelbeds at once and get per-fuelbed
    # results?  If it is simply a matter of parsing separated values from
    # the results, make sure that running all at once produces any performance
    # gain; if it doesn't,then it might not be worth the trouble
    for ac in fire['activity']:
        for aa in ac.active_areas:
            season = datetimeutils.season_from_date(aa.get('start'))
            for loc in aa.locations:
                for fb in loc['fuelbeds']:
                    _run_fuelbed(fb, loc, fuel_loadings_manager, season,
                                 burn_type, msg_level)
Example #3
0
    def _run_on_fire(self, fire):
        logging.debug("Consume emissions - fire {}".format(fire.get("id")))

        if 'activity' not in fire:
            raise ValueError(
                "Missing activity data required for computing consume emissions")

        burn_type = fire.get("fuel_type") or 'natural'
        # TODO: set burn type to 'activity' if fire["fuel_type"] == 'piles' ?
        if burn_type == 'piles':
            raise ValueError("Consume can't be used for fuel type 'piles'")

        for a in fire['activity']:
            if 'fuelbeds' not in a:
                raise ValueError(
                    "Missing fuelbed data required for computing emissions")


            season = datetimeutils.season_from_date(a.get('start'))
            for fb in a['fuelbeds']:
                self._run_on_fuelbed(fb, season, a['location'], burn_type)