JuliaGeo / GDAL.jl

Thin Julia wrapper for GDAL - Geospatial Data Abstraction Library
MIT License
90 stars 13 forks source link

NetCDF interoperability #134

Closed alex-s-gardner closed 2 years ago

alex-s-gardner commented 2 years ago

I'm running into issues trying to use gdal_translate with GDAL.jl

using GDAL 3.4.0, released 2021/11/04 from the terminal I can run the following without issue gdal_translate -of COG NETCDF:"/path/to/file.nc":v /path/to/file.tif

using GDAL.jl I try the same as:

GDAL.gdal_translate_path() do gdal_translate
  run(`$gdal_translate -of COG NETCDF:\"/path/to/file.nc\":v /path/to/file.tif`)
end

returns the error: NETCDF:"/path/to/file.nc":v: No such file or directory

Not sure if this has anything to do with the handling of \" or not

any insights would be greatly appreciated.

I also have similar issues when trying to build vrts from netcdf files

visr commented 2 years ago

The reason this fails is because the GDAL build we use is currently not built against libnetcdf, which is needed to add netCDF support. The dependencies that we do use can be found in https://github.com/JuliaPackaging/Yggdrasil/tree/master/G/GDAL in build_tarballs.jl under dependencies.

There is a NetCDF_jll that we could try to add there. However it is plagued by issues like https://github.com/JuliaPackaging/Yggdrasil/issues/4511, because there is no good cross compilation support. So it's probably best to wait adding such a dependency until it is relatively stable.

See also #65 for discussion on which formats to support.

alex-s-gardner commented 2 years ago

@visr thanks for the info and all the work on this. This is disappointing as much (most) remote sensing and climate data is packaged as netCDF's. Any where I should post to bump up inclusion... or will this just happen naturally over time and I should just be patient, or learn to do it myself, cuz everyone is doing the best they can.

visr commented 2 years ago

Note that there are netCDF packages like NCDatasets.jl. And Rasters.jl depends on that as well as GDAL, so that could be a bridge between netCDF and other geospatial formats.

Of course nothing really happens automatically, unless someone puts in the effort. You could have a look through the issue I linked and related issues. Though it mostly comes down to (cross) compiling C++ codes, which I also don't know much about. Probably it would also help if your organization has support with HDFGroup to ask them for support with https://github.com/JuliaPackaging/Yggdrasil/pull/567 / https://github.com/HDFGroup/hdf5/issues/1203.

alex-s-gardner commented 2 years ago

OK, thanks for the thoughts... let me do some poking around NASA and see if I can find out if they have any interest in supporting this

Rapsodia86 commented 2 years ago

@alex-s-gardner Any news?

evetion commented 2 years ago

While there still needs to be better cross compilation support, the latest GDAL_jll should have NetCDF and HDF5 support on the most common platforms.

https://github.com/JuliaPackaging/Yggdrasil/pull/5466