Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fireatlas_nrt
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gcorradini
fireatlas_nrt
Commits
68979b43
Commit
68979b43
authored
3 years ago
by
screbec
Browse files
Options
Downloads
Patches
Plain Diff
repace sensor parameter with buffer and alpha values, default form fireconsts viirs
parent
a0d19c5e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FireVector.py
+15
-15
15 additions, 15 deletions
FireVector.py
with
15 additions
and
15 deletions
FireVector.py
+
15
−
15
View file @
68979b43
...
...
@@ -246,7 +246,7 @@ def doConcH(locs,buf,alpha=100):
return
None
def
cal_hull
(
fp_locs
,
sensor
=
'
viirs
'
):
def
cal_hull
(
fp_locs
,
buf
=
None
,
alpha
=
None
):
'''
wrapper to calculate the hull given fire locations.
the returned hull type depends on the pixel number
...
...
@@ -260,18 +260,15 @@ def cal_hull(fp_locs,sensor = 'viirs'):
hull : object
calculated hull (a buffer of VIIRS half pixel size included)
'''
from
FireConsts
import
valpha
,
lalpha
,
VIIRSbuf
#,MCD64buf
import
numpy
as
np
# set buffer according to sensor
if
sensor
==
'
viirs
'
:
# if not args are given we assume viirs buffer and alpha
if
not
alpha
:
from
FireConsts
import
valpha
alpha
=
valpha
if
not
buf
:
from
FireConsts
import
VIIRSbuf
buf
=
VIIRSbuf
elif
sensor
==
'
mcd64
'
:
buf
=
VIIRSbuf
else
:
buf
=
30
valpha
=
lalpha
# buf = MCD64buf
# number of points
nfp
=
len
(
fp_locs
)
...
...
@@ -292,10 +289,10 @@ def cal_hull(fp_locs,sensor = 'viirs'):
x
,
y
=
zip
(
*
fp_locs
)
vdeg
=
sum
(
x
)
/
len
(
x
)
km1deg
=
6371
*
np
.
cos
(
np
.
deg2rad
(
vdeg
))
*
2
*
np
.
pi
/
360
valphadeg
=
1
/
(
v
alpha
/
1000
/
km1deg
)
# in 1/deg
valphadeg
=
1
/
(
alpha
/
1000
/
km1deg
)
# in 1/deg
hull
=
doConcH
(
fp_locs
,
buf
,
alpha
=
valphadeg
)
# hull = doConcH(fp_locs,alpha=
v
alpha)
# hull = doConcH(fp_locs,alpha=alpha)
if
hull
==
None
:
# in case where convex hull can't be determined, call doMultP
hull
=
doMultP
(
fp_locs
,
buf
)
elif
hull
.
area
==
0
:
...
...
@@ -337,7 +334,7 @@ def cal_extpixels(fps,hull,alpha=100):
fps_ext
.
append
(
fp
)
return
fps_ext
def
update_hull
(
phull
,
fp_locs
,
sensor
=
'
viirs
'
,
alpha
=
100
):
def
update_hull
(
phull
,
fp_locs
):
'''
calculate the hull by using the new pixel locations and previous hull vertices only
(This can be faster when existing fire has many pixels)
...
...
@@ -371,9 +368,12 @@ def update_hull(phull,fp_locs,sensor='viirs',alpha=100):
# record only those not in the interior part of the existing hull
if
not
hts_buf
.
contains
(
pt
):
fp_locs_ext
.
append
((
pt
.
y
,
pt
.
x
))
# # take difference instead of loop? need to benchmark
# fp_locs_ext = [(pt.y,pt.x) for pt in pts.difference(hts_buf)]
# use the exteror points to calculate hull (this can save a lot of time)
hull
=
cal_hull
(
fp_locs_ext
,
sensor
=
sensor
)
hull
=
cal_hull
(
fp_locs_ext
)
# use the union to include hull in past time step
hull_new
=
phull
.
union
(
hull
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment