File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727import numpy as np
2828import pandas as pd
2929import xarray as xr
30- from shapely .geometry import LineString , MultiLineString , Point
30+ from cartopy .io import shapereader
31+ from shapely .geometry import LineString , MultiLineString
3132
3233import climada .hazard .tc_tracks as tc
3334import climada .util .coordinates as u_coord
@@ -1278,8 +1279,16 @@ def test_tracks_in_exp_pass(self):
12781279 storms = {"in" : "2000233N12316" , "out" : "2000160N21267" }
12791280 tc_track = tc .TCTracks .from_ibtracs_netcdf (storm_id = list (storms .values ()))
12801281
1281- # Define exposure from geopandas
1282- world = gpd .read_file (gpd .datasets .get_path ("naturalearth_lowres" ))
1282+ # Define exposure from shapefile.natural_earth
1283+ shape_file = shapereader .Reader (
1284+ shapereader .natural_earth (
1285+ resolution = "110m" , category = "cultural" , name = "admin_0_countries"
1286+ )
1287+ )
1288+ world = gpd .GeoDataFrame (
1289+ data = [cntry .attributes for cntry in shape_file .records ()],
1290+ geometry = [cntry .geometry for cntry in shape_file .records ()],
1291+ ).rename (columns = lambda col : col .lower ())
12831292 exp_world = Exposures (world )
12841293 exp = Exposures (exp_world .gdf [exp_world .gdf ["name" ] == "Cuba" ])
12851294
You can’t perform that action at this time.
0 commit comments