big push with a lot of changes, features, and pip preparation - #12
big push with a lot of changes, features, and pip preparation#12oscarfasanchez wants to merge 69 commits into
Conversation
…ut still not implemented the last one
…nto optional_densify_simplify
…et of variables for magic numbers
…s in engine which is a big rework to do
…nodes, but still need refinement
…xponential field not being applied
…ms in the original data
…ing and other issues
…in, to avoid fields effect, defers non embedded polygons to avoid conflicts in cleaning, changes closest point to is inside to identify which points are inside.
The auto-embed counter had a never-executed 'if False' expression left over from development, immediately overwritten by the real loop below it. Note: all [DIAG] blocks were verified to already be gated behind verbosity >= 2, so no output changes here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Mark DistanceField and ConstantField docstrings as internal (ConstantField previously said 'Public/manual' despite not being exported and ignoring tags_dict; DistanceField's create() signature is incompatible with the user-facing fields= path) - Remove ThresholdField.create's constant_in parameter: declared but never read in the body, and never passed by any caller in src/tests/examples Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…one statuses README: install via extras ([examples] for matplotlib, [dev] for tooling), add projected-CRS warning for MODFLOW grids, link examples/, ROADMAP, and LICENSE. ROADMAP: mark all five gmshflow-porting milestones as implemented, with pointers to the shipped APIs and examples. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- New vorflow._log module: package logger with plain message formatting and set_verbosity(0/1/2) mapping to WARNING/INFO/DEBUG. Exported as vorflow.set_verbosity; package default is 1 (progress messages, matching the historical print output). - All 115 print() sites across blueprint/engine/fields/tessellator/utils converted: [DIAG] diagnostics -> debug, Warning:/Error: messages -> warning/error, progress messages -> info. - MeshGenerator(verbosity=...) now also drives the package logger, so verbosity=0 is genuinely silent (as its docstring always promised) while warnings and errors still show. - The boundary-curve fallback message in fields.py is now an unconditional logger.warning instead of being gated behind a plumbed-through verbosity flag. Users can silence, re-level, or redirect all vorflow output via vorflow.set_verbosity() or standard logging handlers on the 'vorflow' logger. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All nine 'except Exception: pass' blocks in the tag-tracking collectors (pre/post removeAllDuplicates and healShapes snapshots, embed candidate pool, adjacency checks) now emit logger.debug with the entity involved, so lost feature tags can be traced at verbosity=2 instead of vanishing. Also collapses the three per-dimension pre-heal snapshot branches into one. No behavior change: the same fallbacks apply, failures are just visible. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lently - check_geometry_resolution() now returns the normal stats dict (with NaN values and count=0) plus a UserWarning when no segments exist, instead of returning a bare string that crashed dict-indexing callers. - VoronoiTessellator now warns (with a hint about the likely cause) whenever it returns an empty grid: too few generator nodes, no nodes from the mesher, or no domain geometry to clip against. Return types are unchanged, so existing scripts keep working -- the failure is just no longer disguised as success. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mesh sizes (resolution, background_lc, buffer thicknesses) are in CRS units and MODFLOW needs real length units, so meshing in lat/lon degrees is almost certainly a user error. ConceptualMesh now warns (with a to_crs() hint) when the declared CRS is geographic, checked via pyproj which ships with geopandas. The default crs changes from "EPSG:4326" to None (local/unspecified coordinates): synthetic models are no longer mislabeled as WGS84 lat/lon, and their outputs carry no CRS instead of a wrong one. Scripts that pass crs= explicitly are unaffected. This also removes the spurious geopandas 'geographic CRS' warnings the old default caused throughout the test suite (67 -> 50 warnings). Adds TestCrsHandling covering the warning, the silent projected/None paths, and CRS propagation to outputs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The virtual-straddle path estimated the local line direction with fixed absolute steps (0.01 forward, 0.001 endpoint threshold, in CRS units). That blended directions across corners of lines shorter than ~0.01 units and was meaningless across CRS unit scales. The logic is extracted into _unit_tangent(line, d, probe) with the probe chosen as length * 1e-4, so straddle offsets are CRS-unit independent. Degenerate (zero-length) lines now get a valid perpendicular pair instead of two coincident points. Adds TestUnitTangent regression tests covering straight lines, corner-respecting short L-shapes, unit magnitude, and the degenerate case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Makes the existing dict[int, tuple[...]] / X | None annotations safe on the full supported Python range regardless of where they appear, and converts the two remaining typing.Optional usages in utils.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…low marks - tests/conftest.py: single shared autouse ensure_gmsh_finalized fixture, replacing five identical copies. - New tests/test_fields.py (17 tests): every field class verified against the gmsh options it actually sets (Threshold Size/Dist options, MathEval expressions, AutoLinearField transition math, polygon-interior Min combination, None/invalid-parameter paths, equality grouping). - test_utils.py: check_geometry_resolution (stats + warning path), resample_geometry (spacing, holes, passthrough), summarize_quality report content via caplog. - test_voronoi_tessellator.py: export_to_shapefile round-trip via tmp_path and the no-grid no-op. - Buffer test helper now asserts nodes exist and element area matches the domain instead of only 'generate() returned truthy'. - gmsh-heavy modules marked pytest.mark.slow (registered in pyproject); '-m "not slow"' gives an 87-test fast lane (~2s). Suite: 124 -> 150 tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CI (.github/workflows/python-app.yml): - New lint job running 'ruff check src tests' - Test matrix now covers Python 3.10/3.11/3.12 (matching requires-python) - pytest runs with --cov=vorflow (pytest-cov comes via the [dev] extra) - Dropped the stale feat_tests branch trigger Code (40 findings -> 0): - Removed 20 unused imports and 4 unused variables - Expanded one-line 'if x: return' statements (E701) - Renamed ambiguous 'l' loop variables (E741) - Replaced '== True' comparisons: plain bool simplified; the pandas is_barrier mask now uses .fillna(False).astype(bool) which preserves the old NaN-is-False semantics explicitly - __init__.py import order exempted from E402 in pyproject (set_verbosity must run before submodule imports) Local coverage baseline: 80% total (fields 93%, blueprint 87%, engine 79%). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…aths - tessellator: the inset_mirror boundary-spacing step built a dense N x N distance matrix (quadratic memory -- ~20 GB at 50k boundary nodes). Now a scipy cKDTree query against de-duplicated coordinates returns the nearest distinct neighbor, matching the old nearest-nonzero semantics exactly. - blueprint: the two clip-to-domain loops now use shapely prepared geometry - a cheap intersects() skips fully-outside features and covers() short-circuits fully-inside ones (the common case), avoiding the full boolean intersection per feature. Identical outputs, verified by the existing inset_mirror and clipping tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The two most self-contained stages of the ~1,500-line _add_geometry -- the post-removeAllDuplicates coordinate remap and the healShapes + coordinate-based remap -- are now private methods: - _dedup_and_remap_fragment_map(out_map, object_tags, input_tag_info) - _heal_and_remap_fragment_map(...) (also owns the OCC synchronize) The trivial to_key closure is promoted to module-level _to_key so the extracted stages don't depend on _add_geometry locals. Bodies are moved verbatim; both stages mutate out_map in place exactly as before, and no variables crossed the extraction seams (verified). Behavior covered by the 35 point-tracking regression tests. First step of the planned MeshGenerator decomposition; the geometry creation loop and embedding stages remain candidates for later extraction. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…the factor I assumed before and simplified the equation
|
Thanks for this — the feature work here is substantial and the test suite going from ~10 to 204 tests is a big step up. I ran it locally: Given the size (13k additions, 49 files), I've split my feedback into things I think need resolving before merge and things that can follow up. Needs resolving before merge1. Release metadata points at the fork
Repository = "https://github.com/oscarfasanchez/vorflow_os"
Issues = "https://github.com/oscarfasanchez/vorflow_os/issues"
Changelog = "https://github.com/oscarfasanchez/vorflow_os/blob/main/CHANGELOG.md"If we merge and tag from here, we'd publish a package named This also affects TestPyPI trusted publishing, which is configured per-repository, so Three files assert these values, so
Happy to talk through how you'd like attribution handled — you've clearly done the bulk of the work here and I want that reflected properly. Just need the canonical URLs to be this repo. 2.
|
|
Second pass — full read of the implementation ( Everything below is code this PR introduces. Four things I found are pre-existing on Items marked verified I reproduced locally. CorrectnessPoint deduplication is asymmetric, and the docstring describes different behaviour — verified
What actually happens is that a point with # A: fine point carries the tolerance
cm.add_point(Point(0,0), 'fine', resolution=1, simplify_tolerance=10)
cm.add_point(Point(5,0), 'coarse', resolution=2)
# -> ['fine', 'coarse'] both kept
# B: coarse point carries the tolerance
cm.add_point(Point(0,0), 'fine', resolution=1)
cm.add_point(Point(5,0), 'coarse', resolution=2, simplify_tolerance=10)
# -> ['fine'] mergedSame two positions, same separation, same tolerance value, opposite outcome. Case A also contradicts the docstring directly. A symmetric rule — merge when the distance is under either point's tolerance, keep the finer — would match what's documented. Failed embeddings are silent
If a point feature fails to embed, there is no mesh node at that location, so no Voronoi cell centred on it. For a well or an observation point that is a silent correctness failure — the user has no signal that the feature didn't make it into the grid, and the grid looks perfectly fine.
Orphan-surface recovery has no distance guard
if owner is None and embedded_polys:
owner = min(embedded_polys, key=lambda item: item[1].distance(center))[0]it attaches to the nearest polygon at any distance, reported only at INFO. That surface then enters Coordinate remapping uses buckets rather than a tolerance
coord_key = (round(bb[0], 6), round(bb[1], 6), round(bb[2], 6)) # dedup
_HEAL_ROUND = 4 # heal
A
Minor: the comment at line 519 calls
|
This pull request prepares the
vorflowproject for its first public release candidate (0.1.0rc1) with a focus on packaging, testing, and documentation improvements. It adds a changelog, a detailed project roadmap, and refines the README with clearer installation and usage instructions. The CI pipeline is enhanced with minimum dependency testing, linting, and coverage reporting. Additionally, a new workflow automates publishing release candidates to TestPyPI.Release preparation and documentation:
CHANGELOG.mdfollowing Keep a Changelog and Semantic Versioning, documenting all notable changes for0.1.0rc1.ROADMAP.mdand milestone documents underdocs/roadmap/, outlining ported features, decisions, and verification steps for the release. [1] [2] [3]README.mdwith clearer installation instructions (including pip and development modes), usage examples, and explanations for mesh gradation and coordinate systems. [1] [2]Continuous integration and testing enhancements:
.github/workflows/python-app.ymlto:lintjob using Ruff for code style checks.minimum-dependenciesjob to verify the package works with minimum supported versions of core dependencies. [1] [2]Packaging and distribution:
.github/workflows/testpypi.ymlto automate building and publishing release candidates (tags matchingv*rc*) to TestPyPI, including build verification, metadata checks, and a smoke test of the built wheel.MANIFEST.into exclude development artifacts and documentation from source distributions.These changes collectively ensure robust packaging, testing, and documentation for the first public release candidate of
vorflow.