Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding out of memory loading and cropping of images. #11

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Adding out of memory loading and cropping of images.
  • Loading branch information
ayushpatnaikgit committed Mar 8, 2022
commit 1b5c878929e29d49628826d24ad5b4c3ea9fee23
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NighttimeLights"
uuid = "4d912a30-7731-4b12-9bf5-9d9a78b4f19a"
authors = ["Ayush Patnaik", "Ajay Shah", "Anshul Tayal", "Susan Thomas"]
version = "0.4.2"
version = "0.4.3"

[deps]
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
Expand Down
6 changes: 3 additions & 3 deletions src/data_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ load_img("example.tif")
```
"""
function load_img(filepath, top_left, bottom_right)
img = load_img(filepath)
img = img[top_left[1]+1:bottom_right[1], top_left[2]+1:bottom_right[2]]
img = ArchGDAL.readraster(filepath)
img = img[top_left[1]+1:bottom_right[1], top_left[2]+1:bottom_right[2], 1]
GC.gc()
return img
return Array{Union{Missing, Float16}, 2}(img_trans')
end


Expand Down
1 change: 1 addition & 0 deletions test/data_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
radiance_img_path = assets_path * "/mumbai_ntl/img/april2012.tif"
@test length(size(load_datacube(radiance_jld_path))) == 3
@test length(size(load_img(radiance_img_path))) == 2
@test length(size(load_img(radiance_img_path ,[10, 10], [50, 50]))) == 2
@test sizeof(load_shapefile(map_path)) > 0
end