-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add possibility to save as .tif with compression #220
Comments
Is GDAL now available through BB? |
A PR would be much appreciated, since we otherwise have a long list of things to address in Circuitscape and may not get around to this before JuliaCon. |
GDAL is available as an artifact: https://github.com/JuliaBinaryWrappers/GDAL_jll.jl |
I'll try to do a PR, but I can't guarantee I'll have time soon. I'll try! |
@glaroc I'm happy to help along the way. Feel free to ping me here or on Slack if you have any questions. |
If this is figured out, might make it low-hanging fruit to also allow tif files as input, which would help make workflows more efficient. +1 from me! |
I think the easiest method would be to use the GeoArrays package to load the tif files, then copy the CRS from the input to create GeoArrays for the outputs and save them as tifs again with GeoArrays.write(). This workflow should be quite straightforward. |
Note that this should also speed up i/o quite a bit, especially for large files. I just did a test by importing the same file as asc and geotiff: @time ga2=readdlm("test.asc",Float32,skipstart=6) @time ga = GeoArrays.read("test.tif") |
Is there an easy way of converting |
I'm not a Julia expert, but it should be as simple as: @time ga2=Array{Float32}(ga)[:,:,1]' There might be a better, more efficient way of doing it...? |
That seems to kill a lot of the speed. Any idea why the conversion is so slow? Also may need a copy or something, since this is still an adjoint. I wonder if |
I'm not sure why this is so slow. I guess it's just going from a 2x2xN array to a 2x2 array? A simple solution is just to extract the first band. permutedims seems to work. @time ga2=permutedims(ga[:,:,1]) |
I'm 100% for adding support for tifs, so this is just playing devil's advocate... One potential downside to accommodating tifs is that it requires users to have GDAL, which is a rather large dependency. Does Many Circuitscape users are already "spatial" people, so many would probably already have GDAL installed for other applications (such as GIS packages in R). The added dependency might not really be a big deal at all -- and users probably won't mind the slight hassle of installing GDAL and accommodating the space it takes up if it means they no longer need to worry about file format conversion. |
A GDAL dep could also open up a whole world of additional possibilities for new Circuitscape features. |
@vlandau Since GDAL is available as a Binary Build (see BB discussion above), GDAL doesn't need to be compiled and installed separately. Just need to run Pkg.add("GDAL_jll") |
Awesome. I wasn't sure what a BB was -- I'm still a bit of a programming newbie! :) |
Yes, it will all come automatically. We definitely don't want to use a GDAL on people's computers. With BB (BinaryBuilder), we provide precompiled binaries for all architectures. See: https://julialang.org/blog/2019/11/artifacts/ In fact |
BB is a very Julia specific acronym and a very recent one that only package authors mostly know about! We're going to get a website and more information on it out eventually... |
Just published a PR that implements this using GeoArrays. Seems to work well with my files, but I didn't do in-depth testing. Edit: I just cleaned up the PR and resubmitted it. |
We are producing a very large number of Circuitscape outputs and the .asc format is really not a good format for storing large rasters. It seems like it would be quite straightforward to add the possibility to save the outputs as .tif with LZW lossless compression using GDAL.jl. This would create files that are much smaller and more optimized for GIS viewing.
The text was updated successfully, but these errors were encountered: