[gdal-dev] gdal_calc output to multiband nedcdf ?

Jonas Ardö jonas.ardo at nateko.lu.se
Thu Oct 20 11:06:34 PDT 2022


Dear gdal-gurus,

Trying to use*gdal_calc* to  do the same calculation for tow 366 band 
(daily data) files and store it in a *.nc file with the same dimensions 
as the input files.

This works OK (output to 366 tiff files):
for i in {1..366} # One band per day output to tif
do
   gdal_calc.py   --calc="exp( (17.625*D) /(243.04+D) ) / exp( 
(17.625*T)/(243.04+T) ) * 100" --outfile=Rh_2020_day$i.tif -D 
DPTa_dayavg_C_2020.nc -T Ta_dayavg_C_2020.nc  --D_band=$i --T_band=$i
done


This do not work (output to one netcdf file):
for i in {1..366} # One band per day output to tif
do
   gdal_calc.py   --calc="exp( (17.625*D) /(243.04+D) ) / exp( 
(17.625*T)/(243.04+T) ) * 100" --outfile=Rh_2020.nc -D 
DPTa_dayavg_C_2020.nc -T Ta_dayavg_C_2020.nc  --D_band=$i --T_band=$i
done

yields:
Error! Output exists, but is the wrong geotransform.  Use the 
--overwrite option to automatically overwrite the existing file
Error! Output exists, but is the wrong geotransform.  Use the 
--overwrite option to automatically overwrite the existing file

Any suggestions how to make the output into a 366-band netcdf file?

using on Cygwin: gdalinfo.exe --version GDAL 3.5.1, released 2022/06/30 
Regards /Jonas, Lund University, Sweden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221020/972147e5/attachment.htm>


More information about the gdal-dev mailing list