Getting Affine Transform of any DEM

How can we obtaind affine transformation of DEM? e.g.: COPERNICUS_30

Hi Andrea,
not sure what the question is, do you mean the transformation between array and map coordinates? Or a scaling and offset to apply to the values?

best regards,
Jeroen

I meant the affine transform which allows us to move, stretch, or even rotate set of points.

This is an example with raster:

import rioxarray as rxr
dem = rxr.open_rasterio('dem.tif')
transform = dem.rio.transform()

Output should look like these:

Affine(0.00027777777779320863, 0.0, 74.999861111,
       0.0, -0.00027777777779835176, 34.000138889)

How can we get the output as we can see above when we are working with a datacube:

dem = connection.load_collection('COPERNICUS_30')
dem = dem.reduce_dimension(reducer='mean',dimension='t') 

# This part does not work 
transform = dem.rio.transform()

Hi Andrea,
openEO takes care of the coordinate transformation for you, so normally you don’t really need it.
The backends do have this transform, internally, but it’s not exposed. The only way to currently get it would be to actually download the tiff or netCDF, and get the transform just like you do in your own example.

Not sure if this solves your problem, otherwise some more context might help to propose a better solution.

best regards,
Jeroen