[gdal-dev] gdal_calc output to multiband nedcdf ?

Laurențiu Nicola lnicola at dend.ro
Thu Oct 20 11:26:28 PDT 2022


Hello,

I've never tried it, but I believe you can describe some computations in a VRT. But gdal_calc can't do this, so you'd need to write the VRT directly as XML. That's probably not much easier than writing some Python or C++ to perform the same computation.

Laurentiu

On Thu, Oct 20, 2022, at 21:06, Jonas Ardö via gdal-dev wrote:
> 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
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221020/071cfc27/attachment.htm>


More information about the gdal-dev mailing list