Skip to content

Commit

Permalink
Merge pull request #7 from xKDR/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ayushpatnaikgit committed Feb 25, 2022
2 parents 961d141 + 9e341fa commit e09e57a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/aggregate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ shapefile_df = load_shapefile("assets/mumbai_map/mumbai_districts.shp")
aggregate_per_area_dataframe(MUMBAI_COORDINATE_SYSTEM, rand_datacube, shapefile_df, "District")
```
"""
function aggregate_per_area_dataframe(geometry::CoordinateSystem, datacube, shapefile_df, attribute)
function aggregate_per_area_dataframe(geometry::CoordinateSystem, datacube, shapefile_df, attribute, res = 15)
datacube = Array{Float32}(datacube)
datacube = sparse_cube(datacube)
df = DataFrame()
@showprogress for i in 1:length(shapefile_df[:, 1])
shapefile_row = shapefile_df[i, :]
geom_polygon = polygon_mask(geometry, shapefile_row)
df[!, shapefile_df[!, attribute][i]] = aggregate_timeseries(datacube, geom_polygon) ./mask_area(geometry, geom_polygon)
df[!, shapefile_df[!, attribute][i]] = aggregate_timeseries(datacube, geom_polygon) ./mask_area(geometry, geom_polygon, res)
i = i + 1
end
return df
Expand Down
2 changes: 1 addition & 1 deletion src/data_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load_img("example.tif")
"""
function load_img(filepath, top_left, bottom_right)
img = load_img(filepath)
img = img[top_left[1]:bottom_right[1], top_left[2]:bottom_right[2]]
img = img[top_left[1]+1:bottom_right[1], top_left[2]+1:bottom_right[2]]
GC.gc()
return img
end
Expand Down

0 comments on commit e09e57a

Please sign in to comment.