QUIC-Fire-TT / ttrs_quicfire

ttrs_quicfire is a Python library to easily configure burn models for plots of land defined using shape files for the quicfire model.
MIT License
0 stars 1 forks source link

Build Black better #10

Open cbonesteel opened 2 years ago

cbonesteel commented 2 years ago

Issue #5

Description

This branch adds a build black functionality to the workflow. There are two new functions, one in quic_fire.py and the other in build_shapefiles.py. The quic_fire function is the main interface function for the user. It allows the user to define a wind_dir, shape_path, and a pair of floats that are used for the theta angles of the wedge to select the edge of the unit called ring_thetas. Currently, wind_dir is unused but will be used in the future for automatic selection of the downwind side of the unit. This is currently not implemented as there is not an effective solution that doesn't miss parts of the desired burn area in some cases. The build_shapefiles function is a helper function that builds the wedge and ignitions shapefile for the burn. This ignition shapefile is currently used for creating a buffered mask into the unit to remove fuel. In the future it can be used for building the actual ignitions in the unit.

Motivation and Context

Beforehand, there was no easy way to select an edge of the unit to create a fuel break on without manually adding another shapefile. This update allows the user to easily select and area and create a fuelbreak from within the script that can then also be easily changed as they change simulation parameters.

Test Cases

I tested this update by plotting the wedge outputs in association with their edge selection as shown below: mask3 ignition3 I then checked the fuel break creation by plotting the fuel for the unit with a 5m fuelbreak all the way around and then a 10m fuel break on the selected portion of the unit. This shows that the fuelbreak was built into the unit only and is only for the selected portion of the unit. burn_black_confirmation

Checklist

cbonesteel commented 2 years ago

I just thought about this but the build black function currently has a constant buffer size of 5m. Should we make this a variable? https://github.com/QUIC-Fire-TT/ttrs_quicfire/blob/da8a52ced7724e7bfb0de92aa8f5e30d78361003/ttrs_quicfire/quic_fire.py#L229

cbonesteel commented 2 years ago

I just made a commit that should add a burn black "pre-ignition" to the atv_ignitions function. This will probably be slightly redone when we move from atv ignitions to a generalized ignitions function but as it stands this function now has a BURN_BLACK flag that if set to true generates the ignition lines for the selected theta angles and prepends it to the ignitions file as shown in the test output below. This test file shows ATV_Num instead of timings for reference of which coordinates are the initial burn.

Screen Shot 2022-06-14 at 11 37 12 AM
cbonesteel commented 2 years ago

@zacharycope0 I figured I'd tag you because you probably haven't been getting notifications on these updates.

I just generated a gif to confirm the order of the ignitions and it all looks good to me. Let me know what you think. The only thing that might be an issue as it stands is it goes straight from burning the break to burning the unit so if you want to add a space of time in there some changes have to be made. ignitions

cbonesteel commented 2 years ago

It took a little bit of work to get the ring_thetas to cooperate on the east side of the unit like we had talked about but my solution is that if ring_thetas[0] > ring_thetas[1] it finds the ring from ring_thetas[0] to 360 and 0 to ring_thetas[1] and concatonates them. It produces what is shown below for an input of (330, 30): mask4 This is what is produced from the ignitions: ignitions-east-break As we discussed yesterday, it is building them directly from east to west instead of in a line.

zacharycope0 commented 2 years ago

Good start, but I think this still needs a little work.

1) For qf_arrs.build_black(wind_dir=avg_wind_dir, ring_thetas=[0.0, 180.0]). It doesn't seem like the wind_dir is used. Instead it only considers what you put in for the ring_thetas. Shouldn't the ring_theta be +and- 45 of the downwind direction? Let me know if you think I'm doing something wrong.

2) For qf.atv_ignition(BURN_BLACK=True) . The ignitions are falling in the fuel break and are therefore not igniting fuel. You will need to figure out of the buffer the burn plot so that the inner circle falls within the fuel break. Select a portion of the smaller inner circle to build the ignition points.

cbonesteel commented 2 years ago
  1. I had thought we decided that it was best to just use user defined ring_thetas for now. If this was not the case I can quickly change that to +/- 45 degrees from the wind direction.
  2. I think I'm confused on what you mean here. I was under the impression that the point of burning black was to more or less help create the fuel break. The inner circle seems very close to the center of the unit to be burning to accomplish this. Could you elaborate a bit more on the issue and how you are setting up the run or could we discuss the problem definition again to better define it?
zacharycope0 commented 2 years ago

1) I think we should make it either/or. If a wind direction is input then do +/-45 however it will use the ring_thetas if no wind direction is provided by the user.

2) I'm having trouble explaining what I mean by inner ring. I mean the inner ring of the buffered burn plot not the inner ring of the ring theta. I'll give you a call.

cbonesteel commented 2 years ago

I just updated the first issue you mentioned. If no theta angle is given, 45 degrees on either side of the downwind angle is taken as shown below for an angle of 200. wind_200_burn_black I am still getting a weird bug on the west side of the unit where it closes the polygon when more than a certain number of linestrings are selected and I don't know why. wind_90_burn_black_bug