GDAL.jl icon indicating copy to clipboard operation
GDAL.jl copied to clipboard

NetCDF interoperability

Open alex-s-gardner opened this issue 3 years ago • 5 comments

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

alex-s-gardner avatar Mar 02 '22 17:03 alex-s-gardner

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.

visr avatar Mar 02 '22 19:03 visr

@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.

alex-s-gardner avatar Mar 02 '22 20:03 alex-s-gardner

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.

visr avatar Mar 02 '22 20:03 visr

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

alex-s-gardner avatar Mar 02 '22 21:03 alex-s-gardner

@alex-s-gardner Any news?

Rapsodia86 avatar May 19 '22 13:05 Rapsodia86

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

evetion avatar Sep 12 '22 05:09 evetion