Open SantaTitular opened 5 months ago
Hi @SantaTitular I agree the documentation of the parameter shapefile
is not very clear and the name itself is misleading. shapefile
is a file format and the function accepts more than that. The parameter geometry
of function snap.auxil.sub_parametrize (which is called by geocode
) gives a better description. Furthermore, I see that the link to osgeo.osr.SpatialReference
is broken, I guess this is the one you mean. I will update the documentation of the shapefile
parameter accordingly.
Here's what you can do (using function spatialist.vector.wkt2vector):
from spatialist.vector import wkt2vector
for i in input_S1_files:
print(i)
with wkt2vector(wkt=wkt, srs=proj) as vec:
geocode(i,
outdir=outpath, test=True, t_srs=proj,
polarizations=['VV','VH'],
speckleFilter='Lee',
removeS1ThermalNoise=True,
allow_RES_OSV=True,
shapefile=vec)
Works for you?
Hi @johntruckenbrodt
Thanks so much for the response! Yes, it was the link for osgeo.osr.SpatialReference
that was broken.
You're right, after looking through the documentation of the sub_parametrize
function, it became quite clear (great tip on the use of the wkt2vector
function!). Now when I run the code I get an error from the intersection of scene and shapefile (image below). Maybe its an error from the very specific polygon I used or a difference in the Spatial reference (This is the image I tested in SNAP: S1A_IW_GRDH_1SDV_20221004T164201_20221004T164226_045295_056A44_9032).
Thanks again!
Quick edit: It does work without the subset (atleast its running and created the .xml file previously), so it is just this subset part.
Your AOI is located in the central Pacific near Samoa, the scene covers Bosnia Herzegovina. Looks like you need to adjust your WKT string. the coordinate convention is always X-Y(-Z) whereas you seem to have Y-X.
- POLYGON((19.295571567283318 43.75986021410339,
+ POLYGON((43.75986021410339 19.295571567283318,
Thanks again for the help. Although I'm confused since I took the polygon's WKT from SNAP. Still, if I look up this polygon POLYGON ((19.279547 43.774936, 19.279547 43.794084, 19.304609 43.794084, 19.304609 43.774936, 19.279547 43.774936))
on a WKT visualization I get the coordinates I wanted.
I did try changing the X-Y on the code but ended with the same error!
Ah sorry. Swapping the coordinates would obviously get you to the Arabian peninsula and not to Samoa. There must be a different reason. Until I get this fixed I suggest you find a different way to create some vector file from your WKT string and use this file for processing.
Hi again John,
I tried processing without the subset however, I ended with an error file with the following line on it: 'utf-8' codec can't decode byte 0xe3 in position 2027: invalid continuation byte
. Maybe it is something I inputted wrong, but I just want to do a standard preprocessing with the set of images.
Edit: File name: S1A__IW___A_20221004T164201_Cal_NR_Orb_ML_TF_Spk_TC_dB_error
Okay I figured out the issue with the geometry. Your WKT string coordinates do not match the coordinate system of proj
.
With this is works:
proj = 'EPSG:4326'
There is still a shift of the geometry relative to the river though:
Your last message looks a lot like this: https://github.com/johntruckenbrodt/pyroSAR/issues/265
Do you perhaps have any special characters in the file names written to your workflow?
Hi John,
Thanks again for the help! Thats weird, If I remember correctly, I took proj's WKT from SNAP (Raster->Geometric->Reprojecting) but maybe before doing any shift in the image or drawing the polygon. I'll just use the projection from WKT online viz for future cases then.
Regarding the error message, contrary to #265 this error would appear at the end, at the write module. I imported the graph to SNAP as you suggested in #265 (although he did have '(' special characters in the path name) and changed directory and the output format:
BEAM-DIMAP
GeoTIFF
ENVI
However, if I incorporate the subset in the workflow (using the original, possible wrong path) I do get an output (albeit still not the one I wanted 😅)! So I guess it is more related to size of the image than anything else.
Mh strange. I think you're right, this looks a lot like you don't have enough space.
I am not sure I can follow, how is the output not what you wanted?
Yeah, I guess 500GBs not enough to process a full image. Still, I can process with the subset so I'm ok with it. Since I used lineartodB the output image was pretty much black, whereas I just wanted the linear form like this:
I don't have much experience with this type of data but I think it look ok no? I'm still exploring more of the package and different processing steps and it is really helpfull to check the intermediate steps in SNAP. Thanks for the help again!
500 GB should be plenty to process the images so the error could be coming from something else.
I think you are interchanging linear and logarithmic (dB) scale. In log scale the image should be much better to view than in linear scale. Your image looks alright but without any scale it is hard to tell what you show.
Hi,
I'm just starting to use pyroSAR after searching for a simpler way to process Sentinel S1 images in python. I started by just doing some standard processing but I'm not sure how to include the geometry (wkt) and the projection (proj) as if using snappy. I tried looking through the function itself but the
t_srs
link is broken unfortunately. The code below naturally outputs an error:OSError: file does not exist
in thesub = sub_parametrize(scene=id, geometry=shapefile, offset=offset, buffer=0.01)
,shp = Vector(geometry)
.Thanks in advance! Tomás