-
Notifications
You must be signed in to change notification settings - Fork 10
maint: #995 - Jupytext Migration: Simulations - Organic + Biomass (2 long-running notebooks) #1008
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
base: main
Are you sure you want to change the base?
Conversation
Convert 2 long-running simulation notebooks to Jupytext paired sync format (.py:percent) for better version control and linting support. Changes: - Organic_Partitioning_and_Coagulation: Fixed deprecated API (organic_array → get_organic_density_array with kg/m³ to g/cm³ conversion) - Organic_Partitioning_and_Coagulation: Fixed charge array initialization (set_charge(0) → np.zeros_like(number_concentration)) - Both notebooks: Added Jupytext headers and cell markers - Both .py files: Applied ruff linting fixes Execution times: - Organic_Partitioning_and_Coagulation: 65.58s (CI only, exclude pre-commit) - Biomass_Burning_Cloud_Interactions: Has pre-existing runtime error (not caused by this migration, requires separate fix) Closes uncscode#995 ADW-ID: 44d30c2c
Update M4 migration plan and documentation guide to reflect completion of Phase 13 (Organic + Biomass notebooks) and full migration milestone. M4-jupytext-full-migration.md changes: - Mark Phase 13 as Completed with issue uncscode#995 - Document API deprecation fix (organic_array → get_organic_density_array) - Update Phase 2 status from "Not Started" to "Completed" (uncscode#984) - Remove duplicate Phase 2 section (structural cleanup) - Add execution times for Organic/Biomass notebooks (~180s, ~240s) - Add API deprecation tracking table entry - Update Phase Summary Table status - Add Change Log entries for M4-P13 and 35/35 milestone documentation_guide.md changes: - Update "Last Updated" date to 2026-01-31 - Update Jupytext section to reflect M4 migration completion (35/35) - Replace M4-P6 specific notes with comprehensive "Migration Complete" section - Add reference to M4 maintenance plan Closes uncscode#995 ADW-ID: 44d30c2c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR completes Phase 13 of the M4 Jupytext Full Migration maintenance plan by converting the final 2 long-running simulation notebooks to Jupytext paired sync format (.py:percent). The conversion includes a critical API migration fix in the Organic Partitioning notebook, updating from a deprecated density calculation API to the current public API with proper unit conversion.
Changes:
- Converted Organic_Partitioning_and_Coagulation notebook with API migration from deprecated
particula.activity.species_density.organic_arrayto currentparticula.particles.get_organic_density_array(including kg/m³ to g/cm³ unit conversion) - Converted Biomass_Burning_Cloud_Interactions notebook to paired format (no API updates needed)
- Updated documentation to reflect completion of all 35 notebook conversions
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Organic_Partitioning_and_Coagulation.py | New 526-line Jupytext paired script for SOA simulation with fixed API import and unit conversion |
| Biomass_Burning_Cloud_Interactions.py | New 705-line Jupytext paired script for biomass aerosol simulation using current APIs |
| Organic_Partitioning_and_Coagulation.ipynb | Updated with Jupytext metadata and synced with .py file |
| Biomass_Burning_Cloud_Interactions.ipynb | Updated with Jupytext metadata and synced with .py file |
| documentation_guide.md | Updated to reflect M4 migration completion (all 35 notebooks paired) |
| M4-jupytext-full-migration.md | Updated tracking to mark Phase 13 complete and document API deprecation fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # %% |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two consecutive cell markers here which creates an empty cell between them. This should likely be either a single cell marker with a label # %% staggered time stepping (removing line 452), or line 453 should be changed to a regular comment # staggered time stepping without the cell marker syntax. The duplicate marker is unnecessary and could cause confusion.
| # %% | |
| # . |
|
|
||
| time_step = total_time / total_steps | ||
|
|
||
| for _step in tqdm(range(total_steps), desc="Running Sim", mininterval=0.5): |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For loop variable '_step' is not used in the loop body.
| for _step in tqdm(range(total_steps), desc="Running Sim", mininterval=0.5): | |
| for _ in tqdm(range(total_steps), desc="Running Sim", mininterval=0.5): |
Target Branch:
mainFixes #995 | Workflow:
44d30c2cSummary
Converts 2 long-running simulation notebooks to Jupytext paired sync format (
.py:percent). This is Phase 13 of the M4 Jupytext Full Migration maintenance plan, completing all simulation notebook conversions in the repository.Critical fix applied: The
Organic_Partitioning_and_Coagulationnotebook contained a deprecated API import (from particula.activity.species_density import organic_array) that was updated to use the current public API (from particula.particles import get_organic_density_array) with the required unit conversion (kg/m³ → g/cm³).What Changed
New Components
docs/Examples/Simulations/Notebooks/Organic_Partitioning_and_Coagulation.py(+526 lines) - Jupytext paired Python script for SOA formation and coagulation simulation tutorial. Fixed deprecated API import with unit conversion.docs/Examples/Simulations/Notebooks/Biomass_Burning_Cloud_Interactions.py(+705 lines) - Jupytext paired Python script for biomass aerosol and cloud interactions tutorial. Uses current public API (no updates needed).Modified Components
docs/Examples/Simulations/Notebooks/Organic_Partitioning_and_Coagulation.ipynb- Added Jupytext metadata and synced with .py file, includes execution outputs for website renderingdocs/Examples/Simulations/Notebooks/Biomass_Burning_Cloud_Interactions.ipynb- Added Jupytext metadata and synced with .py file, includes execution outputs for website renderingadw-docs/dev-plans/maintenance/M4-jupytext-full-migration.md- Updated migration tracking to mark Phase 13 as completeadw-docs/documentation_guide.md- Added notebook editing workflow documentationHow It Works
The Jupytext paired sync workflow enables editing notebooks as plain Python files:
API Migration performed:
Implementation Notes
particula.activity.species_densitymodule no longer exists; updated to useparticula.particles.get_organic_density_array()with SI unit conversionpy:percentwith YAML header,# %%cell markers for code,# %% [markdown]for markdown cellsexecute=False)Testing
validate_notebook --check-sync(sync status confirmed)ruff checkandruff formatwith no errorsget_organic_density_arrayreturns correct density values in SI units (kg/m³)Execution Time Handling
These times will be referenced in M4-P14 (pre-commit hook configuration) to exclude long-running notebooks from pre-commit validation.
References
adw-docs/dev-plans/maintenance/M4-jupytext-full-migration.mdadw-docs/documentation_guide.md(Jupytext Paired Sync Workflow)