Skip to content
Snippets Groups Projects
Commit d3cc190b authored by Julia Signell's avatar Julia Signell
Browse files

Use exterior pixels from previous timesteps as well as new pixels

parent 2a451900
No related branches found
No related tags found
4 merge requests!72[DRAFT] All the changes,!70Make it easier to use filepaths as inputs to pipelines,!67Back all `AllFires` and `Fire` objects with 2 dataframes,!61Additions: primary keys, speed ups (preprocessing and postprocessing), tests, scalene, reorg entire fireatlas
......@@ -724,16 +724,23 @@ class Fire:
def updatefhull(self):
""" Update the hull using old hull and new locs
"""
import FireVector
import pandas as pd
import FireVector, FireTime
# get previous hull and pixels from all previous timesteps
phull = self.hull
ppixels = self.allpixels[
(self.allpixels["fid"] == self.fireID) & (self.allpixels["t"] < FireTime.t2dt(self.t))
]
# find the pixels that are near the previous hull
extpixels = ppixels[FireVector.get_ext_pixels(ppixels, phull)]
hull = FireVector.cal_hull(self.newlocs, sensor=self.sensor)
# combine those with the new pixels and calculate the hull
locs = pd.concat([extpixels, self.newpixels])[["x", "y"]].values
hull = FireVector.cal_hull(locs, sensor=self.sensor)
# use the union to include hull in past time step
if hasattr(self, "hull"):
phull = self.hull
self.hull = phull.union(hull)
else:
self.hull = hull
# use the union of the newly calculated hull and the previous hull
self.hull = phull.union(hull)
def updatefline(self):
import FireVector
......
......@@ -147,7 +147,7 @@ def cal_hull(locs, sensor="viirs"):
return hull
def get_is_exterior(pixels, hull):
def get_ext_pixels(pixels, hull):
""" calculate the exterior pixels around a hull
Parameters
----------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment