Skip to content

Commit

Permalink
Merge pull request #39 from NASA-IMPACT/bug/33-timeseries-values
Browse files Browse the repository at this point in the history
pctcover should be 0-1 scaled, close #33
  • Loading branch information
drewbo authored Jul 27, 2020
2 parents abd3476 + e7e5577 commit 5c17d96
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions covid_api/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def rasterize_pctcover(geom, atrans, shape):
# Create percent cover grid as the difference between them
# at this point all cells are known 100% coverage,
# we'll update this array for exterior points
pctcover = (alltouched - exterior) * 100
pctcover = alltouched - exterior

# loop through indicies of all exterior cells
for r, c in zip(*np.where(exterior == 1)):
Expand All @@ -199,8 +199,7 @@ def rasterize_pctcover(geom, atrans, shape):
cell_overlap = cell.intersection(geom)

# update pctcover with percentage based on area proportion
coverage = cell_overlap.area / cell.area
pctcover[r, c] = int(coverage * 100)
pctcover[r, c] = cell_overlap.area / cell.area

return pctcover

Expand Down

0 comments on commit 5c17d96

Please sign in to comment.