From 5fd28e06423dbb141de1b459c349092e5c0705ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 25 Jan 2024 20:14:07 +0000 Subject: [PATCH] Update coverage on Readme --- README.md | 2 +- python/idsse_common/test/coverage.txt | 877 ++++++++++++++++++++++++-- python/idsse_common/test/pytest.xml | 545 +++++++++++++++- 3 files changed, 1339 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index 71b2d471..7c80ee8c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Pytest](https://github.com/NOAA-GSL/idss-engine-commons/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/NOAA-GSL/idss-engine-commons/actions/workflows/run-tests.yml) [![Lint with pylint](https://github.com/NOAA-GSL/idss-engine-commons/actions/workflows/linter.yml/badge.svg)](https://github.com/NOAA-GSL/idss-engine-commons/actions/workflows/linter.yml) -Coverage
Coverage Report
FileStmtsMissCoverMissing
idsse/common
   __init__.py00100% 
   aws_utils.py8655 94%
   config.py6888 88%
   geo_image.py2191414 94%
   grid_proj.py11222 98%
   json_message.py2311 96%
   log_util.py4333 93%
   netcdf_io.py470100% 
   path_builder.py1281010 92%
   publish_confirm.py1511313 91%
   rabbitmq_utils.py610100% 
   utils.py1031414 86%
   validate_schema.py400100% 
   vectaster.py1933131 84%
TOTAL127410192% 
+Coverage
Coverage Report
FileStmtsMissCoverMissing
idsse/common
   __init__.py00100% 
   aws_utils.py8655 94%
   config.py6888 88%
   geo_image.py2191414 94%
   grid_proj.py9411 99%
   json_message.py2311 96%
   log_util.py4333 93%
   netcdf_io.py470100% 
   path_builder.py1281010 92%
   publish_confirm.py1511313 91%
   rabbitmq_utils.py610100% 
   scientific_utils.py90100% 
   utils.py1211010 92%
   validate_schema.py400100% 
   vectaster.py1803030 83%
TOTAL12709593% 
## Overview diff --git a/python/idsse_common/test/coverage.txt b/python/idsse_common/test/coverage.txt index 00234f1d..eff52f1d 100644 --- a/python/idsse_common/test/coverage.txt +++ b/python/idsse_common/test/coverage.txt @@ -2,57 +2,486 @@ platform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.4.0 rootdir: /home/runner/work/idss-engine-commons/idss-engine-commons/python/idsse_common plugins: cov-4.1.0 -collected 212 items +collected 214 items test/test_aws_utils.py .................. [ 8%] test/test_config.py ............ [ 14%] -test/test_geo_image.py ........F............ [ 24%] -test/test_grid_proj.py ........................ [ 35%] -test/test_json_message.py ........... [ 40%] +test/test_geo_image.py ..................... [ 23%] +test/test_grid_proj.py FF......FFFFFFFFFF.FFF. [ 34%] +test/test_json_message.py ........... [ 39%] test/test_log_util.py ..... [ 42%] -test/test_netcdf_io.py .... [ 44%] -test/test_path_builder.py ...................... [ 55%] -test/test_publish_confirm.py ......... [ 59%] -test/test_rabbitmq_utils.py ...... [ 62%] -test/test_utils.py ........................ [ 73%] +test/test_netcdf_io.py FF.. [ 43%] +test/test_path_builder.py ...................... [ 54%] +test/test_publish_confirm.py ......... [ 58%] +test/test_rabbitmq_utils.py ...... [ 61%] +test/test_utils.py ........................... [ 73%] test/test_validate_criteria_schema.py ...... [ 76%] test/test_validate_das_schema.py .............. [ 83%] test/test_validate_das_web_schema.py ......... [ 87%] test/test_validate_event_port_schema.py ..... [ 89%] test/test_validate_new_data_schema.py ......... [ 93%] -test/test_vectaster.py ............. [100%] +test/test_vectaster.py FFF.FF.FFFF.. [100%] =================================== FAILURES =================================== -____________________________ test_draw_geo_polygon _____________________________ +___________________________ test_from_proj_grid_spec ___________________________ -proj = +grid_proj = - def test_draw_geo_polygon(proj): - scale = 10 - width, height = 5, 5 - data = numpy.zeros((height, width)) - geo_image = GeoImage.from_data_grid(proj, data, scale=scale) + def test_from_proj_grid_spec(grid_proj: GridProj): + assert isinstance(grid_proj, GridProj) - lon_lat_1 = proj.map_pixel_to_geo(1.3, 1.9) - lon_lat_2 = proj.map_pixel_to_geo(3.5, 2.7) - lon_lat_3 = proj.map_pixel_to_geo(3.0, 1.5) - poly_wkt = (f'POLYGON(({lon_lat_1[0]} {lon_lat_1[1]}, {lon_lat_2[0]} {lon_lat_2[1]}, ' - f'{lon_lat_3[0]} {lon_lat_3[1]}, {lon_lat_1[0]} {lon_lat_1[1]}))') +> assert (grid_proj._x_offset, grid_proj._y_offset) == approx_tuple(EXAMPLE_CRS[0]) +E assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) +E At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 +E Full diff: +E - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) +E + (-3271151.6058371724, -263793.7334645616) + +test/test_grid_proj.py:70: AssertionError +_____________________ test_from_proj_grid_spec_with_offset _____________________ + + def test_from_proj_grid_spec_with_offset(): + proj_with_offset = GridProj.from_proj_grid_spec(PROJ_SPEC_WITH_OFFSET, + GRID_SPEC_WITHOUT_LOWER_LEFT) + + proj_xy = proj_with_offset.map_pixel_to_geo(*EXAMPLE_PIXELS[0]) +> assert proj_xy == approx_tuple(EXAMPLE_LON_LAT[0]) +E assert (-126.3265786...7681535953287) == (-126.2766 ± ...229 ± 1.9e-05) +E At index 0 diff: -126.3265786600057 != -126.2766 ± 1.3e-04 +E Full diff: +E - (-126.2766 ± 1.3e-04, 19.229 ± 1.9e-05) +E + (-126.3265786600057, 19.247681535953287) + +test/test_grid_proj.py:86: AssertionError +_________________________ test_map_crs_to_pixel_round __________________________ + +grid_proj = + + def test_map_crs_to_pixel_round(grid_proj: GridProj): + for index, crs_xy in enumerate(EXAMPLE_CRS): + pixel_xy = grid_proj.map_crs_to_pixel( + *crs_xy, + rounding=RoundingMethod.ROUND + ) +> assert pixel_xy == EXAMPLE_PIXELS[index] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:128: AssertionError +_________________________ test_map_crs_to_pixel_floor __________________________ + +grid_proj = + + def test_map_crs_to_pixel_floor(grid_proj: GridProj): + for index, crs_xy in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel( + *crs_xy, + rounding=RoundingMethod.FLOOR + ) + # due to math imprecision internal to pyproj.transform(), some test results are a bit + # unpredictable. E.g. returns 0.999994, which floors to 0, when expected pixel value is 1 +> assert (approx(i, abs=1), approx(j, abs=1)) == EXAMPLE_PIXELS[index] +E assert (-2 ± 1.0e+00, 1 ± 1.0e+00) == (0, 0) +E At index 0 diff: -2 ± 1.0e+00 != 0 +E Full diff: +E - (0, 0) +E + (-2 ± 1.0e+00, 1 ± 1.0e+00) + +test/test_grid_proj.py:139: AssertionError +_____________________________ test_map_geo_to_crs ______________________________ + +grid_proj = + + def test_map_geo_to_crs(grid_proj: GridProj): + for index, lon_lat in enumerate(EXAMPLE_LON_LAT): + geo_xy = grid_proj.map_geo_to_crs(*lon_lat) +> assert geo_xy == approx_tuple(EXAMPLE_CRS[index]) +E assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) +E At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 +E Full diff: +E - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) +E + (-3271151.6058371724, -263793.7334645616) + +test/test_grid_proj.py:145: AssertionError +____________________________ test_map_pixel_to_crs _____________________________ + +grid_proj = + + def test_map_pixel_to_crs(grid_proj: GridProj): + for index, pixel in enumerate(EXAMPLE_PIXELS): + geo_x, geo_y = grid_proj.map_pixel_to_crs(*pixel) +> assert (geo_x, geo_y) == approx_tuple(EXAMPLE_CRS[index]) +E assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) +E At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 +E Full diff: +E - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) +E + (-3271151.6058371724, -263793.7334645616) + +test/test_grid_proj.py:151: AssertionError +____________________________ test_map_pixel_to_geo _____________________________ + +grid_proj = + + def test_map_pixel_to_geo(grid_proj: GridProj): + for index, pixel in enumerate(EXAMPLE_PIXELS): + proj_x, proj_y = grid_proj.map_pixel_to_geo(*pixel) +> assert (proj_x, proj_y) == approx_tuple(EXAMPLE_LON_LAT[index]) +E assert (-126.2821043...5112362717893) == (-126.2820964...418 ± 1.9e-05) +E At index 1 diff: 19.25112362717893 != 19.251224896946418 ± 1.9e-05 +E Full diff: +E - (-126.28209649530142 ± 1.3e-04, 19.251224896946418 ± 1.9e-05) +E + (-126.28210431967231, 19.25112362717893) + +test/test_grid_proj.py:157: AssertionError +_____________________________ test_map_crs_to_geo ______________________________ + +grid_proj = + + def test_map_crs_to_geo(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + proj_x, proj_y = grid_proj.map_crs_to_geo(*geo) +> assert (proj_x, proj_y) == approx_tuple(EXAMPLE_LON_LAT[index]) +E assert (-126.3265786...7681535953287) == (-126.2766 ± ...229 ± 1.9e-05) +E At index 0 diff: -126.32657866000567 != -126.2766 ± 1.3e-04 +E Full diff: +E - (-126.2766 ± 1.3e-04, 19.229 ± 1.9e-05) +E + (-126.32657866000567, 19.247681535953287) + +test/test_grid_proj.py:163: AssertionError +________________________ test_crs_to_pixel_no_rounding _________________________ + +grid_proj = + + def test_crs_to_pixel_no_rounding(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel(*geo) + # round result, which will not be precisely the integer that was passed +> assert (round_(i, 6), round_(j, 6)) == EXAMPLE_PIXELS[index] +E assert (-1.833185, 1.275387) == (0, 0) +E At index 0 diff: -1.833185 != 0 +E Full diff: +E - (0, 0) +E + (-1.833185, 1.275387) + +test/test_grid_proj.py:170: AssertionError +___________________________ test_crs_to_pixel_floor ____________________________ + +grid_proj = + + def test_crs_to_pixel_floor(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel(*geo) +> assert (round_(i), round_(j)) == EXAMPLE_PIXELS[index] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:176: AssertionError +___________________________ test_crs_to_pixel_round ____________________________ + +grid_proj = + + def test_crs_to_pixel_round(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel(*geo, rounding=RoundingMethod.ROUND) +> assert (i, j) == EXAMPLE_PIXELS[index] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:187: AssertionError +_________________________ test_crs_to_pixel_round_str __________________________ + +grid_proj = + + def test_crs_to_pixel_round_str(grid_proj: GridProj): + i, j = grid_proj.map_crs_to_pixel(*EXAMPLE_CRS[0], rounding='round') +> assert (i, j) == EXAMPLE_PIXELS[0] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:192: AssertionError +____________________________ test_geo_to_pixel_list ____________________________ + +grid_proj = + + def test_geo_to_pixel_list(grid_proj: GridProj): + # split example list of tuples into: list of lats and list of lons + lon_lat_arrays: tuple[list[float]] = tuple(zip(*EXAMPLE_LON_LAT)) + + # pass full arrays to map_geo_to_pixel + pixel_arrays = grid_proj.map_geo_to_pixel(*lon_lat_arrays, rounding=RoundingMethod.ROUND) + + expected_xs, expected_ys = list(zip(*EXAMPLE_PIXELS)) +> assert pixel_arrays[0] == expected_xs +E assert (0, 0, 1996) == (0, 0, 2000) +E At index 2 diff: 1996 != 2000 +E Full diff: +E - (0, 0, 2000) +E + (0, 0, 1996) + +test/test_grid_proj.py:229: AssertionError +________________________ test_pixel_to_geo_numpy_array _________________________ + +grid_proj = + + def test_pixel_to_geo_numpy_array(grid_proj: GridProj): + i_array, j_array = list(zip(*EXAMPLE_PIXELS)) + + # pass full numpy arrays to map_pixel_to_geo + i_numpy_array = np.array(i_array) + j_numpy_array = np.array(j_array) + geo_arrays = grid_proj.map_pixel_to_geo(i_numpy_array, j_numpy_array) + + expected_geos = tuple(np.array(values) for values in zip(*EXAMPLE_LON_LAT)) + + # both x and y coordinate arrays should be numpy arrays + assert all(isinstance(arr, np.ndarray) for arr in geo_arrays) +> np.testing.assert_almost_equal(geo_arrays, expected_geos) + +test/test_grid_proj.py:245: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: in inner + return func(*args, **kwds) +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: in inner + return func(*args, **kwds) +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (.compare at 0x7feed17c2700>, (array([-126.2766 , -126.28210432, -71.0...3, 54.01407727])), (array([-126.2766 , -126.2820965, -71.1286076]), array([19.229 , 19.2512249 , 54.09108721]))) +kwds = {'err_msg': '', 'header': 'Arrays are not almost equal to 7 decimals', 'precision': 7, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not almost equal to 7 decimals +E +E Mismatched elements: 4 / 6 (66.7%) +E Max absolute difference: 0.10626634 +E Max relative difference: 0.001494 +E x: array([[-126.2766 , -126.2821043, -71.0223413], +E [ 19.229 , 19.2511236, 54.0140773]]) +E y: array([[-126.2766 , -126.2820965, -71.1286076], +E [ 19.229 , 19.2512249, 54.0910872]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +________________________ test_geo_to_pixel_numpy_array _________________________ + +grid_proj = + + def test_geo_to_pixel_numpy_array(grid_proj: GridProj): + x_values, y_values = list(zip(*EXAMPLE_LON_LAT)) + pixel_arrays = grid_proj.map_geo_to_pixel( + np.array(x_values), np.array(y_values), rounding=RoundingMethod.ROUND + ) - geo_image.draw_shape(poly_wkt, (0, 0, 100)) + expected_arrays = np.array(list(zip(*EXAMPLE_PIXELS))) - values, indices, counts = numpy.unique(geo_image.rgb_array, - return_inverse=True, - return_counts=True) + # both x and y coordinate arrays returned should be numpy arrays + assert all(isinstance(arr, np.ndarray) for arr in pixel_arrays) +> np.testing.assert_array_equal(pixel_arrays, expected_arrays) + +test/test_grid_proj.py:258: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (, (array([ 0, 0, 1996]), array([ 0, 1, 1503])), array([[ 0, 0, 2000], + [ 0, 1, 1500]])) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 2 / 6 (33.3%) +E Max absolute difference: 4 +E Max relative difference: 0.002 +E x: array([[ 0, 0, 1996], +E [ 0, 1, 1503]]) +E y: array([[ 0, 0, 2000], +E [ 0, 1, 1500]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +________________________ test_read_netcdf_global_attrs _________________________ + + def test_read_netcdf_global_attrs(): + attrs = read_netcdf_global_attrs(EXAMPLE_NETCDF_FILEPATH) + + assert len(attrs) == 11 +> assert attrs == EXAMPLE_ATTRIBUTES +E AssertionError: assert {'data_key': ...0+00:00', ...} == {'data_key': ...0+00:00', ...} +E Omitting 10 identical items, use -vv to show +E Differing items: +E {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200'} != {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200'} +E Full diff: +E { +E 'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', +E 'field': 'TEMP', +E 'grid_spec': '+dx=2539.703 +dy=2539.703 +w=2345 +h=1597 +lat_ll=19.229 ' +E '+lon_ll=-126.2766', +E 'issue_dt': '2022-11-11 14:00:00+00:00', +E 'product': 'NBM.AWS.GRIB', +E 'proj_name': 'NBM', +E - 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200', +E ? ^ +E + 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200', +E ? ^ +E 'region': 'CO', +E 'task': 'data_task', +E 'units': 'Fahrenheit', +E 'valid_dt': '2022-11-11 17:00:00+00:00', +E } + +test/test_netcdf_io.py:59: AssertionError +_______________________________ test_read_netcdf _______________________________ + +example_netcdf_data = ({'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', 'field': 'TEMP', 'grid_spec': '+dx=25...259913], + [38.42599 , 38.42599 , 38.42599 , ..., 2.4259913, 2.4259913, + 2.4259913]], dtype=float32)) + + def test_read_netcdf(example_netcdf_data: Tuple[Dict[str, any], ndarray]): + attrs, grid = example_netcdf_data + + assert grid.shape == (1597, 2345) + x_dimensions, y_dimensions = grid.shape + + assert grid[0][0] == approx(72.98599) + assert grid[round(x_dimensions / 2)][round(y_dimensions / 2)] == approx(12.505991) + assert grid[x_dimensions - 1][y_dimensions - 1] == approx(2.4259913) - # values will be 0 or 100 (for polygon) and 0 everywhere else - numpy.testing.assert_array_equal(values, [0, 100]) -> numpy.testing.assert_array_equal(counts, [7392, 108]) +> assert attrs == EXAMPLE_ATTRIBUTES +E AssertionError: assert {'data_key': ...0+00:00', ...} == {'data_key': ...0+00:00', ...} +E Omitting 10 identical items, use -vv to show +E Differing items: +E {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200'} != {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200'} +E Full diff: +E { +E 'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', +E 'field': 'TEMP', +E 'grid_spec': '+dx=2539.703 +dy=2539.703 +w=2345 +h=1597 +lat_ll=19.229 ' +E '+lon_ll=-126.2766', +E 'issue_dt': '2022-11-11 14:00:00+00:00', +E 'product': 'NBM.AWS.GRIB', +E 'proj_name': 'NBM', +E - 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200', +E ? ^ +E + 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200', +E ? ^ +E 'region': 'CO', +E 'task': 'data_task', +E 'units': 'Fahrenheit', +E 'valid_dt': '2022-11-11 17:00:00+00:00', +E } + +test/test_netcdf_io.py:72: AssertionError +________________________ test_geographic_point_to_pixel ________________________ + +grid_proj = + + def test_geographic_point_to_pixel(grid_proj: GridProj): + point = from_wkt('POINT (-105 40)') + pixel_point = from_wkt('POINT (941.5576426719887 778.2701810387533)') + result = geographic_point_to_pixel(point, grid_proj) + +> assert result == pixel_point +E assert == + +test/test_vectaster.py:46: AssertionError +_____________________ test_geographic_linestring_to_pixel ______________________ + +grid_proj = + + def test_geographic_linestring_to_pixel(grid_proj: GridProj): + linestring = from_wkt('LINESTRING (-100 30, -110 40, -120 50)') + pixel_linestring = from_wkt('LINESTRING (1099.1941683923565 324.546444238068,' + '768.0092501944506 794.3170139903758,' + '509.1550445412777 1305.9671045297775)') + result = geographic_linestring_to_pixel(linestring, grid_proj) +> assert result == pixel_linestring +E assert == + +test/test_vectaster.py:55: AssertionError +_______________________ test_geographic_polygon_to_pixel _______________________ + +grid_proj = + + def test_geographic_polygon_to_pixel(grid_proj: GridProj): + poly = from_wkt('POLYGON ((-105 40, -110 40, -110 50, -105 50, -105 40), ' + '(-107 42, -107 47, -108 47, -108 42, -107 42))') + pixel_poly = from_wkt('POLYGON ((941.5576426719887 778.2701810387533,' + '768.0092501944506 794.3170139903758,' + '819.7238357524881 1259.816223819563,' + '976.0731562314586 1245.359671430866,' + '941.5576426719887 778.2701810387533),' + '(880.1253951755987 874.7112000835223,' + '900.7222774204608 1106.8022369109524,' + '868.391509125368 1109.7916419444564,' + '846.0832806150518 877.8588416022637,' + '880.1253951755987 874.7112000835223))') + result = geographic_polygon_to_pixel(poly, grid_proj) +> assert result == pixel_poly +E assert == + +test/test_vectaster.py:72: AssertionError +_____________________________ test_rasterize_point _____________________________ + +grid_proj = + + def test_rasterize_point(grid_proj: GridProj): + point = 'POINT (-100.5 30.5)' + pixels = (numpy.array([1081]), numpy.array([347])) + result = rasterize_point(point, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:101: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (, (array([1079]), array([349])), (array([1081]), array([347]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 2 / 2 (100%) +E Max absolute difference: 2 +E Max relative difference: 0.00576369 +E x: array([[1079], +E [ 349]]) +E y: array([[1081], +E [ 347]]) -test/test_geo_image.py:232: +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +_______________________ test_rasterize_point_from_coord ________________________ + +grid_proj = + + def test_rasterize_point_from_coord(grid_proj: GridProj): + point = (-100.5, 30.5) + pixels = (numpy.array([1081]), numpy.array([347])) + result = rasterize_point(point, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:108: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ -args = (, array([7385, 115]), [7392, 108]) +args = (, (array([1079]), array([349])), (array([1081]), array([347]))) kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} @wraps(func) @@ -63,10 +492,151 @@ E AssertionError: E Arrays are not equal E E Mismatched elements: 2 / 2 (100%) -E Max absolute difference: 7 -E Max relative difference: 0.06481481 -E x: array([7385, 115]) -E y: array([7392, 108]) +E Max absolute difference: 2 +E Max relative difference: 0.00576369 +E x: array([[1079], +E [ 349]]) +E y: array([[1081], +E [ 347]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +__________________________ test_rasterize_linestring ___________________________ + +grid_proj = + + def test_rasterize_linestring(grid_proj: GridProj): + linestring = 'LINESTRING (-100 30, -100.1 30.1, -100.2 30)' + pixels = (numpy.array([1099, 1098, 1097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091]), + numpy.array([324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324])) + result = rasterize_linestring(linestring, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:129: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (, (array([1097, 1096, 1096, 1095, 1095, 1094, 1093, 1092, 1092, 1091, 1090]), array([326, 327, ...097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091]), array([324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 22 / 22 (100%) +E Max absolute difference: 2 +E Max relative difference: 0.00617284 +E x: array([[1097, 1096, 1096, 1095, 1095, 1094, 1093, 1092, 1092, 1091, 1090], +E [ 326, 327, 328, 329, 330, 331, 330, 329, 328, 327, 326]]) +E y: array([[1099, 1098, 1097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091], +E [ 324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +____________________ test_rasterize_linestring_from_coords _____________________ + +grid_proj = + + def test_rasterize_linestring_from_coords(grid_proj: GridProj): + linestring = [(-100, 30), (-100.01, 30.02), (-100.02, 30)] + pixels = (numpy.array([1099, 1098, 1098]), numpy.array([324, 325, 324])) + result = rasterize_linestring(linestring, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:136: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (, (array([1097, 1097, 1096]), array([326, 327, 326])), (array([1099, 1098, 1098]), array([324, 325, 324]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 6 / 6 (100%) +E Max absolute difference: 2 +E Max relative difference: 0.00617284 +E x: array([[1097, 1097, 1096], +E [ 326, 327, 326]]) +E y: array([[1099, 1098, 1098], +E [ 324, 325, 324]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +___________________________ test_rasterize_polygon__ ___________________________ + +grid_proj = + + def test_rasterize_polygon__(grid_proj: GridProj): + poly = 'POLYGON ((-105 40, -105.1 40, -105.1 40.1, -105 40.1, -105 40))' + pixels = (numpy.array([938, 939, 940, 941, 938, 939, 940, 941, 938, 939, 940, + 941, 938, 939, 940, 941, 938, 939, 940, 941, 941, 938]), + numpy.array([778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, + 780, 781, 781, 781, 781, 782, 782, 782, 782, 782, 783])) + result = rasterize_polygon(poly, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:146: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (, (array([937, 938, 939, 940, 937, 938, 939, 940, 937, 938, 939, 940, 937, + 938, 939, 940...778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, 780, 781, + 781, 781, 781, 782, 782, 782, 782, 782, 783]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 44 / 44 (100%) +E Max absolute difference: 3 +E Max relative difference: 0.00385604 +E x: array([[937, 938, 939, 940, 937, 938, 939, 940, 937, 938, 939, 940, 937, +E 938, 939, 940, 937, 938, 939, 940, 940, 937], +E [781, 781, 781, 781, 782, 782, 782, 782, 783, 783, 783, 783, 784, +E 784, 784, 784, 785, 785, 785, 785, 785, 786]]) +E y: array([[938, 939, 940, 941, 938, 939, 940, 941, 938, 939, 940, 941, 938, +E 939, 940, 941, 938, 939, 940, 941, 941, 938], +E [778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, 780, 781, +E 781, 781, 781, 782, 782, 782, 782, 782, 783]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError +______________________ test_rasterize_polygon_from_coords ______________________ + +grid_proj = + + def test_rasterize_polygon_from_coords(grid_proj: GridProj): + poly = (((-105, 40), (-105.1, 40), (-105.1, 40.1), (-105, 40)),) + pixels = (numpy.array([938, 939, 940, 941, 938, 939, 940, 938, 939, 938, 939, 938, 938]), + numpy.array([778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783])) + result = rasterize_polygon(poly, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:154: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (, (array([937, 938, 939, 940, 937, 938, 939, 937, 938, 937, 938, 937, 937]), array([781, 781, 7...8, 939, 940, 938, 939, 938, 939, 938, 938]), array([778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 26 / 26 (100%) +E Max absolute difference: 3 +E Max relative difference: 0.00385604 +E x: array([[937, 938, 939, 940, 937, 938, 939, 937, 938, 937, 938, 937, 937], +E [781, 781, 781, 781, 782, 782, 782, 783, 783, 784, 784, 785, 786]]) +E y: array([[938, 939, 940, 941, 938, 939, 940, 938, 939, 938, 939, 938, 938], +E [778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783]]) /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError =============================== warnings summary =============================== @@ -79,32 +649,221 @@ idsse/common/validate_schema.py:15 - generated xml file: /home/runner/work/idss-engine-commons/idss-engine-commons/python/idsse_common/test/pytest.xml - ---------- coverage: platform linux, python 3.11.7-final-0 ----------- -Name Stmts Miss Cover ------------------------------------------------------ -idsse/common/__init__.py 0 0 100% -idsse/common/aws_utils.py 86 5 94% -idsse/common/config.py 68 8 88% -idsse/common/geo_image.py 219 14 94% -idsse/common/grid_proj.py 112 2 98% -idsse/common/json_message.py 23 1 96% -idsse/common/log_util.py 43 3 93% -idsse/common/netcdf_io.py 47 0 100% -idsse/common/path_builder.py 128 10 92% -idsse/common/publish_confirm.py 151 13 91% -idsse/common/rabbitmq_utils.py 61 0 100% -idsse/common/utils.py 103 14 86% -idsse/common/validate_schema.py 40 0 100% -idsse/common/vectaster.py 193 31 84% ------------------------------------------------------ -TOTAL 1274 101 92% +Name Stmts Miss Cover +------------------------------------------------------ +idsse/common/__init__.py 0 0 100% +idsse/common/aws_utils.py 86 5 94% +idsse/common/config.py 68 8 88% +idsse/common/geo_image.py 219 14 94% +idsse/common/grid_proj.py 94 1 99% +idsse/common/json_message.py 23 1 96% +idsse/common/log_util.py 43 3 93% +idsse/common/netcdf_io.py 47 0 100% +idsse/common/path_builder.py 128 10 92% +idsse/common/publish_confirm.py 151 13 91% +idsse/common/rabbitmq_utils.py 61 0 100% +idsse/common/scientific_utils.py 9 0 100% +idsse/common/utils.py 121 10 92% +idsse/common/validate_schema.py 40 0 100% +idsse/common/vectaster.py 180 30 83% +------------------------------------------------------ +TOTAL 1270 95 93% =========================== short test summary info ============================ -FAILED test/test_geo_image.py::test_draw_geo_polygon - AssertionError: +FAILED test/test_grid_proj.py::test_from_proj_grid_spec - assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) + At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 + Full diff: + - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) + + (-3271151.6058371724, -263793.7334645616) +FAILED test/test_grid_proj.py::test_from_proj_grid_spec_with_offset - assert (-126.3265786...7681535953287) == (-126.2766 ± ...229 ± 1.9e-05) + At index 0 diff: -126.3265786600057 != -126.2766 ± 1.3e-04 + Full diff: + - (-126.2766 ± 1.3e-04, 19.229 ± 1.9e-05) + + (-126.3265786600057, 19.247681535953287) +FAILED test/test_grid_proj.py::test_map_crs_to_pixel_round - assert (-2, 1) == (0, 0) + At index 0 diff: -2 != 0 + Full diff: + - (0, 0) + + (-2, 1) +FAILED test/test_grid_proj.py::test_map_crs_to_pixel_floor - assert (-2 ± 1.0e+00, 1 ± 1.0e+00) == (0, 0) + At index 0 diff: -2 ± 1.0e+00 != 0 + Full diff: + - (0, 0) + + (-2 ± 1.0e+00, 1 ± 1.0e+00) +FAILED test/test_grid_proj.py::test_map_geo_to_crs - assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) + At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 + Full diff: + - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) + + (-3271151.6058371724, -263793.7334645616) +FAILED test/test_grid_proj.py::test_map_pixel_to_crs - assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) + At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 + Full diff: + - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) + + (-3271151.6058371724, -263793.7334645616) +FAILED test/test_grid_proj.py::test_map_pixel_to_geo - assert (-126.2821043...5112362717893) == (-126.2820964...418 ± 1.9e-05) + At index 1 diff: 19.25112362717893 != 19.251224896946418 ± 1.9e-05 + Full diff: + - (-126.28209649530142 ± 1.3e-04, 19.251224896946418 ± 1.9e-05) + + (-126.28210431967231, 19.25112362717893) +FAILED test/test_grid_proj.py::test_map_crs_to_geo - assert (-126.3265786...7681535953287) == (-126.2766 ± ...229 ± 1.9e-05) + At index 0 diff: -126.32657866000567 != -126.2766 ± 1.3e-04 + Full diff: + - (-126.2766 ± 1.3e-04, 19.229 ± 1.9e-05) + + (-126.32657866000567, 19.247681535953287) +FAILED test/test_grid_proj.py::test_crs_to_pixel_no_rounding - assert (-1.833185, 1.275387) == (0, 0) + At index 0 diff: -1.833185 != 0 + Full diff: + - (0, 0) + + (-1.833185, 1.275387) +FAILED test/test_grid_proj.py::test_crs_to_pixel_floor - assert (-2, 1) == (0, 0) + At index 0 diff: -2 != 0 + Full diff: + - (0, 0) + + (-2, 1) +FAILED test/test_grid_proj.py::test_crs_to_pixel_round - assert (-2, 1) == (0, 0) + At index 0 diff: -2 != 0 + Full diff: + - (0, 0) + + (-2, 1) +FAILED test/test_grid_proj.py::test_crs_to_pixel_round_str - assert (-2, 1) == (0, 0) + At index 0 diff: -2 != 0 + Full diff: + - (0, 0) + + (-2, 1) +FAILED test/test_grid_proj.py::test_geo_to_pixel_list - assert (0, 0, 1996) == (0, 0, 2000) + At index 2 diff: 1996 != 2000 + Full diff: + - (0, 0, 2000) + + (0, 0, 1996) +FAILED test/test_grid_proj.py::test_pixel_to_geo_numpy_array - AssertionError: +Arrays are not almost equal to 7 decimals + +Mismatched elements: 4 / 6 (66.7%) +Max absolute difference: 0.10626634 +Max relative difference: 0.001494 + x: array([[-126.2766 , -126.2821043, -71.0223413], + [ 19.229 , 19.2511236, 54.0140773]]) + y: array([[-126.2766 , -126.2820965, -71.1286076], + [ 19.229 , 19.2512249, 54.0910872]]) +FAILED test/test_grid_proj.py::test_geo_to_pixel_numpy_array - AssertionError: +Arrays are not equal + +Mismatched elements: 2 / 6 (33.3%) +Max absolute difference: 4 +Max relative difference: 0.002 + x: array([[ 0, 0, 1996], + [ 0, 1, 1503]]) + y: array([[ 0, 0, 2000], + [ 0, 1, 1500]]) +FAILED test/test_netcdf_io.py::test_read_netcdf_global_attrs - AssertionError: assert {'data_key': ...0+00:00', ...} == {'data_key': ...0+00:00', ...} + Omitting 10 identical items, use -vv to show + Differing items: + {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200'} != {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200'} + Full diff: + { + 'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', + 'field': 'TEMP', + 'grid_spec': '+dx=2539.703 +dy=2539.703 +w=2345 +h=1597 +lat_ll=19.229 ' + '+lon_ll=-126.2766', + 'issue_dt': '2022-11-11 14:00:00+00:00', + 'product': 'NBM.AWS.GRIB', + 'proj_name': 'NBM', + - 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200', + ? ^ + + 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200', + ? ^ + 'region': 'CO', + 'task': 'data_task', + 'units': 'Fahrenheit', + 'valid_dt': '2022-11-11 17:00:00+00:00', + } +FAILED test/test_netcdf_io.py::test_read_netcdf - AssertionError: assert {'data_key': ...0+00:00', ...} == {'data_key': ...0+00:00', ...} + Omitting 10 identical items, use -vv to show + Differing items: + {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200'} != {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200'} + Full diff: + { + 'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', + 'field': 'TEMP', + 'grid_spec': '+dx=2539.703 +dy=2539.703 +w=2345 +h=1597 +lat_ll=19.229 ' + '+lon_ll=-126.2766', + 'issue_dt': '2022-11-11 14:00:00+00:00', + 'product': 'NBM.AWS.GRIB', + 'proj_name': 'NBM', + - 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200', + ? ^ + + 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200', + ? ^ + 'region': 'CO', + 'task': 'data_task', + 'units': 'Fahrenheit', + 'valid_dt': '2022-11-11 17:00:00+00:00', + } +FAILED test/test_vectaster.py::test_geographic_point_to_pixel - assert == +FAILED test/test_vectaster.py::test_geographic_linestring_to_pixel - assert == +FAILED test/test_vectaster.py::test_geographic_polygon_to_pixel - assert == +FAILED test/test_vectaster.py::test_rasterize_point - AssertionError: Arrays are not equal Mismatched elements: 2 / 2 (100%) -Max absolute difference: 7 -Max relative difference: 0.06481481 - x: array([7385, 115]) - y: array([7392, 108]) -================== 1 failed, 211 passed, 2 warnings in 5.26s =================== +Max absolute difference: 2 +Max relative difference: 0.00576369 + x: array([[1079], + [ 349]]) + y: array([[1081], + [ 347]]) +FAILED test/test_vectaster.py::test_rasterize_point_from_coord - AssertionError: +Arrays are not equal + +Mismatched elements: 2 / 2 (100%) +Max absolute difference: 2 +Max relative difference: 0.00576369 + x: array([[1079], + [ 349]]) + y: array([[1081], + [ 347]]) +FAILED test/test_vectaster.py::test_rasterize_linestring - AssertionError: +Arrays are not equal + +Mismatched elements: 22 / 22 (100%) +Max absolute difference: 2 +Max relative difference: 0.00617284 + x: array([[1097, 1096, 1096, 1095, 1095, 1094, 1093, 1092, 1092, 1091, 1090], + [ 326, 327, 328, 329, 330, 331, 330, 329, 328, 327, 326]]) + y: array([[1099, 1098, 1097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091], + [ 324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324]]) +FAILED test/test_vectaster.py::test_rasterize_linestring_from_coords - AssertionError: +Arrays are not equal + +Mismatched elements: 6 / 6 (100%) +Max absolute difference: 2 +Max relative difference: 0.00617284 + x: array([[1097, 1097, 1096], + [ 326, 327, 326]]) + y: array([[1099, 1098, 1098], + [ 324, 325, 324]]) +FAILED test/test_vectaster.py::test_rasterize_polygon__ - AssertionError: +Arrays are not equal + +Mismatched elements: 44 / 44 (100%) +Max absolute difference: 3 +Max relative difference: 0.00385604 + x: array([[937, 938, 939, 940, 937, 938, 939, 940, 937, 938, 939, 940, 937, + 938, 939, 940, 937, 938, 939, 940, 940, 937], + [781, 781, 781, 781, 782, 782, 782, 782, 783, 783, 783, 783, 784, + 784, 784, 784, 785, 785, 785, 785, 785, 786]]) + y: array([[938, 939, 940, 941, 938, 939, 940, 941, 938, 939, 940, 941, 938, + 939, 940, 941, 938, 939, 940, 941, 941, 938], + [778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, 780, 781, + 781, 781, 781, 782, 782, 782, 782, 782, 783]]) +FAILED test/test_vectaster.py::test_rasterize_polygon_from_coords - AssertionError: +Arrays are not equal + +Mismatched elements: 26 / 26 (100%) +Max absolute difference: 3 +Max relative difference: 0.00385604 + x: array([[937, 938, 939, 940, 937, 938, 939, 937, 938, 937, 938, 937, 937], + [781, 781, 781, 781, 782, 782, 782, 783, 783, 784, 784, 785, 786]]) + y: array([[938, 939, 940, 941, 938, 939, 940, 938, 939, 938, 939, 938, 938], + [778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783]]) +================== 26 failed, 188 passed, 2 warnings in 5.39s ================== diff --git a/python/idsse_common/test/pytest.xml b/python/idsse_common/test/pytest.xml index c10475e4..3051dd77 100644 --- a/python/idsse_common/test/pytest.xml +++ b/python/idsse_common/test/pytest.xml @@ -1,31 +1,368 @@ -proj = <idsse.common.grid_proj.GridProj object at 0x7f2484838910> +grid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed279b190> - def test_draw_geo_polygon(proj): - scale = 10 - width, height = 5, 5 - data = numpy.zeros((height, width)) - geo_image = GeoImage.from_data_grid(proj, data, scale=scale) + def test_from_proj_grid_spec(grid_proj: GridProj): + assert isinstance(grid_proj, GridProj) - lon_lat_1 = proj.map_pixel_to_geo(1.3, 1.9) - lon_lat_2 = proj.map_pixel_to_geo(3.5, 2.7) - lon_lat_3 = proj.map_pixel_to_geo(3.0, 1.5) - poly_wkt = (f'POLYGON(({lon_lat_1[0]} {lon_lat_1[1]}, {lon_lat_2[0]} {lon_lat_2[1]}, ' - f'{lon_lat_3[0]} {lon_lat_3[1]}, {lon_lat_1[0]} {lon_lat_1[1]}))') +> assert (grid_proj._x_offset, grid_proj._y_offset) == approx_tuple(EXAMPLE_CRS[0]) +E assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) +E At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 +E Full diff: +E - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) +E + (-3271151.6058371724, -263793.7334645616) + +test/test_grid_proj.py:70: AssertionErrordef test_from_proj_grid_spec_with_offset(): + proj_with_offset = GridProj.from_proj_grid_spec(PROJ_SPEC_WITH_OFFSET, + GRID_SPEC_WITHOUT_LOWER_LEFT) + + proj_xy = proj_with_offset.map_pixel_to_geo(*EXAMPLE_PIXELS[0]) +> assert proj_xy == approx_tuple(EXAMPLE_LON_LAT[0]) +E assert (-126.3265786...7681535953287) == (-126.2766 ± ...229 ± 1.9e-05) +E At index 0 diff: -126.3265786600057 != -126.2766 ± 1.3e-04 +E Full diff: +E - (-126.2766 ± 1.3e-04, 19.229 ± 1.9e-05) +E + (-126.3265786600057, 19.247681535953287) + +test/test_grid_proj.py:86: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed18dd8d0> + + def test_map_crs_to_pixel_round(grid_proj: GridProj): + for index, crs_xy in enumerate(EXAMPLE_CRS): + pixel_xy = grid_proj.map_crs_to_pixel( + *crs_xy, + rounding=RoundingMethod.ROUND + ) +> assert pixel_xy == EXAMPLE_PIXELS[index] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:128: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed1a97250> + + def test_map_crs_to_pixel_floor(grid_proj: GridProj): + for index, crs_xy in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel( + *crs_xy, + rounding=RoundingMethod.FLOOR + ) + # due to math imprecision internal to pyproj.transform(), some test results are a bit + # unpredictable. E.g. returns 0.999994, which floors to 0, when expected pixel value is 1 +> assert (approx(i, abs=1), approx(j, abs=1)) == EXAMPLE_PIXELS[index] +E assert (-2 ± 1.0e+00, 1 ± 1.0e+00) == (0, 0) +E At index 0 diff: -2 ± 1.0e+00 != 0 +E Full diff: +E - (0, 0) +E + (-2 ± 1.0e+00, 1 ± 1.0e+00) + +test/test_grid_proj.py:139: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed1cd4a50> + + def test_map_geo_to_crs(grid_proj: GridProj): + for index, lon_lat in enumerate(EXAMPLE_LON_LAT): + geo_xy = grid_proj.map_geo_to_crs(*lon_lat) +> assert geo_xy == approx_tuple(EXAMPLE_CRS[index]) +E assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) +E At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 +E Full diff: +E - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) +E + (-3271151.6058371724, -263793.7334645616) + +test/test_grid_proj.py:145: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed171ad10> + + def test_map_pixel_to_crs(grid_proj: GridProj): + for index, pixel in enumerate(EXAMPLE_PIXELS): + geo_x, geo_y = grid_proj.map_pixel_to_crs(*pixel) +> assert (geo_x, geo_y) == approx_tuple(EXAMPLE_CRS[index]) +E assert (-3271151.605...93.7334645616) == (-3275807.350...285 ± 2.6e-01) +E At index 0 diff: -3271151.6058371724 != -3275807.350733357 ± 3.3e+00 +E Full diff: +E - (-3275807.350733357 ± 3.3e+00, -260554.63043505285 ± 2.6e-01) +E + (-3271151.6058371724, -263793.7334645616) + +test/test_grid_proj.py:151: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed1cd5bd0> + + def test_map_pixel_to_geo(grid_proj: GridProj): + for index, pixel in enumerate(EXAMPLE_PIXELS): + proj_x, proj_y = grid_proj.map_pixel_to_geo(*pixel) +> assert (proj_x, proj_y) == approx_tuple(EXAMPLE_LON_LAT[index]) +E assert (-126.2821043...5112362717893) == (-126.2820964...418 ± 1.9e-05) +E At index 1 diff: 19.25112362717893 != 19.251224896946418 ± 1.9e-05 +E Full diff: +E - (-126.28209649530142 ± 1.3e-04, 19.251224896946418 ± 1.9e-05) +E + (-126.28210431967231, 19.25112362717893) + +test/test_grid_proj.py:157: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecf197bd0> + + def test_map_crs_to_geo(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + proj_x, proj_y = grid_proj.map_crs_to_geo(*geo) +> assert (proj_x, proj_y) == approx_tuple(EXAMPLE_LON_LAT[index]) +E assert (-126.3265786...7681535953287) == (-126.2766 ± ...229 ± 1.9e-05) +E At index 0 diff: -126.32657866000567 != -126.2766 ± 1.3e-04 +E Full diff: +E - (-126.2766 ± 1.3e-04, 19.229 ± 1.9e-05) +E + (-126.32657866000567, 19.247681535953287) + +test/test_grid_proj.py:163: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed1406450> + + def test_crs_to_pixel_no_rounding(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel(*geo) + # round result, which will not be precisely the integer that was passed +> assert (round_(i, 6), round_(j, 6)) == EXAMPLE_PIXELS[index] +E assert (-1.833185, 1.275387) == (0, 0) +E At index 0 diff: -1.833185 != 0 +E Full diff: +E - (0, 0) +E + (-1.833185, 1.275387) + +test/test_grid_proj.py:170: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feeceb16910> + + def test_crs_to_pixel_floor(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel(*geo) +> assert (round_(i), round_(j)) == EXAMPLE_PIXELS[index] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:176: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecea98f10> + + def test_crs_to_pixel_round(grid_proj: GridProj): + for index, geo in enumerate(EXAMPLE_CRS): + i, j = grid_proj.map_crs_to_pixel(*geo, rounding=RoundingMethod.ROUND) +> assert (i, j) == EXAMPLE_PIXELS[index] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:187: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feed13ca9d0> + + def test_crs_to_pixel_round_str(grid_proj: GridProj): + i, j = grid_proj.map_crs_to_pixel(*EXAMPLE_CRS[0], rounding='round') +> assert (i, j) == EXAMPLE_PIXELS[0] +E assert (-2, 1) == (0, 0) +E At index 0 diff: -2 != 0 +E Full diff: +E - (0, 0) +E + (-2, 1) + +test/test_grid_proj.py:192: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feeced0e2d0> + + def test_geo_to_pixel_list(grid_proj: GridProj): + # split example list of tuples into: list of lats and list of lons + lon_lat_arrays: tuple[list[float]] = tuple(zip(*EXAMPLE_LON_LAT)) + + # pass full arrays to map_geo_to_pixel + pixel_arrays = grid_proj.map_geo_to_pixel(*lon_lat_arrays, rounding=RoundingMethod.ROUND) + + expected_xs, expected_ys = list(zip(*EXAMPLE_PIXELS)) +> assert pixel_arrays[0] == expected_xs +E assert (0, 0, 1996) == (0, 0, 2000) +E At index 2 diff: 1996 != 2000 +E Full diff: +E - (0, 0, 2000) +E + (0, 0, 1996) + +test/test_grid_proj.py:229: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecf1e0d50> + + def test_pixel_to_geo_numpy_array(grid_proj: GridProj): + i_array, j_array = list(zip(*EXAMPLE_PIXELS)) - geo_image.draw_shape(poly_wkt, (0, 0, 100)) + # pass full numpy arrays to map_pixel_to_geo + i_numpy_array = np.array(i_array) + j_numpy_array = np.array(j_array) + geo_arrays = grid_proj.map_pixel_to_geo(i_numpy_array, j_numpy_array) - values, indices, counts = numpy.unique(geo_image.rgb_array, - return_inverse=True, - return_counts=True) + expected_geos = tuple(np.array(values) for values in zip(*EXAMPLE_LON_LAT)) - # values will be 0 or 100 (for polygon) and 0 everywhere else - numpy.testing.assert_array_equal(values, [0, 100]) -> numpy.testing.assert_array_equal(counts, [7392, 108]) + # both x and y coordinate arrays should be numpy arrays + assert all(isinstance(arr, np.ndarray) for arr in geo_arrays) +> np.testing.assert_almost_equal(geo_arrays, expected_geos) + +test/test_grid_proj.py:245: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: in inner + return func(*args, **kwds) +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: in inner + return func(*args, **kwds) +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<function assert_array_almost_equal.<locals>.compare at 0x7feed17c2700>, (array([-126.2766 , -126.28210432, -71.0...3, 54.01407727])), (array([-126.2766 , -126.2820965, -71.1286076]), array([19.229 , 19.2512249 , 54.09108721]))) +kwds = {'err_msg': '', 'header': 'Arrays are not almost equal to 7 decimals', 'precision': 7, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not almost equal to 7 decimals +E +E Mismatched elements: 4 / 6 (66.7%) +E Max absolute difference: 0.10626634 +E Max relative difference: 0.001494 +E x: array([[-126.2766 , -126.2821043, -71.0223413], +E [ 19.229 , 19.2511236, 54.0140773]]) +E y: array([[-126.2766 , -126.2820965, -71.1286076], +E [ 19.229 , 19.2512249, 54.0910872]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feeced1ca90> + + def test_geo_to_pixel_numpy_array(grid_proj: GridProj): + x_values, y_values = list(zip(*EXAMPLE_LON_LAT)) + pixel_arrays = grid_proj.map_geo_to_pixel( + np.array(x_values), np.array(y_values), rounding=RoundingMethod.ROUND + ) + + expected_arrays = np.array(list(zip(*EXAMPLE_PIXELS))) + + # both x and y coordinate arrays returned should be numpy arrays + assert all(isinstance(arr, np.ndarray) for arr in pixel_arrays) +> np.testing.assert_array_equal(pixel_arrays, expected_arrays) + +test/test_grid_proj.py:258: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<built-in function eq>, (array([ 0, 0, 1996]), array([ 0, 1, 1503])), array([[ 0, 0, 2000], + [ 0, 1, 1500]])) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 2 / 6 (33.3%) +E Max absolute difference: 4 +E Max relative difference: 0.002 +E x: array([[ 0, 0, 1996], +E [ 0, 1, 1503]]) +E y: array([[ 0, 0, 2000], +E [ 0, 1, 1500]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrordef test_read_netcdf_global_attrs(): + attrs = read_netcdf_global_attrs(EXAMPLE_NETCDF_FILEPATH) + + assert len(attrs) == 11 +> assert attrs == EXAMPLE_ATTRIBUTES +E AssertionError: assert {'data_key': ...0+00:00', ...} == {'data_key': ...0+00:00', ...} +E Omitting 10 identical items, use -vv to show +E Differing items: +E {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200'} != {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200'} +E Full diff: +E { +E 'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', +E 'field': 'TEMP', +E 'grid_spec': '+dx=2539.703 +dy=2539.703 +w=2345 +h=1597 +lat_ll=19.229 ' +E '+lon_ll=-126.2766', +E 'issue_dt': '2022-11-11 14:00:00+00:00', +E 'product': 'NBM.AWS.GRIB', +E 'proj_name': 'NBM', +E - 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200', +E ? ^ +E + 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200', +E ? ^ +E 'region': 'CO', +E 'task': 'data_task', +E 'units': 'Fahrenheit', +E 'valid_dt': '2022-11-11 17:00:00+00:00', +E } + +test/test_netcdf_io.py:59: AssertionErrorexample_netcdf_data = ({'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', 'field': 'TEMP', 'grid_spec': '+dx=25...259913], + [38.42599 , 38.42599 , 38.42599 , ..., 2.4259913, 2.4259913, + 2.4259913]], dtype=float32)) + + def test_read_netcdf(example_netcdf_data: Tuple[Dict[str, any], ndarray]): + attrs, grid = example_netcdf_data + + assert grid.shape == (1597, 2345) + x_dimensions, y_dimensions = grid.shape + + assert grid[0][0] == approx(72.98599) + assert grid[round(x_dimensions / 2)][round(y_dimensions / 2)] == approx(12.505991) + assert grid[x_dimensions - 1][y_dimensions - 1] == approx(2.4259913) + +> assert attrs == EXAMPLE_ATTRIBUTES +E AssertionError: assert {'data_key': ...0+00:00', ...} == {'data_key': ...0+00:00', ...} +E Omitting 10 identical items, use -vv to show +E Differing items: +E {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200'} != {'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200'} +E Full diff: +E { +E 'data_key': 'NBM.AWS.GRIB:CO:TEMP::Fahrenheit::20221111140000.20221111170000', +E 'field': 'TEMP', +E 'grid_spec': '+dx=2539.703 +dy=2539.703 +w=2345 +h=1597 +lat_ll=19.229 ' +E '+lon_ll=-126.2766', +E 'issue_dt': '2022-11-11 14:00:00+00:00', +E 'product': 'NBM.AWS.GRIB', +E 'proj_name': 'NBM', +E - 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +a=6371200', +E ? ^ +E + 'proj_spec': '+proj=lcc +lat_0=25.0 +lon_0=-95.0 +lat_1=25.0 +r=6371200', +E ? ^ +E 'region': 'CO', +E 'task': 'data_task', +E 'units': 'Fahrenheit', +E 'valid_dt': '2022-11-11 17:00:00+00:00', +E } + +test/test_netcdf_io.py:72: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecef6d8d0> + + def test_geographic_point_to_pixel(grid_proj: GridProj): + point = from_wkt('POINT (-105 40)') + pixel_point = from_wkt('POINT (941.5576426719887 778.2701810387533)') + result = geographic_point_to_pixel(point, grid_proj) + +> assert result == pixel_point +E assert <POINT (940.528 781.343)> == <POINT (941.558 778.27)> + +test/test_vectaster.py:46: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecef8c410> + + def test_geographic_linestring_to_pixel(grid_proj: GridProj): + linestring = from_wkt('LINESTRING (-100 30, -110 40, -120 50)') + pixel_linestring = from_wkt('LINESTRING (1099.1941683923565 324.546444238068,' + '768.0092501944506 794.3170139903758,' + '509.1550445412777 1305.9671045297775)') + result = geographic_linestring_to_pixel(linestring, grid_proj) +> assert result == pixel_linestring +E assert <LINESTRING (1097.724 326.579, 767.38 797.352, 509.396 1309.283)> == <LINESTRING (1099.194 324.546, 768.009 794.317, 509.155 1305.967)> + +test/test_vectaster.py:55: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecef6e110> + + def test_geographic_polygon_to_pixel(grid_proj: GridProj): + poly = from_wkt('POLYGON ((-105 40, -110 40, -110 50, -105 50, -105 40), ' + '(-107 42, -107 47, -108 47, -108 42, -107 42))') + pixel_poly = from_wkt('POLYGON ((941.5576426719887 778.2701810387533,' + '768.0092501944506 794.3170139903758,' + '819.7238357524881 1259.816223819563,' + '976.0731562314586 1245.359671430866,' + '941.5576426719887 778.2701810387533),' + '(880.1253951755987 874.7112000835223,' + '900.7222774204608 1106.8022369109524,' + '868.391509125368 1109.7916419444564,' + '846.0832806150518 877.8588416022637,' + '880.1253951755987 874.7112000835223))') + result = geographic_polygon_to_pixel(poly, grid_proj) +> assert result == pixel_poly +E assert <POLYGON ((940.528 781.343, 767.38 797.352, 819.14 1263.254, 975.074 1248.83...> == <POLYGON ((941.558 778.27, 768.009 794.317, 819.724 1259.816, 976.073 1245.3...> + +test/test_vectaster.py:72: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecf361710> + + def test_rasterize_point(grid_proj: GridProj): + point = 'POINT (-100.5 30.5)' + pixels = (numpy.array([1081]), numpy.array([347])) + result = rasterize_point(point, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) -test/test_geo_image.py:232: +test/test_vectaster.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ -args = (<built-in function eq>, array([7385, 115]), [7392, 108]) +args = (<built-in function eq>, (array([1079]), array([349])), (array([1081]), array([347]))) kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} @wraps(func) @@ -36,9 +373,167 @@ E AssertionError: E Arrays are not equal E E Mismatched elements: 2 / 2 (100%) -E Max absolute difference: 7 -E Max relative difference: 0.06481481 -E x: array([7385, 115]) -E y: array([7392, 108]) +E Max absolute difference: 2 +E Max relative difference: 0.00576369 +E x: array([[1079], +E [ 349]]) +E y: array([[1081], +E [ 347]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecefeb6d0> + + def test_rasterize_point_from_coord(grid_proj: GridProj): + point = (-100.5, 30.5) + pixels = (numpy.array([1081]), numpy.array([347])) + result = rasterize_point(point, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:108: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<built-in function eq>, (array([1079]), array([349])), (array([1081]), array([347]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 2 / 2 (100%) +E Max absolute difference: 2 +E Max relative difference: 0.00576369 +E x: array([[1079], +E [ 349]]) +E y: array([[1081], +E [ 347]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecef7bad0> + + def test_rasterize_linestring(grid_proj: GridProj): + linestring = 'LINESTRING (-100 30, -100.1 30.1, -100.2 30)' + pixels = (numpy.array([1099, 1098, 1097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091]), + numpy.array([324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324])) + result = rasterize_linestring(linestring, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:129: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<built-in function eq>, (array([1097, 1096, 1096, 1095, 1095, 1094, 1093, 1092, 1092, 1091, 1090]), array([326, 327, ...097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091]), array([324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 22 / 22 (100%) +E Max absolute difference: 2 +E Max relative difference: 0.00617284 +E x: array([[1097, 1096, 1096, 1095, 1095, 1094, 1093, 1092, 1092, 1091, 1090], +E [ 326, 327, 328, 329, 330, 331, 330, 329, 328, 327, 326]]) +E y: array([[1099, 1098, 1097, 1097, 1096, 1095, 1094, 1093, 1093, 1092, 1091], +E [ 324, 325, 326, 327, 328, 329, 328, 327, 326, 325, 324]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecef6e910> + + def test_rasterize_linestring_from_coords(grid_proj: GridProj): + linestring = [(-100, 30), (-100.01, 30.02), (-100.02, 30)] + pixels = (numpy.array([1099, 1098, 1098]), numpy.array([324, 325, 324])) + result = rasterize_linestring(linestring, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:136: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<built-in function eq>, (array([1097, 1097, 1096]), array([326, 327, 326])), (array([1099, 1098, 1098]), array([324, 325, 324]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 6 / 6 (100%) +E Max absolute difference: 2 +E Max relative difference: 0.00617284 +E x: array([[1097, 1097, 1096], +E [ 326, 327, 326]]) +E y: array([[1099, 1098, 1098], +E [ 324, 325, 324]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecf360cd0> + + def test_rasterize_polygon__(grid_proj: GridProj): + poly = 'POLYGON ((-105 40, -105.1 40, -105.1 40.1, -105 40.1, -105 40))' + pixels = (numpy.array([938, 939, 940, 941, 938, 939, 940, 941, 938, 939, 940, + 941, 938, 939, 940, 941, 938, 939, 940, 941, 941, 938]), + numpy.array([778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, + 780, 781, 781, 781, 781, 782, 782, 782, 782, 782, 783])) + result = rasterize_polygon(poly, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:146: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<built-in function eq>, (array([937, 938, 939, 940, 937, 938, 939, 940, 937, 938, 939, 940, 937, + 938, 939, 940...778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, 780, 781, + 781, 781, 781, 782, 782, 782, 782, 782, 783]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 44 / 44 (100%) +E Max absolute difference: 3 +E Max relative difference: 0.00385604 +E x: array([[937, 938, 939, 940, 937, 938, 939, 940, 937, 938, 939, 940, 937, +E 938, 939, 940, 937, 938, 939, 940, 940, 937], +E [781, 781, 781, 781, 782, 782, 782, 782, 783, 783, 783, 783, 784, +E 784, 784, 784, 785, 785, 785, 785, 785, 786]]) +E y: array([[938, 939, 940, 941, 938, 939, 940, 941, 938, 939, 940, 941, 938, +E 939, 940, 941, 938, 939, 940, 941, 941, 938], +E [778, 778, 778, 778, 779, 779, 779, 779, 780, 780, 780, 780, 781, +E 781, 781, 781, 782, 782, 782, 782, 782, 783]]) + +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionErrorgrid_proj = <idsse.common.grid_proj.GridProj object at 0x7feecf352010> + + def test_rasterize_polygon_from_coords(grid_proj: GridProj): + poly = (((-105, 40), (-105.1, 40), (-105.1, 40.1), (-105, 40)),) + pixels = (numpy.array([938, 939, 940, 941, 938, 939, 940, 938, 939, 938, 939, 938, 938]), + numpy.array([778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783])) + result = rasterize_polygon(poly, grid_proj) +> numpy.testing.assert_array_equal(result, pixels) + +test/test_vectaster.py:154: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +args = (<built-in function eq>, (array([937, 938, 939, 940, 937, 938, 939, 937, 938, 937, 938, 937, 937]), array([781, 781, 7...8, 939, 940, 938, 939, 938, 939, 938, 938]), array([778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783]))) +kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} + + @wraps(func) + def inner(*args, **kwds): + with self._recreate_cm(): +> return func(*args, **kwds) +E AssertionError: +E Arrays are not equal +E +E Mismatched elements: 26 / 26 (100%) +E Max absolute difference: 3 +E Max relative difference: 0.00385604 +E x: array([[937, 938, 939, 940, 937, 938, 939, 937, 938, 937, 938, 937, 937], +E [781, 781, 781, 781, 782, 782, 782, 783, 783, 784, 784, 785, 786]]) +E y: array([[938, 939, 940, 941, 938, 939, 940, 938, 939, 938, 939, 938, 938], +E [778, 778, 778, 778, 779, 779, 779, 780, 780, 781, 781, 782, 783]]) -/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError \ No newline at end of file +/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/contextlib.py:81: AssertionError \ No newline at end of file