File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 27
27
import numpy as np
28
28
import pandas as pd
29
29
import xarray as xr
30
- from shapely .geometry import LineString , MultiLineString , Point
30
+ from cartopy .io import shapereader
31
+ from shapely .geometry import LineString , MultiLineString
31
32
32
33
import climada .hazard .tc_tracks as tc
33
34
import climada .util .coordinates as u_coord
@@ -1278,8 +1279,16 @@ def test_tracks_in_exp_pass(self):
1278
1279
storms = {"in" : "2000233N12316" , "out" : "2000160N21267" }
1279
1280
tc_track = tc .TCTracks .from_ibtracs_netcdf (storm_id = list (storms .values ()))
1280
1281
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 ())
1283
1292
exp_world = Exposures (world )
1284
1293
exp = Exposures (exp_world .gdf [exp_world .gdf ["name" ] == "Cuba" ])
1285
1294
You can’t perform that action at this time.
0 commit comments