[gdal-dev] Merge in-memory datasets

Nikos Alexandris nik at nikosalexandris.net
Wed Apr 13 05:43:12 PDT 2022


Dear all,

I am trying to make use of in-memory datasets (to avoid creating
temporary files). Is it possible to merge two raster maps (read-in as
in-memory objects) and write out a netCDF file? `gdal_merge.py` seems
not to work with such objects, is it?

I am trying to improve a workflow (this one 
https://gis.stackexchange.com/a/426391/5256, or simpler the first 'part' 
of it, asked here: https://gis.stackexchange.com/q/427983/5256), in 
terms of speed mostly. For example, while `gdal_translate` commands can 
benefit from in-memory datasets (as shown in many Q&As and elsewhere 
Python scripts using GDAL's Python API), I can't find any example for 
`gdal_merge.py`, nor for `gdal_calc.py`.

Note rasterio's support for In-Memory files:
https://rasterio.readthedocs.io/en/latest/topics/memory-files.html.
However, it is known that support for writing netCDF files isn't great!
(See also:
https://rasterio.readthedocs.io/en/latest/topics/writing.html#supported-drivers)

Sorry for 'cross-posting' and kind regards, Nikos


More information about the gdal-dev mailing list