33
44import logging
55from retrying import retry
6-
76from rasterio .crs import CRS
87
98from ost .helpers import helpers as h
@@ -189,14 +188,15 @@ def terrain_correction(infile, outfile, logfile, config_dict):
189188 cpus = config_dict ['snap_cpu_parallelism' ]
190189
191190 # auto projections of snap
192- # if 42001 <= dem_dict['out_projection'] <= 97002:
193- # projection = f"AUTO:{dem_dict['out_projection']}"
191+ if 42001 <= dem_dict ['out_projection' ] <= 97002 :
192+ projection = f"AUTO:{ dem_dict ['out_projection' ]} "
194193 # epsg codes
195- # else:
196- # projection = f"EPSG:{dem_dict['out_projection']}"
194+ elif int (dem_dict ['out_projection' ]) == 4326 :
195+ projection = CRS .from_epsg (4326 ).to_wkt ()
196+ else :
197+ projection = f"EPSG:{ dem_dict ['out_projection' ]} "
197198
198- projection = CRS .from_epsg (dem_dict ['out_projection' ]).to_wkt ()
199- #projection = 'GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]]'
199+ #
200200 logger .debug ('Geocoding product.' )
201201
202202 if ard ['geocoding' ] == 'terrain' :
@@ -211,7 +211,7 @@ def terrain_correction(infile, outfile, logfile, config_dict):
211211 f"-PimgResamplingMethod=\' { dem_dict ['image_resampling' ]} \' "
212212 f"-PpixelSpacingInMeter={ ard ['resolution' ]} "
213213 f"-PalignToStandardGrid=true "
214- # f"-PmapProjection=\'{projection}\' "
214+ f"-PmapProjection=\' { projection } \' "
215215 f"-t \' { str (outfile )} \' \' { str (infile )} \' "
216216 )
217217 elif ard ['geocoding' ] == 'ellipsoid' :
@@ -226,7 +226,7 @@ def terrain_correction(infile, outfile, logfile, config_dict):
226226 f"-PimgResamplingMethod=\' { dem_dict ['image_resampling' ]} \' "
227227 f"-PpixelSpacingInMeter={ ard ['resolution' ]} "
228228 f"-PalignToStandardGrid=true "
229- # f"-PmapProjection=\'{projection}\' "
229+ f"-PmapProjection=\' { projection } \' "
230230 f"-t \' { str (outfile )} \' \' { str (infile )} \' "
231231 )
232232 else :
@@ -276,6 +276,8 @@ def ls_mask(infile, outfile, logfile, config_dict):
276276 if 42001 <= dem_dict ['out_projection' ] <= 97002 :
277277 projection = f"AUTO:{ dem_dict ['out_projection' ]} "
278278 # epsg codes
279+ elif int (dem_dict ['out_projection' ]) == 4326 :
280+ projection = CRS .from_epsg (4326 ).to_wkt ()
279281 else :
280282 projection = f"EPSG:{ dem_dict ['out_projection' ]} "
281283
0 commit comments