@@ -126,22 +126,29 @@ def _download_dem(self):
126126
127127 # get the DEM data 1) SRTM V3 2) Copernicus GLO-30
128128 try :
129+ print (self .bounds , dem_names [0 ], dst_ellipsoidal_height , dst_area_or_point )
130+ self .dem_name = dem_names [0 ]
129131 X , p = stitch_dem (self .bounds ,
130- dem_name = dem_names [ 0 ] ,
132+ dem_name = self . dem_name ,
131133 dst_ellipsoidal_height = dst_ellipsoidal_height ,
132134 dst_area_or_point = dst_area_or_point )
133135 except Exception as error :
134136 LOG .info (error )
135137 LOG .info ('Downloading GLO-30 instead of SRTMV3' )
138+ self .dem_name = dem_names [1 ]
136139 X , p = stitch_dem (self .bounds ,
137- dem_name = dem_names [ 1 ] ,
140+ dem_name = self . dem_name ,
138141 dst_ellipsoidal_height = dst_ellipsoidal_height ,
139142 dst_area_or_point = dst_area_or_point )
140143
141144 # export to tif file
142145 with rasterio .open (self .file_dem , 'w' , ** p ) as ds :
143146 ds .write (X , 1 )
144- ds .update_tags (AREA_OR_POINT = dst_area_or_point )
147+ ds .update_tags (AREA_OR_POINT = dst_area_or_point , source = self .dem_name )
148+ else :
149+ with rasterio .open (self .file_dem ) as ds :
150+ self .dem_name = ds .tags ().get ('source' )
151+
145152
146153 def _utm_epsg (self ):
147154 """Find the suitable UTM epsg code based on lons and lats
@@ -323,6 +330,8 @@ def apply_ortho(self):
323330 da_ortho .attrs = self .scene [self .varname ].attrs
324331
325332 ortho_description = f'orthorectified by the { self .ortho_source } method'
333+ if self .ortho_source == 'rpc' :
334+ ortho_description += f' using { self .dem_name } DEM data'
326335 if 'description' in da_ortho .attrs :
327336 da_ortho .attrs ['description' ] = f"{ da_ortho .attrs ['description' ]} ({ ortho_description } )"
328337
0 commit comments