-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor and enhance geometries handling with Shapely #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
…ialized matrix instead of nans. removed warnings for max in stats computation
out_of_bounds_mode can be set to "raise" or "ignore". It will throw PropagatorOutOfBoundsError when reaching the boundaries of the simulation if in "raise" mode.
…dy defined actions
- Structured tile metadata with TileReference and AxisCoverage dataclasses to replace unpacked tuples and centralize slice math, improving readability around window selection - Rebuilt load_tile to use pathlib, shared loaders, and richer error messages while still supporting .mat/.tif fallbacks and returning contiguous arrays - Simplified get_dem/get_veg and the tiling pipeline to reuse the generalized mosaic assembly helpers, eliminating the axis-specific branching and keeping outputs contiguous with explicit dtypes
fix typings for literals and add type:ignore when needed change example.py to a simpler streamlined example
mirkodandrea
added a commit
that referenced
this pull request
Oct 24, 2025
* build: add pre-commit, configured it, installed hooks and ran "run --all-files" * build: add ruff format and check to pre-commit * fix: mean values are 0 in case no info provided * feat: added option of disabling spotting from propagator settings * feat: added realizations number as constant * feat: added d1 and moisture as optional for fuel * feat:statistics in hectares * fix: moisture clipped in 0-1 range * fix:fixed computation of output to consider nan values properly * fix: removed reverence to cells area on statistics * added some comments and function's description * added some description on functions and option of cellsize in configuration * removed deprecated file * added option of isochrones thresholds from command line * return statistics oin squared meters * set example files * chore: add AGENTS.md * tests: add tests for propagator.core * chore: cleanup * added examples * chore: update .gitignore and add VSCode settings for tests * fixed lauch file for debugging * fix: removed model validation until it is fixed * fix: bug on bc initialization * chore: cleanup * feat: added option to switch to geotiff mode if dem and fuel are specified * chore: update vscode settings * Refactor and enhance geometries handling with Shapely (#5) * refactor: fix types * refactor: wip pydantic to shapely geometries * feat: add types-shapely dependency for improved type hinting * refactor: simpler actions parsing, use shapely geoms everywhere * chore: update launch configurations * fix: solves problem with heavy actions rasterizing to a np.zeros initialized matrix instead of nans. removed warnings for max in stats computation * fix: added option of point also with sqare brakets * feat: added default threshold levels for isochrones * fix: added weather conditions in boundary conditions as optional * fix: removed hardocoded boundaries in dataloader * refactor: better out of bounds handling out_of_bounds_mode can be set to "raise" or "ignore". It will throw PropagatorOutOfBoundsError when reaching the boundaries of the simulation if in "raise" mode. * chore: add types * updated agents.md * fix: update action parsing to handle legacy fields and merge to already defined actions * feat: added default options of ROS model and fuel moisture effect on constants * modified params for testing * fix: corrected wind direction from boundary conditions to the model convention * feat: added some print in the main * feat: separated cli from config , which comes from a separated file * fix: modify order of configuration parameters for readibility * fix: modified order of fields in configuration * fix: removed deprecated commented code * feat: added extra printing for the console * feat: added sh file for cache cleaning * fix: adjusted point print in the console * feat: added formatted printing for cli console * fix: removed 0.95 isochrones fro coherence with default statistics * fix: changed name from params to config for coherence * refactor: better tiles loading code - Structured tile metadata with TileReference and AxisCoverage dataclasses to replace unpacked tuples and centralize slice math, improving readability around window selection - Rebuilt load_tile to use pathlib, shared loaders, and richer error messages while still supporting .mat/.tif fallbacks and returning contiguous arrays - Simplified get_dem/get_veg and the tiling pipeline to reuse the generalized mosaic assembly helpers, eliminating the axis-specific branching and keeping outputs contiguous with explicit dtypes * test: fix tests after code updates * refactor: align internal wind angle representation to meteorological conventions * chore: cleanup and fixes fix typings for literals and add type:ignore when needed change example.py to a simpler streamlined example * refactor: update angle and wind direction descriptions to use clockwise radians --------- Co-authored-by: Perello-nico <[email protected]> * feat/time-in-seconds (#6) * feat: simulation time granularity switched from minutes to seconds - Converted configuration and boundary condition interfaces to seconds, updating defaults, docs, and metadata. - Propagation core now emits and schedules second-based times: p_time models multiply by 60, spotting returns integer seconds with a zero-wind guard, and decay logic interprets deltas per minute. - Adjusted status output and API docs to reflect second granularity . - Updated unit tests to exercise the new time base. * fix: fix typings and improve cli output * fix: invert loader priority * better cli and fix error in centroid calculation (#7) * fix: fix typings and improve cli output * fix: invert loader priority * fix: fix get_middle_point function behaviour with polygons * feat: improve cli output and add a flag for verbosity * feat: added option on cli for ou of bounds mode * feat: init_date is now UTC * feat: less verbose status messages * fix: improve example --------- Co-authored-by: Perello-nico <[email protected]>
mirkodandrea
added a commit
that referenced
this pull request
Nov 1, 2025
* build: add pre-commit, configured it, installed hooks and ran "run --all-files" * build: add ruff format and check to pre-commit * fix: mean values are 0 in case no info provided * feat: added option of disabling spotting from propagator settings * feat: added realizations number as constant * feat: added d1 and moisture as optional for fuel * feat:statistics in hectares * fix: moisture clipped in 0-1 range * fix:fixed computation of output to consider nan values properly * fix: removed reverence to cells area on statistics * added some comments and function's description * added some description on functions and option of cellsize in configuration * removed deprecated file * added option of isochrones thresholds from command line * return statistics oin squared meters * set example files * chore: add AGENTS.md * tests: add tests for propagator.core * chore: cleanup * added examples * chore: update .gitignore and add VSCode settings for tests * fixed lauch file for debugging * fix: removed model validation until it is fixed * fix: bug on bc initialization * chore: cleanup * feat: added option to switch to geotiff mode if dem and fuel are specified * chore: update vscode settings * Refactor and enhance geometries handling with Shapely (#5) * refactor: fix types * refactor: wip pydantic to shapely geometries * feat: add types-shapely dependency for improved type hinting * refactor: simpler actions parsing, use shapely geoms everywhere * chore: update launch configurations * fix: solves problem with heavy actions rasterizing to a np.zeros initialized matrix instead of nans. removed warnings for max in stats computation * fix: added option of point also with sqare brakets * feat: added default threshold levels for isochrones * fix: added weather conditions in boundary conditions as optional * fix: removed hardocoded boundaries in dataloader * refactor: better out of bounds handling out_of_bounds_mode can be set to "raise" or "ignore". It will throw PropagatorOutOfBoundsError when reaching the boundaries of the simulation if in "raise" mode. * chore: add types * updated agents.md * fix: update action parsing to handle legacy fields and merge to already defined actions * feat: added default options of ROS model and fuel moisture effect on constants * modified params for testing * fix: corrected wind direction from boundary conditions to the model convention * feat: added some print in the main * feat: separated cli from config , which comes from a separated file * fix: modify order of configuration parameters for readibility * fix: modified order of fields in configuration * fix: removed deprecated commented code * feat: added extra printing for the console * feat: added sh file for cache cleaning * fix: adjusted point print in the console * feat: added formatted printing for cli console * fix: removed 0.95 isochrones fro coherence with default statistics * fix: changed name from params to config for coherence * refactor: better tiles loading code - Structured tile metadata with TileReference and AxisCoverage dataclasses to replace unpacked tuples and centralize slice math, improving readability around window selection - Rebuilt load_tile to use pathlib, shared loaders, and richer error messages while still supporting .mat/.tif fallbacks and returning contiguous arrays - Simplified get_dem/get_veg and the tiling pipeline to reuse the generalized mosaic assembly helpers, eliminating the axis-specific branching and keeping outputs contiguous with explicit dtypes * test: fix tests after code updates * refactor: align internal wind angle representation to meteorological conventions * chore: cleanup and fixes fix typings for literals and add type:ignore when needed change example.py to a simpler streamlined example * refactor: update angle and wind direction descriptions to use clockwise radians --------- Co-authored-by: Perello-nico <[email protected]> * feat/time-in-seconds (#6) * feat: simulation time granularity switched from minutes to seconds - Converted configuration and boundary condition interfaces to seconds, updating defaults, docs, and metadata. - Propagation core now emits and schedules second-based times: p_time models multiply by 60, spotting returns integer seconds with a zero-wind guard, and decay logic interprets deltas per minute. - Adjusted status output and API docs to reflect second granularity . - Updated unit tests to exercise the new time base. * fix: fix typings and improve cli output * fix: invert loader priority * better cli and fix error in centroid calculation (#7) * fix: fix typings and improve cli output * fix: invert loader priority * fix: fix get_middle_point function behaviour with polygons * feat: improve cli output and add a flag for verbosity * feat: added option on cli for ou of bounds mode * feat: init_date is now UTC * feat: less verbose status messages * fix: improve example * fix: ensure time is an integer when logging * fix: improve time formatting in status messages * Better readme and docs (#9) * docs: improved docs content, improved mkdocs generated site * docs: update README and index * fix: enhance hero section layout and styling in documentation * build: update dependencies * Fix/remove-function-caching (#11) * Dev (#10) * fix: ensure time is an integer when logging * fix: improve time formatting in status messages * Better readme and docs (#9) * docs: improved docs content, improved mkdocs generated site * docs: update README and index * fix: enhance hero section layout and styling in documentation --------- Co-authored-by: Perello-nico <[email protected]> * fix: (tentative fix) set function caching to False to solve ReferenceError("underlying object has vanished") when using in a multiprocess environment * Stop tracking example/dem.tif with LFS * Store example/dem.tif as a regular Git file (no LFS) * fix: set jit cache=False to reduce issues with ReferenceError("underlying object has vanished") --------- Co-authored-by: Perello-nico <[email protected]> * fix: clarify simulation description in documentation --------- Co-authored-by: Perello-nico <[email protected]>
mirkodandrea
added a commit
that referenced
this pull request
Nov 5, 2025
* build: add pre-commit, configured it, installed hooks and ran "run --all-files" * build: add ruff format and check to pre-commit * fix: mean values are 0 in case no info provided * feat: added option of disabling spotting from propagator settings * feat: added realizations number as constant * feat: added d1 and moisture as optional for fuel * feat:statistics in hectares * fix: moisture clipped in 0-1 range * fix:fixed computation of output to consider nan values properly * fix: removed reverence to cells area on statistics * added some comments and function's description * added some description on functions and option of cellsize in configuration * removed deprecated file * added option of isochrones thresholds from command line * return statistics oin squared meters * set example files * chore: add AGENTS.md * tests: add tests for propagator.core * chore: cleanup * added examples * chore: update .gitignore and add VSCode settings for tests * fixed lauch file for debugging * fix: removed model validation until it is fixed * fix: bug on bc initialization * chore: cleanup * feat: added option to switch to geotiff mode if dem and fuel are specified * chore: update vscode settings * Refactor and enhance geometries handling with Shapely (#5) * refactor: fix types * refactor: wip pydantic to shapely geometries * feat: add types-shapely dependency for improved type hinting * refactor: simpler actions parsing, use shapely geoms everywhere * chore: update launch configurations * fix: solves problem with heavy actions rasterizing to a np.zeros initialized matrix instead of nans. removed warnings for max in stats computation * fix: added option of point also with sqare brakets * feat: added default threshold levels for isochrones * fix: added weather conditions in boundary conditions as optional * fix: removed hardocoded boundaries in dataloader * refactor: better out of bounds handling out_of_bounds_mode can be set to "raise" or "ignore". It will throw PropagatorOutOfBoundsError when reaching the boundaries of the simulation if in "raise" mode. * chore: add types * updated agents.md * fix: update action parsing to handle legacy fields and merge to already defined actions * feat: added default options of ROS model and fuel moisture effect on constants * modified params for testing * fix: corrected wind direction from boundary conditions to the model convention * feat: added some print in the main * feat: separated cli from config , which comes from a separated file * fix: modify order of configuration parameters for readibility * fix: modified order of fields in configuration * fix: removed deprecated commented code * feat: added extra printing for the console * feat: added sh file for cache cleaning * fix: adjusted point print in the console * feat: added formatted printing for cli console * fix: removed 0.95 isochrones fro coherence with default statistics * fix: changed name from params to config for coherence * refactor: better tiles loading code - Structured tile metadata with TileReference and AxisCoverage dataclasses to replace unpacked tuples and centralize slice math, improving readability around window selection - Rebuilt load_tile to use pathlib, shared loaders, and richer error messages while still supporting .mat/.tif fallbacks and returning contiguous arrays - Simplified get_dem/get_veg and the tiling pipeline to reuse the generalized mosaic assembly helpers, eliminating the axis-specific branching and keeping outputs contiguous with explicit dtypes * test: fix tests after code updates * refactor: align internal wind angle representation to meteorological conventions * chore: cleanup and fixes fix typings for literals and add type:ignore when needed change example.py to a simpler streamlined example * refactor: update angle and wind direction descriptions to use clockwise radians --------- Co-authored-by: Perello-nico <[email protected]> * feat/time-in-seconds (#6) * feat: simulation time granularity switched from minutes to seconds - Converted configuration and boundary condition interfaces to seconds, updating defaults, docs, and metadata. - Propagation core now emits and schedules second-based times: p_time models multiply by 60, spotting returns integer seconds with a zero-wind guard, and decay logic interprets deltas per minute. - Adjusted status output and API docs to reflect second granularity . - Updated unit tests to exercise the new time base. * fix: fix typings and improve cli output * fix: invert loader priority * better cli and fix error in centroid calculation (#7) * fix: fix typings and improve cli output * fix: invert loader priority * fix: fix get_middle_point function behaviour with polygons * feat: improve cli output and add a flag for verbosity * feat: added option on cli for ou of bounds mode * feat: init_date is now UTC * feat: less verbose status messages * fix: improve example * fix: ensure time is an integer when logging * fix: improve time formatting in status messages * Better readme and docs (#9) * docs: improved docs content, improved mkdocs generated site * docs: update README and index * fix: enhance hero section layout and styling in documentation * build: update dependencies * Fix/remove-function-caching (#11) * Dev (#10) * fix: ensure time is an integer when logging * fix: improve time formatting in status messages * Better readme and docs (#9) * docs: improved docs content, improved mkdocs generated site * docs: update README and index * fix: enhance hero section layout and styling in documentation --------- Co-authored-by: Perello-nico <[email protected]> * fix: (tentative fix) set function caching to False to solve ReferenceError("underlying object has vanished") when using in a multiprocess environment * Stop tracking example/dem.tif with LFS * Store example/dem.tif as a regular Git file (no LFS) * fix: set jit cache=False to reduce issues with ReferenceError("underlying object has vanished") --------- Co-authored-by: Perello-nico <[email protected]> * fix: clarify simulation description in documentation * Feat/3d ignition mask (#13) * feat: 3d ignition masks in boundary conditions * improved examples * Update src/propagator/core/propagator.py Co-authored-by: Copilot <[email protected]> * Update src/propagator/core/propagator.py Co-authored-by: Copilot <[email protected]> * Update example/example_stochastic_ignitions.py Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> * refactor: simplify boundary conditions declaration for scalar values (#14) * refactor: simplify usage of scalar value boundary conditions fields, pass ignitions as tuples * simplify example * expand examples * cleanup gitignore * feat: add validation for ignition formats in BoundaryConditions --------- Co-authored-by: Perello-nico <[email protected]> Co-authored-by: Copilot <[email protected]>
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.
Refactor geometry handling by using Shapely objects.
Address various bugs related to action parsing and boundary conditions, while enhancing configuration readability and adding default options for models.
Change internal angles representation and make it coherent with meteorological conventions
Include a script for cleaning Python cache files.