Decode qualification not correctly evaluated by Sentinel-2 reader with relative path

Description

The method getDecodeQualification(FilePath) of the Sentinel-2 reader plugin returns UNABLE if the path to the file is relative.
Specifying relative paths worked in previous versions. The new behavior breaks operational processing systems.
The issue seems to be related to the new Virtual File System.

Environment

None

GitHub Work

None

Activity

Show:

Marco Peters 
21 June 2019 at 08:56

Not yet, it was more a theoretical thinking, because Adrian said that VFS can’t work with relative paths. An because all readers in s2tbx use the VFS, I was afraid that also the other readers are affected.

Oana Hogoiu 
21 June 2019 at 08:32

Marco, we will make sure that on a local file system all readers can work with relative paths. Except Sentinel-2, have you experienced this issue with other reader(s)?

Marco Peters 
20 June 2019 at 15:15

This means if we try the same with e.g. Spot6, we get the same error and can’t read it?
As long as one works on a local file system relative paths should work.
Python users who use the API, might work with relative paths, too.

Adrian Drăghici 
19 June 2019 at 14:26
(edited)

The VFS doesn't support relative paths. Therefore in the Sentinel-2 reader plugin no longer supports relative paths.
We will change the method getDecodeQualification to support relative path for local file system.

Martin Böttcher 
19 June 2019 at 14:13

Calvalus uses SNAP via the API. It tries to find an appropriate reader for some file in a local working directory where the process that uses the API has been started. The file is specified with relative path to the working directory. A test case to verify that the old behaviour is preserved in this case may be (it does not need the actual file, it only ensures that relative paths are handled the same way as absolute paths. Please fix by allowing relative paths, do not fix by simply throwing IllegalArgumentEx in case of relative paths!):

@Test
public void testRelativePaths() {

ProductIOPlugInManager manager = ProductIOPlugInManager.getInstance();
ProductReaderPlugIn readerPlugIn = manager.getReaderPlugIns("SENTINEL-2-MSI-MultiRes-UTM35N").next();
try {
assertEquals(DecodeQualification.INTENDED, readerPlugIn.getDecodeQualification(new File("./S2A_MSIL1C_20160717T085602_N0204_R007_T35TPK_20160717T090142.SAFE/MTD_MSIL1C.xml").getAbsoluteFile()));
} catch (IllegalArgumentException _) {}
try {
assertEquals(DecodeQualification.INTENDED, readerPlugIn.getDecodeQualification(new File("./S2A_MSIL1C_20160717T085602_N0204_R007_T35TPK_20160717T090142.SAFE/MTD_MSIL1C.xml")));
} catch (IllegalArgumentException _) {}
}

Thanks,
Martin

Done

Details

Assignee

Reporter

Fix versions

Affects versions

Components

Priority

Created 19 June 2019 at 12:25
Updated 10 February 2023 at 14:26
Resolved 10 February 2023 at 14:22