Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new offshore bathymetry notebook contains masking/metadata logic issues that can yield incorrect suitability outputs and/or inconsistent raster write metadata.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the notebook-based data build pipeline to generate GRIDCERF data v2.1 outputs, including adding an offshore bathymetry constraint layer and improving compiled raster generation.
Changes:
- Adds a new
build_offshore_bathymetry_suitability.ipynbnotebook to generate an offshore bathymetry exclusion raster from GEBCO data. - Updates
build_compiled_suitability.ipynbto improve scenario-layer naming, simplify output directory creation, and enable DEFLATE compression when writing compiled rasters.
File summaries
| File | Description |
|---|---|
| notebooks/build_offshore_bathymetry_suitability.ipynb | New notebook to warp GEBCO bathymetry to GRIDCERF CRS/extent and produce an offshore depth suitability raster. |
| notebooks/build_compiled_suitability.ipynb | Improves compilation pipeline logic (layer renaming + directory creation) and writes compressed compiled rasters. |
Review details
Suppressed comments (1)
notebooks/build_offshore_bathymetry_suitability.ipynb:231
- The land-mask combination logic can incorrectly flip some land pixels to "suitable" when
arris already excluded (e.g., if a land cell is NaN/previously masked):arr=1+ land marker (2) becomes 3, thenarr == 2maps it to 0. Land exclusion should be an OR with the existing exclusion mask, not an equality check on a summed value.
" land_array = np.where(land_array==0, 1, 2)\n",
" \n",
" # apply land area mask\n",
" arr += land_array\n",
" arr = np.where(arr ==2, 1, 0)\n",
- Files reviewed: 2/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+206
to
+208
| " # update metadata datatype to int16\n", | ||
| " metadata = src.meta.copy()\n", | ||
| "\n", |
Comment on lines
+213
to
+223
| " arr = bath_tif.read(1)\n", | ||
| "\n", | ||
| " # make all areas with seafloor deeper than 1000m below water unsuitable\n", | ||
| " arr = np.where(arr < maximum_depth, 1, 0)\n", | ||
| " \n", | ||
| " # apply siting mask\n", | ||
| " arr += siting_mask.astype('int64')\n", | ||
| " arr = np.where(arr >= 1, 1, 0).astype(np.float64)\n", | ||
| " \n", | ||
| " # make nan excluded\n", | ||
| " arr = np.where(np.isnan(arr), 1, arr)\n", |
Comment on lines
+112
to
+113
| "# GRIDCERF source data directory for the downloaded airport data\n", | ||
| "source_dir = os.path.join(gridcerf_dir, \"source\", \"technology_specific\", 'offshore_bathymetry' )\n", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request:
build_compiled_suitability.ipynbnotebook: incorporates several improvements to code execution, output handling, and file management. The main changes include enabling compression for raster outputs, and simplifying directory creation logic.build_geothermal_resource_potential.ipynbnotebook: incorporates updated geothermal potential data to build new geothermal class rastersbuild_offshore_bathymetry_suitability.ipynbnotebook: Adds a new constraint layer for offshore wind related to bathymetry