I’m trying to implement an accuracy assessment section for my plugin. Right now when testing this in Python and loading the whole scene, there is no problem. I’ll just get the validation data from a shapefile using a variation of this code snippet here to convert lat-long to x,y indices of my supplied raster.
The problem arises when I try to do this in SNAP because the tiling would screw up the returned x,y indices. I should change source_product to the current tile in focus, but then getSceneGeoCoding() would not work for that object-type. Looking at the API docs for tile methods, I could attempt a crude way of readjusting the indices relative to the tile using getRectangle(). Is there a better way to do this?
Lastly, is it normal that a custom processor that otherwise works when invoked from the Menu bar can’t be selected in GraphBuilder? Is there a workaround for that?
Yes, currently this is normal. Some operators are not compatible with the GraphBuilder, because some of there GUI elements don’t work with the GraphBuilder. But we have it on the agenda to make them compatible.
I’m not sure what your problem is with the GeoCoding and the tiling.
I assume that you have only one product. How the data is tiled should not affect the GeoCoding and the positions. Maybe you can explain in more detail what the problem is.
Yes, only one source. I was under the impression that the result given by getPixelPos() would be oriented relative to the full raster. For example, if a given raster is 1000x1000, and a given lat-long corresponds to:
So at an index of (995, 995) in the original product’s raster. But if we use this index in a 100x100 tile (so we need 100 of these 100x100 tiles to complete the whole scene), the index (995, 995) becomes meaningless because 1) that would yield out of bounds for the size of the tile and 2) the point is only contained at the 100th tile, at index (95, 95).
But probably it will not yield the results you want.
From your postings I guess you are doing your own tiling and don’t use the tiling of the image. If so, you need to compute your own tile indices.
The implementation can be found here, if you need some advice.