Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
53942e8
Merge pull request #3 from dakotaramos/develop
dakotaramos Nov 19, 2025
d57423a
Merge pull request #4 from dakotaramos/develop
dakotaramos Dec 3, 2025
d147e1d
Merge pull request #5 from dakotaramos/develop
dakotaramos Dec 16, 2025
d2920ed
refactor of iron mapping functionality, need to update docs
dakotaramos Dec 16, 2025
3a02013
correcting references to local file paths, updated save file logic an…
dakotaramos Dec 16, 2025
354d063
Correcting default argument behavior and adding utilities.find_file()…
dakotaramos Dec 16, 2025
049e33a
refactored code with GeospatialMapConfig class, added doc strings, fu…
dakotaramos Dec 18, 2025
48fd67d
running pre-commit hooks
dakotaramos Dec 18, 2025
ea26194
updating bool values for default behavior
dakotaramos Dec 18, 2025
0ab7c32
Adding examples/26_iron_map
dakotaramos Dec 18, 2025
f82ccc4
correcting doc strings for GeospatialMapConfig
dakotaramos Dec 18, 2025
39ab33d
updating README.md and environment.yml with necessary conda install c…
dakotaramos Dec 18, 2025
7abddc5
Updating ore and shipping prices to $/kg
dakotaramos Dec 22, 2025
7408098
update examples/26_iron_map/run_iron.py with correct units and explic…
dakotaramos Dec 22, 2025
0c6846e
add colorbar_limits attribute to GeospatialMapConfig, added helper fu…
dakotaramos Dec 22, 2025
1878c64
correcting example_ore_prices.csv
dakotaramos Dec 23, 2025
6182724
Updating doc strings, refactored some logic to make it more readable …
dakotaramos Dec 24, 2025
9a3a4cb
added test_26_iron_map_example() in test_all_examples.py
dakotaramos Dec 26, 2025
c4a2bc5
updated pyproject.toml with geopandas and contextily in [.examples], …
dakotaramos Dec 26, 2025
b5d621e
Adding docs/user_guide docs page for iron mapping functionality
dakotaramos Dec 27, 2025
832c64e
updating docs/_toc.yml to include new docs page
dakotaramos Dec 27, 2025
ef6b4cd
resolving conflicts for merge
dakotaramos Dec 27, 2025
30ae640
Merge branch 'develop' into iron_mapping
dakotaramos Dec 27, 2025
f5868bc
updated CHANGELOG.md
dakotaramos Dec 27, 2025
8b00ada
Merge branch 'develop' into iron_mapping
kbrunik Dec 30, 2025
8b23bcd
Update docs/_toc.yml
dakotaramos Jan 14, 2026
08a6acd
resolving merge on CHANGELOG.md
dakotaramos Jan 14, 2026
28db00f
Merge branch 'develop' into iron_mapping
dakotaramos Jan 14, 2026
ca04dc4
Updating files paths to use ROOT_DIR and EXAMPLE_DIR, removed extra s…
dakotaramos Jan 14, 2026
392e9b5
correcting type in filepaths
dakotaramos Jan 14, 2026
fc86c76
updating pyproject.toml and ci.yml for failing test
dakotaramos Jan 14, 2026
dfb421e
force git tracking of cases.csv for use in pytest to avoid having to …
dakotaramos Jan 14, 2026
2a0278b
removing commented code from test_27_iron_map_example()
dakotaramos Jan 14, 2026
388c57c
updating map_preferences default value = None, removing excess inline…
dakotaramos Jan 14, 2026
935c92c
simplifying extra step to convert results geodataframes to web marcat…
dakotaramos Jan 14, 2026
d6cafc7
simplified setting of vmin and vmax
dakotaramos Jan 14, 2026
71d3417
removed unnecessary check for save_plot_fpath as Path object
dakotaramos Jan 14, 2026
d5a92fc
removing uncessary tuple brackets around string checks
dakotaramos Jan 14, 2026
052a44b
updating multiline string comments for traceback legibility
dakotaramos Jan 14, 2026
5315815
simplifying fig,ax,base_layer_gdf object check
dakotaramos Jan 14, 2026
1a9dd67
simplifying validate_gdfs_are_same_crs()
dakotaramos Jan 14, 2026
a278ead
simplifying auto_detect_lat_long_columns() logic
dakotaramos Jan 14, 2026
0ee576a
updating colorbar_limits definition and attrs validation
dakotaramos Jan 15, 2026
f8aa978
attempt to resolve failed CI test
dakotaramos Jan 15, 2026
ae1c044
Merge branch 'develop' into iron_mapping
johnjasa Jan 15, 2026
ed99152
updating example driver_config.yaml run_parallel = False
dakotaramos Jan 16, 2026
ddc495c
pulling in merge
dakotaramos Jan 16, 2026
7f54255
Merge branch 'develop' into iron_mapping
dakotaramos Jan 16, 2026
6d5e02e
Update examples/27_iron_map/run_iron.py
dakotaramos Jan 19, 2026
46b209c
Update examples/27_iron_map/run_iron.py
dakotaramos Jan 19, 2026
c380776
Update examples/27_iron_map/run_iron.py
dakotaramos Jan 19, 2026
1610e6a
Update examples/27_iron_map/run_iron.py
dakotaramos Jan 19, 2026
6788464
correcting pre-commit errors
dakotaramos Jan 19, 2026
084074e
updating colorbar_limits typing and validators to accept integers
dakotaramos Jan 20, 2026
25078ac
correcting GeospatialMapconfig instantiation
dakotaramos Jan 20, 2026
9395e3d
updating docs md
dakotaramos Jan 20, 2026
2de3f47
adding install guidance to docs md
dakotaramos Jan 20, 2026
1d9b85b
adding install guidance to docs md
dakotaramos Jan 20, 2026
51f5bc0
adding try except block for geopandas and contextily imports
dakotaramos Jan 20, 2026
b01112e
updating run_iron.py comments and adding dpi argument for saving plots
dakotaramos Jan 22, 2026
c2c46cf
correcting failed test
dakotaramos Jan 22, 2026
3faed45
adding save_plot_dpi argument to run_iron.py
dakotaramos Jan 22, 2026
98ac906
minor updates to mapping.py, added unit tests for mapping helper func…
dakotaramos Jan 22, 2026
68d217a
minor updates to mapping.py, added unit tests for mapping helper func…
dakotaramos Jan 22, 2026
e619879
Merge branch 'develop' into iron_mapping
dakotaramos Jan 23, 2026
c4a1c8d
Merge branch 'develop' into iron_mapping
johnjasa Jan 24, 2026
806bc7b
updating to examples 28
dakotaramos Jan 26, 2026
228887d
adding example 28 output cases.csv for tests
dakotaramos Jan 26, 2026
dddeee0
Merge branch 'develop' into iron_mapping
johnjasa Jan 27, 2026
e6047f0
Minor linting updates
johnjasa Jan 27, 2026
87ec7cd
Minor doc update
johnjasa Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
python -m pip install --upgrade pip
pip install git+https://github.com/NREL/HOPP@develop
if [ "${{ matrix.optional }}" = "true" ]; then
pip install ".[develop]"
pip install ".[develop,gis]"
pip install git+https://github.com/NREL/MarineCarbonManagement.git
else
pip install ".[develop]"
pip install ".[develop,gis]"
fi
- name: Create env file
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Add baseclass for caching functionality
- Added postprocessing function to save timeseries
- Minor reorg for profast tools
- Added ability to plot multi-layer geospatial point heat map and simple straight line transport routes with GeoPandas and Contextily [PR 413](https://github.com/NREL/H2Integrate/pull/413)
- Removed hydrogen tank cost and performance models that were unused
- `pyproject.toml` is tidied up after moving past Python 3.9 and early H2I limitations.
- Cleans up unnecessary ignore rules in the ruff settings.
Expand Down
1 change: 1 addition & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ parts:
- file: user_guide/how_to_interface_with_user_defined_model
- file: user_guide/how_to_run_several_cases_in_sequence
- file: ../examples/25_sizing_modes/run_size_modes
- file: user_guide/plotting_geospatial_data_with_geopandas

- caption: Technology Models
chapters:
Expand Down
Binary file added docs/user_guide/figures/example_26_iron_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 155 additions & 0 deletions docs/user_guide/plotting_geospatial_data_with_geopandas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Plotting geospatial data with GeoPandas and Contextily
Comment thread
dakotaramos marked this conversation as resolved.

When running H2Integrate simulations across a range of site locations, GeoPandas can be leveraged to plot results and create maps with multiple layers. Contextily is leveraged to add visually pleasing open source basemaps.

Currently all GIS and GeoPandas mapping functionality lives in `/H2Integrate/h2integrate/postprocess/mapping.py`

Note: to leverage this functionality users must install H2Integrate with the `gis` or `examples` modifier. ie: `pip install ".[examples]"` or `pip install ".[develop,gis]"`.

## Create a multi-layer geospatial point heat map with simple straight line transport routes

An example use case, mirroring the simulation and workflow in /examples/28_iron_map/run_iron.py, we can use GeoPandas and Contextily to create a multi-layer point heat map which displays the level costs of iron ore pellets from select mines, simplified waterway shipping routes and associated costs to transport the iron ore pellets, and the final levelized cost of iron production via Hydrogen DRI across a range of site locations.

In this example the configuration .yaml files are set such that a design of experiments is run across multiple site locations (latitude,longitude) read in from the "ned_reduced_sitelist.csv" which contains precomputed levelized cost of electricity (LCOE) and levelized cost of hydrogen (LCOH) at each location. This information is then used to calculate the levelized cost of iron production via hydrogen DRI at these locations. Upon running the model, results are saved to a "cases.sql" file.

```python
from h2integrate.postprocess.mapping import (
plot_geospatial_point_heat_map,
plot_straight_line_shipping_routes,
)
from h2integrate.core.h2integrate_model import H2IntegrateModel

model = H2IntegrateModel("iron_map.yaml")
model.run()
```

Here is an example of how we can then uses the results in cases.sql to plot a multi-layer point heat map and straight line shipping routes in one figure.

```python
# Plot the LCOI results with geopandas and contextily
# NOTE: you can swap './ex_28_out/cases.sql' with './ex_28_out/cases.csv' to read results from csv
fig, ax, lcoi_layer_gdf = plot_geospatial_point_heat_map(
case_results_fpath="./ex_28_out/cases.sql",
metric_to_plot="iron.LCOI (USD/kg)",
map_preferences={
"figsize": (10, 8),
"colorbar_label": "Levelized Cost of\nIron [$/kg]",
"colorbar_limits": (0.6, 1.0),
},
save_sql_file_to_csv=True,
)

# Add a layer for example ore cost prices from select mines
fig, ax, ore_cost_layer_gdf = plot_geospatial_point_heat_map(
case_results_fpath="./example_ore_prices.csv",
metric_to_plot="ore_cost_per_kg",
map_preferences={
"colormap": "Greens",
"marker": "o",
"colorbar_bbox_to_anchor": (0.025, 0.97, 1, 1),
"colorbar_label": "Levelized Cost of\nIron Ore Pellets\n[$/kg ore]",
"colorbar_limits": (0.11, 0.14),
},
fig=fig,
ax=ax,
base_layer_gdf=lcoi_layer_gdf,
)

# Add a layer for example waterway shipping cost from select mines to select ports
fig, ax, shipping_cost_layer_gdf = plot_geospatial_point_heat_map(
case_results_fpath="./example_shipping_prices.csv",
metric_to_plot="shipping_cost_per_kg",
map_preferences={
"colormap": "Greys",
"marker": "d",
"markersize": 80,
"colorbar_bbox_to_anchor": (0.4, 0.97, 1, 1),
"colorbar_label": "Waterway Shipping Cost\n[$/kg ore]",
"colorbar_limits": (0.11, 0.14),
},
fig=fig,
ax=ax,
base_layer_gdf=[lcoi_layer_gdf, ore_cost_layer_gdf],
)

# Define example water way shipping routes for plotting straight line transport
cleveland_route = [
"Duluth",
"Keweenaw",
"Sault St Marie",
"De Tour",
"Lake Huron",
"Port Huron",
"Erie",
"Cleveland",
]

buffalo_route = [
"Duluth",
"Keweenaw",
"Sault St Marie",
"De Tour",
"Lake Huron",
"Port Huron",
"Erie",
"Cleveland",
"Buffalo",
]

chicago_route = [
"Duluth",
"Keweenaw",
"Sault St Marie",
"De Tour",
"Mackinaw",
"Manistique",
"Chicago",
]

# Add cleveland route as layer
fig, ax, transport_layer1_gdf = plot_straight_line_shipping_routes(
shipping_coords_fpath="./example_shipping_coords.csv",
shipping_route=cleveland_route,
map_preferences={},
fig=fig,
ax=ax,
base_layer_gdf=[lcoi_layer_gdf, ore_cost_layer_gdf, shipping_cost_layer_gdf],
)

# Add buffalo route as layer
fig, ax, transport_layer2_gdf = plot_straight_line_shipping_routes(
shipping_coords_fpath="./example_shipping_coords.csv",
shipping_route=buffalo_route,
map_preferences={},
fig=fig,
ax=ax,
base_layer_gdf=[
lcoi_layer_gdf,
ore_cost_layer_gdf,
shipping_cost_layer_gdf,
transport_layer1_gdf,
],
)

# Add chicago route as layer
fig, ax, transport_layer3_gdf = plot_straight_line_shipping_routes(
shipping_coords_fpath="./example_shipping_coords.csv",
shipping_route=chicago_route,
map_preferences={"figure_title": "Example H2 DRI Iron Costs"},
fig=fig,
ax=ax,
base_layer_gdf=[
lcoi_layer_gdf,
ore_cost_layer_gdf,
shipping_cost_layer_gdf,
transport_layer1_gdf,
transport_layer2_gdf,
],
show_plot=True,
save_plot_fpath="./ex_28_out/example_28_iron_map.png",
)
```

After running the above code, a display window will show the image and the image will be saved to the specified `save_plot_fpath`.

![example_28_iron_map.png](./figures/example_28_iron_map.png)
47 changes: 47 additions & 0 deletions examples/28_iron_map/driver_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "driver_config"
description: "This analysis runs a hybrid plant to match the first example in H2Integrate"

general:
folder_output: outputs

general:
folder_output: ex_28_out
create_om_reports: false
driver:
design_of_experiments:
flag: true
debug_print: true
generator: "csvgen"
filename: "ned_reduced_sitelist.csv"
run_parallel: False
design_variables:
site:
latitude:
flag: True
units: "deg"
lower: -90.0
upper: 90.0
longitude:
flag: True
units: "deg"
lower: -180.0
upper: 180.0
iron:
LCOE:
flag: True
units: "USD/MW/h"
lower: 0
upper: 100
LCOH:
flag: True
units: "USD/kg"
lower: 0
upper: 10
objective:
name: iron.LCOI
recorder:
file: cases.sql
overwrite_recorder: true
flag: true
includes: ['site.latitude','site.longitude','iron.LCOI']
excludes: ['*']
Loading