HatanakaCompressFilter Filename

Hello,

I’ve encountered an issue with the HatanakaCompressFilter on Orekit 12.1. When using a file path like “./path/to/file.crx”, it doesn’t work as expected. This filter requires the DataSource name to contain only the filename in the RINEX 2 or 3 format as indicated by the documentation.

To solve this, I added the expression “^(.*[\\\/])?” before the pattern of the RINEX files as shown here.

/** Pattern for rinex 2 observation files. /
private static final Pattern RINEX_2_PATTERN = Pattern.compile("^(.
[\\\/])?(\w{4}\d{3}0a-x?\.\d{2})[dD]$");

/** Pattern for rinex 3 observation files. */
private static final Pattern RINEX_3_PATTERN = Pattern.compile("^(.*[\\\\\\/])?(\\w{9}_\\w{1}_\\d{11}_\\d{2}\\w_\\d{2}\\w{1}_\\w{2})\\.crx$");

This allows for an optional file path to be included, ensuring the filter can recognize and process the file regardless of whether a path is provided.

Is there a better solution available, or should I continue using my approach? Or maybe is it corrected in the newer versions ?

Hi @MathiasHuyghe, welcome!

The getName() part of a data source is only expected to contain the name of the data itself.
Could you set your DataSource in such a way the name is only file.crx and the path part is used only in the lazy opener ?

Looking further, maybe we could handle this in the DataSource constructors themselves, so you still could rely on simple uses like new DataSource(myFile) and we would decompose the path part from the file name part at DataSource construction. This would be more general and would apply to everything that uses a DataSource, not only Hatanaka filter.

Would you mind opening an issue on the forge for that?

I’ve opened an issue.
Thank you !