Apologies in advance for the question not being directly SNAP or S1tbx related. I need to filter some filenames before parsing the files into SNAP.

I came across a little formula (https://scihub.copernicus.eu/news/News00014) to calculate the relative orbit number from a Sentinel-1 product names absolute orbit number:

Relative Orbit Number = mod (Absolute Orbit Number orbit - 73, 175) + 1

I find this works for Sentinel-1A but not Sentinel-1B. For example both with relative orbit number 30:

S1A_IW_GRDH_1SDV_20170909T175748_20170909T175813_018302_01EC88_98A1

mod (018302 - 73, 175) + 1 = 30

S1B_IW_GRDH_1SDV_20170903T175659_20170903T175724_007231_00CBEF_874B

mod (007231- 73, 175) + 1 = 159

I would rather do this calculation on the filename rather then read from metadata files if possible. Does anyone now if there is a formula that works for Sentinel-1B?

Many thanks in advance