def test_fill_shapefile_dict1(): # expected values to test with actual values expected = {"extents": (1551876.4646765331, 1813149.8783592982, 1873153.3560966868, 2513535.4955471633), "name": "test_poly_nad83.shp", "fields": ["Id"], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\basins", "num_features": 1, "type": "POLYGON", "spatialref": "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs "} # Open the shapefiles basin_shapefile = osgeo.ogr.Open(fixture["test_poly_nad83"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = basin_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)
def test_fill_shapefile_dict2(): # expected values to test with actual values expected = {"extents": (-76.86408896229705, -73.50137064718774, 38.33140005688863, 43.98678328958175), "name": "test_poly_wgs84.shp", "fields": ["Id"], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\basins", "num_features": 1, "type": "POLYGON", "spatialref": "+proj=longlat +datum=WGS84 +no_defs "} # Open the shapefiles basin_shapefile = osgeo.ogr.Open(fixture["test_poly_wgs84"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = basin_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)
def test_fill_shapefile_dict7(): # expected values to test with actual values expected = {"extents": (-74.88702164959378, -74.44895756386826, 41.86688996255413, 42.31789523609384), "name": "wateruse_centroids_sample_wgs84.shp", "fields": ["newhydroid", "HUC_12"], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\wateruse-centroids", "num_features": 8, "type": "POINT", "spatialref": "+proj=longlat +datum=WGS84 +no_defs "} # Open the shapefiles wateruse_centroids_sample_shapefile = osgeo.ogr.Open(fixture["wateruse_centroids_sample_wgs84"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = wateruse_centroids_sample_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)
def test_fill_shapefile_dict6(): # expected values to test with actual values expected = {"extents": (-77.34375265636656, -71.71875035838741, 36.27781521345216, 44.64950905729846), "name": "CanES_wgs84.shp", "fields": ["OBJECTID", "SHAPE_Leng", "SHAPE_Area", "TileDRB", "Tile"], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\gcm-tiles", "num_features": 6, "type": "POLYGON", "spatialref": "+proj=longlat +datum=WGS84 +no_defs "} # Open the shapefiles canes_shapefile = osgeo.ogr.Open(fixture["canes_wgs84"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = canes_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)
def test_fill_shapefile_dict5(): # expected values to test with actual values expected = {"extents": (1667931.2626998292, 1667931.2626998292, 2121671.340300318, 2121671.340300318), "name": "water_basin_pourpoint_nad83.shp", "fields": ['OBJECTID', 'POINTID', 'GRID_CODE'], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\basins", "num_features": 1, "type": "POINT", "spatialref": "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs "} # Open the shapefiles basin_shapefile = osgeo.ogr.Open(fixture["water_basin_pourpoint_nad83"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = basin_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)
def test_fill_shapefile_dict4(): # expected values to test with actual values expected = {"extents": (-76.3557164298209, -75.83406785380727, 40.52224451815593, 40.89012237818175), "name": "water_basin_wgs84.shp", "fields": ['OBJECTID', 'Id', 'Shape_Leng', 'Shape_Area'], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\basins", "num_features": 1, "type": "POLYGON", "spatialref": "+proj=longlat +datum=WGS84 +no_defs "} # Open the shapefiles basin_shapefile = osgeo.ogr.Open(fixture["water_basin_wgs84"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = basin_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)
def test_fill_shapefile_dict3(): # expected values to test with actual values expected = {"extents": (1634846.262699829, 1674156.2626998313, 2118676.340300313, 2162946.3403003197), "name": "water_basin_nad83.shp", "fields": ['OBJECTID', 'Id', 'Shape_Leng', 'Shape_Area'], "shapefile_datatype": "<class 'osgeo.ogr.DataSource'>", "path": "\\data\\spatial-datafiles\\basins", "num_features": 1, "type": "POLYGON", "spatialref": "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs "} # Open the shapefiles basin_shapefile = osgeo.ogr.Open(fixture["water_basin_nad83"]) # actual values actual = spatialvectors.fill_shapefile_dict(shapefile = basin_shapefile) actual["path"] = actual["path"].split("waterapputils")[1] # remove dependency of full root path np.testing.assert_equal(actual, expected)