JamesPImes/pyTRS

Incorrect parsing of 'cross-halves' that should be described as quarters.

JamesPImes opened this issue · 0 comments

Descriptions such as 'N/2E/2SW/4' are not being handled correctly. Specifically, the N/2 of the E/2 is more simply described as the NE/4, which is how it almost always appears in real-world data. However, the 'N/2 of the E/2' is technically an accurate description of the same tract, and it does appear from time to time.

QQ parsing currently returns this as ['N2NESW', 'N2SESW'] (at qq_depth_min=2), but it should actually return ['NESW'].

This is only a problem when the 'axis' of the halves is different -- i.e. the 'W/2E/2SW/4' is parsed correctly, because the E/2 and W/2 are both divided on the same axis; whereas the N/2 is divided on a different axis than the E/2.

Possible (untested) solution in unpack_aliquots() is:
-- after breaking down the aliquot_text_block into component_list, and before running subdivide_aliquot() on each component...
-- look for any 2 consecutive halves in the component_list (checking largest-to-smallest subdivision -- i.e. left-to-right in the list), and if and only if they are NOT on the same axis, replace the pair of them with the appropriate quarter.
-- Continue the rest of the function.

So, for example, after the 'W/2N/2E/2SW/4' has been broken down into ['SW', 'E', 'N', 'W'], we would replace 'E' and 'N' with 'NE': ['SW', 'NE', 'W'].