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

Infinite warnings while using mask #347

Closed
ayushpatnaikgit opened this issue Dec 10, 2022 · 2 comments
Closed

Infinite warnings while using mask #347

ayushpatnaikgit opened this issue Dec 10, 2022 · 2 comments

Comments

@ayushpatnaikgit
Copy link

I am getting infinite warnings while using Rasters.mask

using Rasters, Shapefile, DataFrames
raster = Raster("DATA/Harmonized_DN_NTL_2020_simVIIRS.tif")
shp = Shapefile.Table("DATA/world_shapefile/in_primary_countries.shp") |> DataFrame
japan_index = findall( x -> x == "Japan", shp.name)
japan = crop(raster; to = shp.geometry[japan_index])
japan_masked = mask(japan, with = shp.geometry[japan_index]) 
┌ Warning: (Band,) dims were not found in object
└ @ DimensionalData.Dimensions ~/.julia/packages/DimensionalData/yMNeq/src/Dimensions/primitives.jl:648
┌ Warning: (Band,) dims were not found in object
└ @ DimensionalData.Dimensions ~/.julia/packages/DimensionalData/yMNeq/src/Dimensions/primitives.jl:648
┌ Warning: (Band,) dims were not found in object
└ @ DimensionalData.Dimensions ~/.julia/packages/DimensionalData/yMNeq/src/Dimensions/primitives.jl:648
┌ Warning: (Band,) dims were not found in object
└ @ DimensionalData.Dimensions ~/.julia/packages/DimensionalData/yMNeq/src/Dimensions/primitives.jl:648

I am also getting these while using Rasters.zonal

zonal(sum, raster; of=shp.geometry)

The performance also seems bad and variable. On some occasions, it takes 30 seconds and on some, it takes up to an hour. I am unable to replicate that, perhaps it's related to my memory usage.

For replication, the tif file can be obtained here. And the Shapefile can be obtained here.

I've also tried the same with a different tif file.

PS:

I am making a tutorial on using Rasters, and this is something I found while making the Jupyter notebook for it.
https://github.com/xKDR/datascience-tutorials/blob/main/rasters.ipynb

@rafaqz
Copy link
Owner

rafaqz commented Dec 11, 2022

I think this is already fixed on master, and the 0.4.5 patch version should be registered in the next half hour.

Good work on the notebook! will this be in a blog post or something similar?

@ayushpatnaikgit
Copy link
Author

Is it fixed! The speed is spectacular.

I've been teaching raster analysis at a few places, so I thought I'll make a notebook + video and circulate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants