== Legacy selection (1-degree buffer): 417 {'Oil Pipeline': 214, 'Gathering Pipeline': 172, 'Transmission Pipeline': 23, 'Distribution Pipeline': 8}
location               offshore  onshore_NE  other_state  All
CLASS                                                        
Distribution Pipeline         0           7            1    8
Gathering Pipeline           62          96           14  172
Oil Pipeline                 65         136           13  214
Transmission Pipeline         0          23            0   23
All                         127         262           28  417
Length (km) by location: {'offshore': 863.0, 'onshore_NE': 10179.0, 'other_state': 942.0}
Other-state segments by centroid lat (sample): {'count': 28.0, 'mean': -19.04, 'std': 0.31, 'min': -20.17, '25%': -19.28, '50%': -18.97, '75%': -18.78, 'max': -18.75}
 Rank      Lat      Lon UF_pip        Peak  dist_nearest_any_km                                                             nearest_any  dist_nearest_onshoreNE_km  dist_coast_km
    1  -1.5319 -45.9087     MA 1937.932646                781.3                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      817.2           24.2
    2  -3.7968 -39.5686     CE 1933.889850                 78.2                               CEGAS [Distribution Pipeline; onshore_NE]                       78.2           69.8
    3  -3.7411 -40.8219     CE 1917.250764                212.4                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      216.7           97.3
    4  -2.9148 -46.1800     MA 1911.938107                793.3                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      816.8          160.7
    5  -4.5554 -46.2435     MA 1911.545686                817.1                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      824.0          313.5
    6 -13.5196 -41.5471     BA 1909.578005                160.0                       ORSUB 8 - IPIAU-JEQUIE [Oil Pipeline; onshore_NE]                      160.0          277.1
    7 -13.2501 -42.0861     BA 1909.538335                224.2                       ORSUB 8 - IPIAU-JEQUIE [Oil Pipeline; onshore_NE]                      224.2          338.1
    8  -9.7468 -41.6818     BA 1909.031210                131.1                            Copergas [Distribution Pipeline; onshore_NE]                      131.1          493.2
    9  -6.0636 -36.5614     RN 1906.657452                 80.1                    Açu-Serra do Mel [Transmission Pipeline; onshore_NE]                       80.1          113.0
   10  -4.9407 -47.9541     MA 1905.648715                955.6                            Copergas [Distribution Pipeline; onshore_NE]                      955.6          459.5
   11  -4.4299 -47.1668     MA 1904.644560                915.3                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      915.2          362.0
   12  -7.6355 -36.2469     PB 1904.282068                 76.5                            Copergas [Distribution Pipeline; onshore_NE]                       76.5          154.7
   13  -9.0459 -36.3784     PE 1904.108067                 19.2                            Copergas [Distribution Pipeline; onshore_NE]                       19.2          100.4
   14  -7.6806 -44.1971     PI 1904.102918                445.2                            Copergas [Distribution Pipeline; onshore_NE]                      445.2          573.1
   15  -8.3094 -35.5284     PE 1903.593263                 12.4                            Copergas [Distribution Pipeline; onshore_NE]                       12.4           61.9
   16 -10.5552 -38.0437     BA 1903.430661                 88.9                    PE-4-4-SAT RO-248 / TREME [Oil Pipeline; onshore_NE]                       88.9          118.2
   17  -3.8528 -43.0947     MA 1903.208483                459.0                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      469.4          142.9
   18  -2.6152 -44.4749     MA 1903.123828                605.5                     OLEODUTO PXA-1/QBOIA XAREU [Oil Pipeline; offshore]                      634.2           20.8
   19  -8.7949 -38.7208     PE 1902.772878                204.6                            Copergas [Distribution Pipeline; onshore_NE]                      204.6          303.6
   20 -10.5763 -36.8124     SE 1902.682125                  4.9 PE-6-SANTO ANTÔNIO / ENTR. ROBALO-BONSUCESSO [Oil Pipeline; onshore_NE]                        4.9           12.4
   21  -9.2975 -35.8877     AL         NaN                 14.0                              GASALP [Transmission Pipeline; onshore_NE]                       14.0           40.8

Clusters (centroids) within 5/10/20 km of any pipeline: [(5, 1), (10, 1), (20, 4)]

Relabel check (cluster peak <= its state's max): corrected labels 19/20, original labels 11/20
Violations with corrected labels: [(12, 'PB', 1904.282067882241, np.float64(1901.3193592927355))]
              State UF_true  Mean_ppb  Max_ppb  Std_Dev_ppb
            Sergipe      RN   1886.75  1917.93         6.56
            Paraíba      PB   1886.10  1901.32         5.54
              Ceará      CE   1885.83  1933.89         6.86
           Maranhão      AL   1884.80  1903.53         7.93
         Pernambuco      PE   1883.68  1904.28         7.23
              Bahia      SE   1883.67  1903.48         7.12
Rio Grande do Norte      MA   1882.14  1937.93        12.26
            Alagoas      PI   1879.03  1917.41         5.85
              Piauí      BA   1875.86  1920.09         7.93
