I’m trying to read in data from the DWD opendata (in DX format) and write out a GeotTIFF format that can be understood by GDAL.
I’m following very closely the following the oficial tutorial.
I have read in the data in radial coordinates with wrl.io.read_dx
, then I have obtained the coordinates of the data points in the projected coordinates with wrl.georef.spherical_to_xyz
. This gives me also the projection used:
PROJCS[“unknown”,
GEOGCS[“unknown”,
DATUM[“WGS_1984”,
SPHEROID[“WGS 84”,6378137,298.257223563,
AUTHORITY[“EPSG”,“7030”]],
AUTHORITY[“EPSG”,“6326”]],
PRIMEM[“Greenwich”,0,
AUTHORITY[“EPSG”,“8901”]],
UNIT[“degree”,0.0174532925199433,
AUTHORITY[“EPSG”,“9122”]],
AUTHORITY[“EPSG”,“4326”]],
PROJECTION[“Azimuthal_Equidistant”],
PARAMETER[“latitude_of_center”,47.8744],
PARAMETER[“longitude_of_center”,8.005],
PARAMETER[“false_easting”,0],
PARAMETER[“false_northing”,0],
UNIT[“metre”,1,
AUTHORITY[“EPSG”,“9001”]],
AXIS[“Easting”,EAST],
AXIS[“Northing”,NORTH]]
Finally, I have interpolated the data into a regular grid in the Azimutal Equidistant projection with wrl.comp.togrid
. So far, this is basically following the tutorial.
Now, I’d like to write this as a GeoTiff with rasterio. The idea is that I have to define the metadata, i.e. two things:
- the crs, which I already have as it was given by the
wrl.georef.spherical_to_xyz
function of wradlib. For translating the data between wradlib and rasterio, I usecrs = rasterio.crs.CRS.from_proj4(rad.ExportToProj4()
- the affine transformation
The second one is what I don’t know. I have left this undefined in rasterio when writing the GeoTiff, which basically is filled in with an identity transformation. I have imported the result GeoTiff into QGIS and the result is that the image is correctly centered where it should be, but it is tiny. The problem, obviously, is that QGIS is interpreting the units as meters (as claimed by the WKT), therefore my image, of size 400x400 pixels, is interpreted as size 400 m x 400 m, whereas it should be 128 km x 128 km.
How can I calculate the affine transformation that informs rasterio about the actual size of the image?
Thanks!