def test_rescale_polygon(): """Take a polygons set and rescale/resample""" pol = Polygons(POLSET4) oldpol = pol.copy() oldpol.name = "ORIG" pol.rescale(100) pol.hlen() pol2 = Polygons(POLSET4) pol2.rescale(100, kind="slinear") pol2.name = "slinear" pol2.hlen() arr1 = pol.dataframe[pol.dhname].values arr2 = pol2.dataframe[pol2.dhname].values logger.info( "avg, min, max: POL simple %s %s %s vs slinear %s %s %s", arr1.mean(), arr1.min(), arr1.max(), arr2.mean(), arr2.min(), arr2.max(), ) if XTGSHOW: pol.quickplot(others=[oldpol, pol2])
def test_rescale_polygon(testpath): """Take a polygons set and rescale/resample""" pol = Polygons(testpath / POLSET4) oldpol = pol.copy() oldpol.name = "ORIG" oldpol.hlen() pol.rescale(100) pol.hlen() pol2 = Polygons(testpath / POLSET4) pol2.rescale(100, kind="slinear") pol2.name = "slinear" pol2.hlen() assert oldpol.dataframe.H_CUMLEN.max() == pytest.approx(5335, rel=0.02) assert pol.dataframe.H_CUMLEN.max() == pytest.approx(5335, rel=0.02) assert pol2.dataframe.H_CUMLEN.max() == pytest.approx(5335, rel=0.02)