rewrote occam1d to follow the modularit of occam2d and wsinv3d