Skip to content

Commit 912127e

Browse files
chahankChahan Kropfpeanutfun
authored
Improve lines disaggregation method (#679)
* Improve lines disaggregation method * Remove 'math' import from climada/util/lines_polys_handler.py Co-authored-by: Chahan M. Kropf <[email protected]> * Add test for _line_fractions * Update climada/util/lines_polys_handler.py Co-authored-by: Lukas Riedel <[email protected]> * Update climada/util/lines_polys_handler.py Co-authored-by: Lukas Riedel <[email protected]> * Add changelog note * Add warning if the resolution is much larger than the line lengths * Improve logging msg * Update warning comment * Add test for different base length * Add test for average length convergence * Make more precise length approximation test * Add test for line resolution warning * Update point on line to equal segments length * Update basic test for equal length segments * Updated "integrated" impact tests to equal line segments * Improve code cosmetics * Improve test cosmetics * Remove legacy code * Add link to PR on changelog * Add test for exact warning message --------- Co-authored-by: Chahan Kropf <[email protected]> Co-authored-by: Lukas Riedel <[email protected]>
1 parent 1e2c99d commit 912127e

File tree

3 files changed

+149
-105
lines changed

3 files changed

+149
-105
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Removed:
2626
- Refactored `Exposure.assign_centroids` using a new util function `u_coord.match_centroids` [#602](https://github.com/CLIMADA-project/climada_python/pull/602)
2727
- Renamed `climada.util.coordinate.assign_grid_points` to `match_grid_points` and `climada.util.coordinates.assign_coordinates` to `match_coordinates`
2828
[#602](https://github.com/CLIMADA-project/climada_python/pull/602)
29+
- Modified the method to disaggregate lines in the lines_polygons_handler utility module in order to better conserve the total length of all lines on average [#679](https://github.com/CLIMADA-project/climada_python/pull/679).
2930

3031
### Fixed
3132

climada/util/lines_polys_handler.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,19 @@ def _line_to_pnts(gdf_lines, res, to_meters):
930930
else:
931931
line_lengths = gdf_lines.length
932932

933+
# Add warning if lines are too short w.r.t. resolution
934+
failing_res_check_count = len(line_lengths[line_lengths > 10*res])
935+
if failing_res_check_count > 0:
936+
LOGGER.warning(
937+
"%d lines with a length < 10*resolution were found. "
938+
"Each of these lines is disaggregate to one point. "
939+
"Reaggregatint values will thus likely lead to overestimattion. "
940+
"Consider chosing a smaller resolution or filter out the short lines. ",
941+
failing_res_check_count
942+
)
943+
933944
line_fractions = [
934-
np.linspace(0, 1, num=_pnts_per_line(length, res))
945+
_line_fraction(length, res)
935946
for length in line_lengths
936947
]
937948

@@ -951,6 +962,29 @@ def _line_to_pnts(gdf_lines, res, to_meters):
951962
return gdf_points
952963

953964

965+
def _line_fraction(length, res):
966+
"""
967+
Compute the fraction in which to divide a line of given length at given resolution
968+
969+
Parameters
970+
----------
971+
length : float
972+
Length of a string
973+
res : float
974+
Resolution (length of a string element)
975+
976+
Returns
977+
-------
978+
np.ndarray
979+
Array of the fraction at which to divide the string of given length
980+
into points at the chosen resolution.
981+
982+
"""
983+
nb_points = _pnts_per_line(length, res)
984+
eff_res = 1 / nb_points
985+
start = eff_res / 2
986+
return np.arange(start, 1, eff_res)
987+
954988
def _pnts_per_line(length, res):
955989
"""Calculate number of points fitting along a line, given a certain
956990
resolution (spacing) res between points.
@@ -965,7 +999,7 @@ def _pnts_per_line(length, res):
965999
int
9661000
Number of points along line
9671001
"""
968-
return int(np.ceil(length / res) + 1)
1002+
return int(max(np.round(length / res), 1))
9691003

9701004

9711005
def _swap_geom_cols(gdf, geom_to, new_geom):

climada/util/test/test_lines_polys_handler.py

Lines changed: 112 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
from unittest.mock import patch, DEFAULT
2424

2525
import numpy as np
26+
import geopandas as gpd
2627

2728
from shapely.geometry import Point
29+
from shapely.geometry import LineString
2830

2931
from climada.entity import Exposures
3032
import climada.util.lines_polys_handler as u_lp
@@ -240,22 +242,20 @@ def test_point_exposure_from_polygons_on_grid(self):
240242

241243
def test_point_exposure_from_lines(self):
242244
"""Test disaggregation of lines to points"""
243-
#test start and end point per line
245+
#to_meters=False, FIX
244246
exp_pnt = u_lp.exp_geom_to_pnt(
245247
EXP_LINE, res=1, to_meters=False,
246248
disagg_met=u_lp.DisaggMethod.FIX, disagg_val=None
247249
)
248250
np.testing.assert_array_equal(exp_pnt.gdf.value[:,0], EXP_LINE.gdf.value)
249-
np.testing.assert_array_equal(exp_pnt.gdf.value[:,0], exp_pnt.gdf.value[:,1])
250251
self.check_unchanged_exp(EXP_LINE, exp_pnt)
251252

252253
#to_meters=False, DIV
253254
exp_pnt = u_lp.exp_geom_to_pnt(
254255
EXP_LINE, res=1, to_meters=False,
255256
disagg_met=u_lp.DisaggMethod.DIV, disagg_val=None
256257
)
257-
np.testing.assert_array_equal(exp_pnt.gdf.value[:,0], EXP_LINE.gdf.value/2)
258-
np.testing.assert_array_equal(exp_pnt.gdf.value[:,0], exp_pnt.gdf.value[:,1])
258+
np.testing.assert_array_equal(exp_pnt.gdf.value[:,0], EXP_LINE.gdf.value)
259259
self.check_unchanged_exp(EXP_LINE, exp_pnt)
260260

261261
#to_meters=TRUE, FIX, dissag_val
@@ -268,18 +268,12 @@ def test_point_exposure_from_lines(self):
268268
val = res**2
269269
self.assertEqual(np.unique(exp_pnt.gdf.value)[0], val)
270270
lat = np.array([
271-
50.8794 , 50.8003 , 50.955 , 50.9198 , 51.921 ,
272-
51.83477563, 51.77826097, 51.6732 , 52.078 , 52.0788 ,
273-
50.8963 , 50.8967 , 51.9259 , 51.925 , 51.5457 ,
274-
51.5285 , 52.2614 , 52.3091 , 53.1551 , 53.1635 ,
275-
51.6814 , 51.61111058, 51.5457 , 52.0518 , 52.052 ,
276-
52.3893 , 52.3893 , 52.1543 , 52.1413 , 52.4735 ,
277-
52.4784 , 52.6997 , 52.6448 , 52.1139 , 52.1132 ,
278-
51.9222 , 51.8701 , 52.4943 , 52.4929 , 51.8402 ,
279-
51.8434 , 51.9255 , 51.9403 , 51.2019 , 51.10694216,
280-
50.9911 , 52.4919 , 52.4797 , 50.8557 , 50.8627 ,
281-
51.0757 , 51.0821 , 50.8207 , 50.8223 , 50.817 ,
282-
50.8093 , 51.0723 , 51.0724 , 50.9075 , 50.9141
271+
50.83944191, 50.94706532, 51.85008694, 51.7524172 , 52.07732906,
272+
50.889641 , 51.90287148, 51.53858598, 52.30223675, 53.15931081,
273+
51.61111058, 52.05191342, 52.3893 , 52.14520761, 52.47715845,
274+
52.68641293, 52.11355 , 51.90503849, 52.49610201, 51.8418 ,
275+
51.93188219, 51.10694216, 52.48596301, 50.87543042, 51.0801347 ,
276+
50.82145186, 50.81341953, 51.07235498, 50.9105503
283277
])
284278
np.testing.assert_allclose(exp_pnt.gdf.latitude, lat)
285279

@@ -396,15 +390,15 @@ def test_calc_geom_impact_lines(self):
396390
res=0.05, to_meters=False, disagg_met=u_lp.DisaggMethod.DIV,
397391
disagg_val=None, agg_met=u_lp.AggMethod.SUM
398392
)
399-
aai_agg1 = 2.18359
393+
aai_agg1 = 2.114365936716238
400394
eai_exp1 = np.array([
401-
8.50634478e-02, 4.24820916e-02, 1.04429093e-01, 1.27160538e-02,
402-
8.60539827e-02, 1.75262423e-01, 2.32808488e-02, 2.92552267e-02,
403-
4.26205598e-03, 2.31991466e-01, 5.29133033e-03, 2.72705887e-03,
404-
8.87954091e-03, 2.95633263e-02, 5.61356696e-01, 1.33011693e-03,
405-
9.95247490e-02, 7.72573773e-02, 6.12233710e-03, 1.61239410e-02,
406-
1.14566573e-01, 7.45522678e-02, 2.95181528e-01, 4.64021003e-02,
407-
1.45806743e-02, 2.49435540e-02, 2.96121155e-05, 1.03654148e-02
395+
8.58546479e-02, 4.57753040e-02, 1.07081794e-01, 1.27160538e-02,
396+
8.60984331e-02, 1.57751547e-01, 2.32808488e-02, 2.95520878e-02,
397+
4.06902083e-03, 2.27553509e-01, 5.29133033e-03, 2.72705887e-03,
398+
8.48207692e-03, 2.95633263e-02, 4.88225543e-01, 1.33011693e-03,
399+
1.03018186e-01, 7.72573773e-02, 5.48322256e-03, 1.61239410e-02,
400+
1.13181160e-01, 8.32840521e-02, 2.99243546e-01, 4.88901364e-02,
401+
1.71930351e-02, 2.49435540e-02, 2.96121155e-05, 1.03654148e-02
408402
])
409403
check_impact(self, imp1, HAZ, EXP_LINE, aai_agg1, eai_exp1)
410404

@@ -414,21 +408,21 @@ def test_calc_geom_impact_lines(self):
414408
res=300, to_meters=True, disagg_met=u_lp.DisaggMethod.DIV,
415409
disagg_val=None, agg_met=u_lp.AggMethod.SUM
416410
)
417-
np.testing.assert_allclose(imp2.eai_exp, imp1.eai_exp, rtol=0.1)
411+
np.testing.assert_allclose(imp2.eai_exp, imp1.eai_exp, rtol=0.2)
418412

419413
imp3 = u_lp.calc_geom_impact(
420414
exp_line_novals, IMPF_SET, HAZ,
421415
res=300, to_meters=True, disagg_met=u_lp.DisaggMethod.FIX,
422416
disagg_val=5000, agg_met=u_lp.AggMethod.SUM
423417
)
424-
aai_agg3 = 2.830144
418+
aai_agg3 = 2.626753478142696
425419
eai_exp3 = np.array([
426-
0.10973467, 0.05930568, 0.1291031 , 0.02170876, 0.11591773,
427-
0.20360855, 0.03329673, 0.03672271, 0.00779005, 0.28260995,
428-
0.01006294, 0.00989869, 0.01279569, 0.04986454, 0.62946471,
429-
0.00431759, 0.12464957, 0.12455043, 0.01734576, 0.02508649,
430-
0.15109773, 0.12019767, 0.36631115, 0.06004143, 0.05308581,
431-
0.04738706, 0.00483797, 0.01935157
420+
0.10307851, 0.05544964, 0.12810739, 0.01736701, 0.1092617 ,
421+
0.19785227, 0.02959709, 0.03617366, 0.00464554, 0.27378204,
422+
0.00670862, 0.00329956, 0.01030654, 0.03324303, 0.61571791,
423+
0.00215879, 0.12245651, 0.10379203, 0.00536503, 0.01881487,
424+
0.14592603, 0.12312706, 0.35965216, 0.05581585, 0.01968975,
425+
0.02843223, 0.00241899, 0.01451368
432426
])
433427
check_impact(self, imp3, HAZ, exp_line_novals, aai_agg3, eai_exp3)
434428

@@ -476,39 +470,39 @@ def test_calc_geom_impact_mixed(self):
476470
res=0.05, to_meters=False, disagg_met=u_lp.DisaggMethod.DIV,
477471
disagg_val=None, agg_met=u_lp.AggMethod.SUM
478472
)
479-
aai_agg1 = 2354303.388829326
480-
eai_exp1 = np.array(
481-
[5.44242706e-04, 7.83583295e-03, 1.83750670e-01, 1.73511269e-02,
482-
1.94180761e-02, 3.90576163e-02, 1.10985612e-02, 1.86135108e-01,
483-
6.14306427e-02, 6.16206874e-02, 8.56458490e-03, 8.81751253e-03,
484-
4.26205598e-03, 8.12498654e-02, 1.57396460e-01, 6.00203189e-03,
485-
3.19600253e-01, 1.46198876e-01, 1.29361932e-01, 1.33011693e-03,
486-
1.38153438e-01, 4.20094145e-02, 9.14516636e-02, 3.61084945e-02,
487-
4.75139931e-02, 7.99620467e-02, 9.23306174e-02, 1.04525623e-01,
488-
1.61059946e+04, 1.07420484e+04, 1.44746070e+04, 7.18796281e+04,
489-
2.58806206e+04, 2.01316315e+05, 1.76071458e+05, 3.92482129e+05,
490-
2.90364327e+05, 9.05399356e+05, 1.94728210e+05, 5.11729689e+04,
491-
2.84224294e+02, 2.45938137e+02, 1.90644327e+02, 1.73925079e+02,
492-
1.76091839e+02, 4.43054173e+02, 4.41378151e+02, 4.74316805e+02,
493-
4.83873464e+02, 2.59001795e+02, 2.48200400e+02, 2.62995792e+02
494-
])
473+
aai_agg1 = 2354303.3196003754
474+
eai_exp1 = np.array([
475+
1.73069928e-04, 8.80741357e-04, 1.77657635e-01, 1.06413744e-02,
476+
1.15405492e-02, 3.40097761e-02, 8.91658032e-03, 4.19735141e-02,
477+
1.27160538e-02, 2.43849980e-01, 2.32808488e-02, 5.47043065e-03,
478+
5.44984095e-03, 5.80779958e-03, 1.06361040e-01, 4.67335812e-02,
479+
9.93703142e-02, 8.48207692e-03, 2.95633263e-02, 1.30223646e-01,
480+
3.84600393e-01, 2.05709279e-02, 1.39919480e-01, 1.61239410e-02,
481+
4.46991386e-02, 1.30045513e-02, 1.30045513e-02, 6.91177788e-04,
482+
1.61063727e+04, 1.07420484e+04, 1.44746070e+04, 7.18796281e+04,
483+
2.58806206e+04, 2.01316315e+05, 1.76071458e+05, 3.92482129e+05,
484+
2.90364327e+05, 9.05399356e+05, 1.94728210e+05, 5.11729689e+04,
485+
2.84224294e+02, 2.45938137e+02, 1.90644327e+02, 1.73925079e+02,
486+
1.76091839e+02, 4.43054173e+02, 4.41378151e+02, 4.74316805e+02,
487+
4.83873464e+02, 2.59001795e+02, 2.48200400e+02, 2.62995792e+02
488+
])
495489
check_impact(self, imp1, HAZ, exp_mix, aai_agg1, eai_exp1)
496490

497491
imp2 = u_lp.calc_geom_impact(
498492
exp_mix, IMPF_SET, HAZ,
499493
res=5000, to_meters=True, disagg_met=u_lp.DisaggMethod.FIX,
500494
disagg_val=None, agg_met=u_lp.AggMethod.SUM
501495
)
502-
aai_agg2 = 321653482.41806
496+
aai_agg2 = 321653479.4607434
503497
eai_exp2 = np.array([
504-
5.44242706e-04, 4.83197677e-03, 4.12448052e-01, 1.34215052e-01,
505-
2.55089453e-01, 3.82348309e-01, 2.24599809e-01, 2.57801309e-01,
506-
3.67620642e-01, 5.24002585e-01, 5.62882027e-02, 6.17225877e-02,
507-
8.52411196e-03, 4.87499192e-01, 9.09740934e-01, 8.01838920e-03,
508-
7.96127932e-02, 1.34945299e+00, 9.06839997e-01, 4.01295245e-01,
509-
5.93452277e-01, 8.40188290e-02, 4.67806576e-01, 8.21743744e-02,
510-
2.48612395e-01, 1.24387821e-01, 3.48131313e-01, 5.53983704e-01,
511-
1.48411250e+06, 1.09137411e+06, 1.62477251e+06, 1.43455724e+07,
498+
1.73069928e-04, 8.80741357e-04, 2.17736979e-01, 6.48243461e-02,
499+
2.67262620e-02, 3.55078893e-01, 8.14081011e-02, 4.36578022e-01,
500+
1.02605091e-01, 3.45121722e-01, 1.62144669e-01, 1.45008544e-01,
501+
2.32808488e-02, 2.73521532e-02, 9.51399554e-02, 2.25921717e-01,
502+
6.90427531e-01, 5.29133033e-03, 2.72705887e-03, 8.48207692e-03,
503+
2.10403881e+00, 1.33011693e-03, 3.14644100e-01, 7.72573773e-02,
504+
5.48322256e-03, 1.61239410e-02, 2.68194832e-01, 7.80273077e-02,
505+
1.48411299e+06, 1.09137411e+06, 1.62477251e+06, 1.43455724e+07,
512506
2.94783633e+06, 1.06950486e+07, 3.17592949e+07, 4.58152749e+07,
513507
3.94173129e+07, 1.48016265e+08, 1.87811203e+07, 5.41509882e+06,
514508
1.24792652e+04, 1.20008305e+04, 1.43296472e+04, 3.15280802e+04,
@@ -528,18 +522,18 @@ def test_impact_pnt_agg(self):
528522
)
529523
imp_pnt = ImpactCalc(exp_pnt, IMPF_SET, HAZ).impact(save_mat=True)
530524
imp_agg = u_lp.impact_pnt_agg(imp_pnt, exp_pnt.gdf, u_lp.AggMethod.SUM)
531-
aai_agg = 1282901.377219451
525+
aai_agg = 1282901.0114188215
532526
eai_exp = np.array([
533-
1.73069928e-04, 8.80741357e-04, 4.32240819e-03, 8.62816073e-03,
534-
2.21441154e-02, 1.09329988e-02, 8.58546479e-02, 4.62370081e-02,
535-
8.99584440e-02, 1.27160538e-02, 8.60317575e-02, 2.02440009e-01,
536-
2.32808488e-02, 2.86159458e-02, 4.26205598e-03, 2.40051484e-01,
537-
5.29133033e-03, 2.72705887e-03, 8.87954091e-03, 2.95633263e-02,
538-
6.33106879e-01, 1.33011693e-03, 1.11120718e-01, 7.72573773e-02,
539-
6.12233710e-03, 1.61239410e-02, 1.01492204e-01, 7.45522678e-02,
540-
1.41155415e-01, 1.53820450e-01, 2.27951125e-02, 2.23629697e-02,
541-
8.59651753e-03, 5.98415680e-03, 1.24717770e-02, 1.24717770e-02,
542-
1.48060577e-05, 1.48060577e-05, 5.18270742e-03, 5.18270742e-03,
527+
0.00000000e+00, 1.73069928e-04, 3.71172778e-04, 5.09568579e-04,
528+
8.43340681e-04, 3.47906751e-03, 3.00385618e-03, 5.62430455e-03,
529+
9.07998787e-03, 1.30641275e-02, 6.18365411e-03, 4.74934473e-03,
530+
8.34810476e-02, 5.07280880e-02, 1.02690634e-01, 1.27160538e-02,
531+
8.60984331e-02, 1.62144669e-01, 2.32808488e-02, 2.90389979e-02,
532+
4.06902083e-03, 2.33667906e-01, 5.29133033e-03, 2.72705887e-03,
533+
8.48207692e-03, 2.95633263e-02, 4.01271600e-01, 1.33011693e-03,
534+
9.94596852e-02, 7.72573773e-02, 5.48322256e-03, 1.61239410e-02,
535+
4.14706673e-03, 8.32840521e-02, 2.87509619e-01, 4.88901364e-02,
536+
1.71930351e-02, 2.49435540e-02, 2.96121155e-05, 1.03654148e-02,
543537
8.36178802e+03, 7.30704698e+03, 1.20628926e+04, 3.54061498e+04,
544538
1.23524320e+04, 7.78074661e+04, 1.28292995e+05, 2.31231953e+05,
545539
1.31911226e+05, 5.37897306e+05, 8.37016948e+04, 1.65661030e+04
@@ -597,26 +591,26 @@ def test_gdf_line_to_pnt(self):
597591
np.testing.assert_allclose(
598592
gdf_pnt_d.geometry.x.values,
599593
np.array([
600-
6.0885 , 6.09416494, 6.09160809, 6.08743533, 6.08326257,
601-
6.0791987 , 6.07509502, 6.07016232, 6.0640264 , 6.06085342,
602-
6.06079
594+
6.092507, 6.092895, 6.088363, 6.083726, 6.079199, 6.074582,
595+
6.068896, 6.061939, 6.061839
603596
])
604597
)
605598
np.testing.assert_allclose(
606599
gdf_pnt_d.geometry.y.values,
607600
np.array([
608-
50.8794 , 50.87275494, 50.86410478, 50.85590192, 50.84769906,
609-
50.83944191, 50.83120479, 50.82346045, 50.81661416, 50.80861974,
610-
50.8003
601+
50.876242, 50.866888, 50.857725, 50.84861 , 50.839442, 50.830321,
602+
50.82186 , 50.814366, 50.80475
611603
])
612604
)
605+
606+
#disaggregation in degrees and approximately same value in meters
613607
gdf_pnt_m = u_lp._line_to_pnts(GDF_LINE.iloc[0:1], 1000, True)
614608
np.testing.assert_allclose(
615609
gdf_pnt_m.geometry.x,
616-
gdf_pnt_d.geometry.x)
610+
gdf_pnt_d.geometry.x, rtol=1e-2)
617611
np.testing.assert_allclose(
618612
gdf_pnt_m.geometry.y,
619-
gdf_pnt_d.geometry.y)
613+
gdf_pnt_d.geometry.y,rtol=1e-2)
620614

621615
def test_gdf_poly_to_pnts(self):
622616
"""Test polygon to points disaggregation"""
@@ -663,13 +657,50 @@ def test_gdf_poly_to_pnts(self):
663657
])
664658
)
665659

