Customizable RTC with Sentinel-1
Ahleroy opened this issue · 2 comments
Ahleroy commented
Following the Customisable RTC tutorial with Sentinel-1, I am facing this issue when it comes to using sarsen
v0.9.3:
TypeError Traceback (most recent call last)
Cell 18 line 1
----> gtc = apps.terrain_correction(
product_urlpath=grd_local_path,
measurement_group=measurement_group,
dem_urlpath=dem_path,
output_urlpath=os.path.join(
tmp_dir, os.path.basename(product_folder) + ".10m.GTC.tif"
),
)
TypeError: terrain_correction() got an unexpected keyword argument 'product_urlpath'
This happens when running In 13
of the tutorial which corresponds to the following piece of code:
gtc = apps.terrain_correction(
product_urlpath=grd_local_path,
measurement_group=measurement_group,
dem_urlpath=dem_path,
output_urlpath=os.path.join(
tmp_dir, os.path.basename(product_folder) + ".10m.GTC.tif"
),
)
Looking at the sarsen API, it seems it has changed since the tutorial was made. However, I do not see any equivalent to how to use the new API.
Ahleroy commented
Digging into sensar
's repository, I was able to found a workaround :
import json
def gtc(
product_urlpath: str,
measurement_group: str,
dem_urlpath: str,
output_urlpath: str = "GTC.tif",
enable_dask_distributed: bool = False,
client_kwargs_json: str = '{"processes": false}',
chunks: int = 1024,
) -> None:
"""Generate a geometrically terrain corrected (GTC) image from Sentinel-1 product."""
client_kwargs = json.loads(client_kwargs_json)
real_chunks = chunks if chunks > 0 else None
product = sarsen.sentinel1.Sentinel1SarProduct(
product_urlpath,
measurement_group,
)
return apps.terrain_correction(
product,
dem_urlpath,
output_urlpath=output_urlpath,
enable_dask_distributed=enable_dask_distributed,
client_kwargs=client_kwargs,
chunks=real_chunks,
)
gtc = gtc(
grd_local_path,
measurement_group=measurement_group,
dem_urlpath=dem_path,
output_urlpath=os.path.join(
tmp_dir, os.path.basename(product_folder) + ".10m.GTC.tif"
),
)
TomAugspurger commented
Thanks for the report. cc @alexamici, is that the recommended way to handle the product_urlpath change?