Im am trying to convert a radar file provided in HDF5 to a GeoTIFF using gdal.Translate() in my Python script.
An example of the HDF5 file can be downloaded here
I have already managed to get it working using the commandline and gdal_translate which gives me the expected result:
import os
os.system('gdal_translate -of GTiff \
-a_srs "+proj=stere +lat_0=90 +lon_0=0 +lat_ts=60 +a=6378140 +b=6356750 +x_0=0 y_0=0" \
-a_ullr 0.0 -3649999.1798970395 700000.9100000001 -4415003.157897039 \
"HDF5:\"RAD_NL25_PCP_NA_201910281110.h5\"://image1/image_data" \
"test-translate.tif"')
However, when I try to do the same using library function gdal.Translate() inside my script I get an error.
My code:
from osgeo import gdal
kwargs = {
'format': 'GTiff',
'projWinSRS' : '+proj=stere +lat_0=90 +lon_0=0 +lat_ts=60 +a=6378140 +b=6356750 +x_0=0 y_0=0',
'projWin' : [0.0, -3649999.1798970395, 700000.9100000001, -4415003.157897039]
}
fn = 'HDF5:\"RAD_NL25_PCP_NA_202101080825.h5\"://image1/image_data'
dst_fn = 'output.tif'
ds = gdal.Translate(dst_fn, fn, **kwargs)
ds = None
Gives me the following errors:
ERROR 0: -projwin_srs ignored since the dataset has no projection.
ERROR 1: Error: Computed -srcwin 0 -3.65e+06 700001 -765004 has negative width and/or height.
Am I doing something wrong?