666-
667660
def test_pnts_per_line(self):
668661
"""Test number of points per line for give resolution"""
669-
self.assertEqual(u_lp._pnts_per_line(10, 1), 11)
670-
self.assertEqual(u_lp._pnts_per_line(1, 1), 2)
671-
self.assertEqual(u_lp._pnts_per_line(10, 1.5), 8)
672-
self.assertEqual(u_lp._pnts_per_line(10.5, 1), 12)
662+
self.assertEqual(u_lp._pnts_per_line(10, 1), 10)
663+
self.assertEqual(u_lp._pnts_per_line(1, 1), 1)
664+
self.assertEqual(u_lp._pnts_per_line(10, 1.5), 7)
665+
self.assertEqual(u_lp._pnts_per_line(10.5, 1), 10)
666+
667+
def test_line_fractions(self):
668+
"""Test the division of lines into fractions"""
669+
length = 1
670+
res_fractions = {
671+
2: np.array([0.5]),
672+
0.8: np.array([0.5]),
673+
0.6: np.array([0.25, 0.75]),
674+
0.4: np.array([0.25, 0.75])
675+
}
676+
for res, fraction in res_fractions.items():
677+
np.testing.assert_allclose(u_lp._line_fraction(length, res), fraction)
678+
679+
length = 2
680+
res_fractions = {
681+
2: np.array([0.5]),
682+
0.8: np.array([0.25, 0.75]),
683+
0.6: np.array([0.166667, 0.5, 0.833333]),
684+
0.4: np.array([0.1, 0.3, 0.5, 0.7, 0.9])
685+
}
686+
for res, fraction in res_fractions.items():
687+
np.testing.assert_allclose(u_lp._line_fraction(length, res), fraction, rtol=1e-04 )
688+
689+
def test_resolution_warning(self):
690+
lines = [
691+
LineString([[0, 0], [0, 2]]),
692+
LineString([[0, 0], [0, 12]]),
693+
LineString([[0, 0], [0, 20]])
694+
]
695+
gdf_lines = gpd.GeoDataFrame(geometry=lines)
696+
with self.assertLogs('climada.util.lines_polys_handler', level='WARNING') as ctx:
697+
u_lp._line_to_pnts(gdf_lines, 1, False)
698+
self.assertEqual(ctx.records[0].message,
699+
f"{2} lines with a length < 10*resolution were found. "
700+
"Each of these lines is disaggregate to one point. "
701+
"Reaggregatint values will thus likely lead to overestimattion. "
702+
"Consider chosing a smaller resolution or filter out the short lines. ")
703+
673704

674705
def test_gdf_to_grid(self):
675706
""""""
@@ -742,28 +773,6 @@ def test_swap_geom_cols(self):
742773
self.assertTrue(np.alltrue(swap_gdf.geometry.geom_equals(gdf_orig.new_geom)))
743774

744775

745-
# Not needed, metehods will be incorporated in to ImpactCalc in another
746-
# pull request
747-
# class TestImpactSetters(unittest.TestCase):
748-
# """ """
749-
750-
# def test_set_imp_mat(self):
751-
# """ test set_imp_mat"""
752-
# pass
753-
754-
# def test_eai_exp_from_mat(self):
755-
# """ test eai_exp_from_mat"""
756-
757-
# pass
758-
759-
# def test_at_event_from_mat(self):
760-
# """Test at_event_from_mat"""
761-
762-
# def test_aai_agg_from_at_event(self):
763-
# """Test aai_agg_from_at_event"""
764-
# pass
765-
766-
767776
if __name__ == "__main__":
768777
TESTS = unittest.TestLoader().loadTestsFromTestCase(TestExposureGeomToPnt)
769778
TESTS.addTests(unittest.TestLoader().loadTestsFromTestCase(TestGeomImpactCalcs))

0 commit comments

Comments
 (0)