def fig_fire_propagation(fire_prop: FirePropagation, original_ignition: ty.Sequence[TimedPoint], max_time: float = np.inf) -> display.GeoDataDisplay: """Reference fire display Figure terrain + ignition contour + ignition point""" gdd = display.GeoDataDisplay.pyplot_figure( fire_prop.environment.raster.combine(fire_prop.ignitions().slice( ["ignition"])), frame=(0., 0.)) # gdd.draw_elevation_shade(with_colorbar=False, cmap=matplotlib.cm.terrain) # gdd.draw_wind_quiver() gdd.draw_ignition_shade(time_range=(0, max_time)) gdd.draw_ignition_contour(with_labels=True, cmap=matplotlib.cm.plasma, time_range=(0, max_time)) for o in original_ignition: gdd.draw_ignition_points(o) return gdd
def create_wildfire_propagation(area, ignition: ty.Sequence[TimedPoint], wind_speed=1., wind_direction=3 * np.pi / 4, world=THE_WORLD) -> FirePropagation: """Reference wildfire propagation""" fire_env = Environment(area, wind_speed, wind_direction, world) fire_prop = FirePropagation(fire_env) for ig in ignition: fire_prop.set_ignition_point(ig) propagation_end_time = np.inf fire_prop.propagate(propagation_end_time) return fire_prop
FIRERS_LANDCOVER_DATA = os.path.join(FIRERS_DATA_FOLDER, 'landcover/') the_world = g_environment.World( elevation_path=FIRERS_DEM_DATA, wind_path=FIRERS_WIND_DATA, landcover_path=FIRERS_LANDCOVER_DATA, wind_mesh_resolution='fine', landcover_to_fuel_remap=g_environment.EVERYTHING_FUELMODEL_REMAP) the_world.dem_wind_tile_split = 1 fire_env = Environment(((480025.0, 485025.0), (6210000.5, 6215000.5)), 5, 1.75 * np.pi, the_world) # fire_env = Environment(((470010.0, 485010.0), (6210010.0, 6225010.0)), 5, 0, the_world) # fire_env = Environment(((574995.0, 575005.0), (6199995.0, 6200005.0)), 5, 0, the_world) fire_prop = FirePropagation(fire_env) # now = 0 now = datetime.datetime(2020, 1, 1, 0, 0).timestamp() ignitionpoint1 = TimedPoint(482000, 6212000.0, now) ignitionpoint2 = TimedPoint(482000 - 250, 6212000.0 + 1800, now) ignitionpoint3 = TimedPoint(482000 + 2000, 6212000.0 + 2000, now) fire_prop.set_ignition_point(ignitionpoint1) fire_prop.set_ignition_point(ignitionpoint2) fire_prop.set_ignition_point(ignitionpoint3) # fire_prop.set_ignition_point(TimedPoint(575000.0, 6200000.0, 0)) propagation_end_time = now + 60 * 60 * 4 export_front = (7000, 7100) fire_prop.propagate(propagation_end_time)
FIRERS_WIND_DATA = os.path.join(FIRERS_DATA_FOLDER, 'wind') FIRERS_LANDCOVER_DATA = os.path.join(FIRERS_DATA_FOLDER, 'landcover') the_world = g_environment.World(elevation_path=FIRERS_DEM_DATA, wind_path=FIRERS_WIND_DATA, landcover_path=FIRERS_LANDCOVER_DATA) seganosa_fire_env = Environment([[2799134.0, 2805134.0], [2296388.0, 2302388.0]], 3, 0, the_world) # 6km by 6km around seganosa. Wind: 3m/s W->E # FIRE PROPAGATION ## Fire started 6 hours ago. Predict until 2 hours in the future fire_prop = FirePropagation(seganosa_fire_env) four_hours_ago = (datetime.datetime.now() - datetime.timedelta(hours=6)).timestamp() now = datetime.datetime.now().timestamp() four_hours_from_now = (datetime.datetime.now() + datetime.timedelta(hours=2)).timestamp() fire_start = TimedPoint(2802134.0 - 1500.0, 2299388.0, four_hours_ago) fire_prop.set_ignition_point(fire_start) fire_prop.propagate(until=four_hours_from_now) ## Figure terrain + ignition contour + ignition point gdd = display.GeoDataDisplay.pyplot_figure( seganosa_fire_env.raster.combine(fire_prop.ignitions().slice(["ignition"])), frame=(0., 0.)) gdd.draw_elevation_shade(with_colorbar=False, cmap=matplotlib.cm.terrain) gdd.draw_wind_quiver() gdd.draw_ignition_contour(with_labels=True, cmap=matplotlib.cm.plasma)
FIRERS_LANDCOVER_DATA = os.path.join(FIRERS_DATA_FOLDER, 'landcover') the_world = g_environment.World(elevation_path=FIRERS_DEM_DATA, wind_path=FIRERS_WIND_DATA, landcover_path=FIRERS_LANDCOVER_DATA, wind_mesh_resolution='fine', landcover_to_fuel_remap=g_environment.SLOW_FUELMODEL_REMAP) the_world.dem_wind_tile_split = 1 area = ((2776825.0 - 200, 2776825.0 + 200), (2212175.0 - 200, 2212175.0 + 200)) ignition = TimedPoint(2776825.0+25, 2212175.0-75, 0) ################################################################################ # Reference fire propagation fire_env = Environment(area, 2., 3 * np.pi / 4, the_world) fire_prop = FirePropagation(fire_env) fire_prop.set_ignition_point(ignition) propagation_end_time = 60 * 60 * 60 propagation_end_time = np.inf fire_prop.propagate(propagation_end_time) ################################################################################ # Reference fire display # Figure terrain + ignition contour + ignition point gdd = display.GeoDataDisplay.pyplot_figure( fire_env.raster.combine(fire_prop.ignitions().slice(["ignition"])), frame=(0., 0.)) # gdd.draw_elevation_shade(with_colorbar=False, cmap=matplotlib.cm.terrain) # gdd.draw_wind_quiver() gdd.draw_ignition_contour(with_labels=True, cmap=matplotlib.cm.plasma)
the_world = g_environment.World( elevation_path=FIRERS_DEM_DATA, wind_path=FIRERS_WIND_DATA, landcover_path=FIRERS_LANDCOVER_DATA, wind_mesh_resolution='fine', landcover_to_fuel_remap=g_environment.CONSTANT_FUELMODEL_REMAP) the_world.dem_wind_tile_split = 1 area = ((2776825.0 - 1500, 2776825.0 + 1500), (2212175.0 - 500, 2212175.0 + 500)) ignition = TimedPoint(2776825.0, 2212175.0, 0) fire_env = Environment(area, 0., 0, the_world) fire_prop = FirePropagation(fire_env) fire_prop.set_ignition_point(ignition) propagation_end_time = 20 * 60 * 60 fire_prop.propagate(propagation_end_time) # Figure terrain + ignition contour + ignition point gdd = display.GeoDataDisplay.pyplot_figure(fire_env.raster.combine( fire_prop.ignitions().slice(["ignition"])), frame=(0., 0.)) gdd.draw_elevation_shade(with_colorbar=False, cmap=matplotlib.cm.terrain) gdd.draw_wind_quiver() gdd.draw_ignition_contour(with_labels=True, cmap=matplotlib.cm.plasma) gdd.draw_ignition_points(ignition)