@@ -193,7 +193,13 @@ USGS 1 arc-second n36w077 1 x 1 degree
193193We remove the flag and rerun r.in.usgs to actually download and import the data. We filter the data to only include the tiles with "degree" in the title name.
194194
195195``` {python}
196- tools.r_in_usgs(product="ned", output_name="ned", ned_dataset="ned1sec", title_filter="degree", nprocs=2)
196+ tools.r_in_usgs(
197+ product="ned",
198+ output_name="ned",
199+ ned_dataset="ned1sec",
200+ title_filter="degree",
201+ nprocs=2,
202+ )
197203```
198204
199205Let's look at the data we just downloaded. We will display only elevation values larger than 0:
@@ -318,18 +324,16 @@ point_fetch = tools.r_windfetch(
318324 step=1,
319325 minor_directions=9,
320326 minor_step=3,
321- flags="c"
327+ flags="c",
322328)[0]
323-
324329```
325330
326331We convert the r.windfetch output into a Pandas DataFrame for easier inspection. Each row corresponds to a direction and its computed fetch length (in meters).
327332
328333``` {python}
329- fetch_df = pd.DataFrame({
330- "directions": point_fetch["directions"],
331- "fetch": point_fetch["fetch"]
332- })
334+ fetch_df = pd.DataFrame(
335+ {"directions": point_fetch["directions"], "fetch": point_fetch["fetch"]}
336+ )
333337fetch_df
334338```
335339
@@ -432,7 +436,15 @@ with gs.RegionManager(vector="tract", align="land"):
432436Next, we compute the wind fetch for each point in the vector map using the SPM setting.
433437
434438``` {python}
435- points_fetch = tools.r_windfetch(input="land", points="points", format="json", step=1, minor_directions=9, minor_step=3, flags="c")
439+ points_fetch = tools.r_windfetch(
440+ input="land",
441+ points="points",
442+ format="json",
443+ step=1,
444+ minor_directions=9,
445+ minor_step=3,
446+ flags="c",
447+ )
436448```
437449
438450Similarly to the previous example, we will load fetch data into a Pandas DataFrame.
@@ -467,8 +479,16 @@ Then we will export the vector map to GeoJSON, ensuring the CRS is set to EPSG:4
467479
468480``` {python}
469481merged_df.to_csv("results.txt", index=False)
470- tools.v_in_ascii(input="results.txt", output="results", separator="comma", columns="x double, y double, fetch double", skip=1)
471- tools.v_out_ogr(input="results", output="results.json", format="GeoJSON", lco="RFC7946=YES")
482+ tools.v_in_ascii(
483+ input="results.txt",
484+ output="results",
485+ separator="comma",
486+ columns="x double, y double, fetch double",
487+ skip=1,
488+ )
489+ tools.v_out_ogr(
490+ input="results", output="results.json", format="GeoJSON", lco="RFC7946=YES"
491+ )
472492```
473493
474494
@@ -488,7 +508,11 @@ colormap = cm.linear.YlGnBu_07.scale(values.min(), values.max())
488508colormap.caption = "Weighted Fetch"
489509
490510# Center map at the mean location
491- m = folium.Map(location=[gdf.geometry.y.mean(), gdf.geometry.x.mean()], zoom_start=12, tiles='CartoDB positron')
511+ m = folium.Map(
512+ location=[gdf.geometry.y.mean(), gdf.geometry.x.mean()],
513+ zoom_start=12,
514+ tiles="CartoDB positron",
515+ )
492516
493517# Add points
494518for _, row in gdf.iterrows():
0 commit comments