From 2bbea1bd15d1a4238d88df20cad84a9dfde01e4d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:25:52 +0000 Subject: [PATCH 1/3] Add .github/copilot-instructions.md for SMRF Agent-Logs-Url: https://github.com/iSnobal/smrf/sessions/f0b6fb60-3776-4d0f-b9ab-179af0683851 Co-authored-by: jomey <178649+jomey@users.noreply.github.com> --- .github/copilot-instructions.md | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..71480bfc --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,51 @@ +# Copilot Instructions for SMRF + +## Repository Description +The Spatial Modeling for Resources Framework (SMRF) is a Python-based framework designed to provide a modular approach to spatial modeling of meteorological data. SMRF acts as the primary forcing data engine for the **Automated Water Supply Model (AWSM)**, distributing point measurements or gridded data over a digital elevation model (DEM) to provide inputs for snow mass and energy balance models. + +## Repository Structure +The project follows a modular Python package structure: +- `smrf/`: Main package directory. + - `cli/`: Command-line interface implementations. + - `data/`: Default configuration files, static resources, and sample data. + - `distribute/`: Classes for distributing meteorological variables (temp, precip, etc.). + - `envphys/`: Physical calculations for environmental variables (e.g., radiation, vapor pressure). + - `framework/`: Core logic for model execution, threading, and data management. + - `output/`: Handlers for various output formats (e.g., NetCDF). + - `spatial/`: Spatial operations and handling of DEM/grid data. + - `tests/`: Unit and integration tests. + - `utils/`: Common utility functions and helpers. +- `docs/`: Sphinx documentation. +- `pyproject.toml` & `Makefile`: Build system and task automation. + +## Key Guidelines + +### 1. Code Style & Standards +Adhere to the specialized iSnobal organization agents defined in `.github/instructions/`: +- **Python Style**: Follow `python-style-agent.md` for Ruff formatting, type hints, and naming conventions. +- **Legacy Migration**: Consult `legacy-migrator-agent.md` when refactoring complex or obscure legacy code. +- **Documentation**: Follow `documentation-agent.md` for NumPy-style docstrings and RST formatting. +- **Dependencies**: Consult `dependency-modernization-agent.md` for Conda-based environment management. +- **Performance**: Use `performance-cython-agent.md` for C/Cython optimizations and NumPy vectorization. +- **Snow Physics**: Defer to `snow-physics-agent.md` for physical correctness in radiation and energy balance logic. + +### 2. Domain Context +- **Models**: Always consider the relationship between **SMRF** (forcing data/spatial modeling), `pysnobal` (iSnobal wrapper), and **AWSM** (orchestrator). SMRF provides the critical spatial distribution of meteorological variables required by AWSM to drive snow mass and energy balance models. +- **Topographic Context**: SMRF relies on **topocalc** for all topographic processing (slope, aspect, skyview, etc.). When performing domain context checks or modifying spatial calculations (e.g., in `smrf/data/load_topo.py` or `smrf/envphys/solar/toporad.py`), ensure the dependency on `topocalc` is maintained for physical consistency and topographic layer generation. +- **Config Files**: SMRF heavily relies on `.ini` configuration files (managed via `inicheck`). Ensure any changes to distribution methods or parameters are reflected in the expected `.ini` structure to maintain compatibility with model initialization. + +### 3. Review Style +When providing feedback or reviewing code: +- **Conciseness**: Be short and concise; explain the "why" behind recommendations. +- **Clarification**: Ask clarifying questions when code intent is unclear. +- **Efficiency**: Do not repeat comments that were previously resolved on new pushes. +- **Context**: Do not repeat any information that was already in the PR description. +- **Prioritization**: Focus on logic and physical correctness over purely technical changes. + +### 4. Testing & Build +Follow the specialized `testing-coverage-agent.md` for detailed quality and coverage standards: +- **Framework**: Use the standard Python `unittest` framework for all tests. +- **Location**: Place new tests in `smrf/tests`. +- **Execution**: + - Build extensions and run all tests: `make build_extensions tests` + - Run specific test file: `python3 -m unittest smrf/tests/data/test_topo.py` From 5ce4bd0defbbb23bd35547754928bb508ed6bb9a Mon Sep 17 00:00:00 2001 From: Joachim Meyer Date: Fri, 3 Apr 2026 21:40:19 +0000 Subject: [PATCH 2/3] Copilot - Delete .github/instructions directory Use the higher level instructions under .github instead. --- .github/instructions/copilot-instructions.md | 26 -------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/instructions/copilot-instructions.md diff --git a/.github/instructions/copilot-instructions.md b/.github/instructions/copilot-instructions.md deleted file mode 100644 index 1b77b580..00000000 --- a/.github/instructions/copilot-instructions.md +++ /dev/null @@ -1,26 +0,0 @@ -When reviewing code, focus on: - -## Security Critical Issues -- Check for hardcoded secrets, API keys, or credentials - -## Performance Red Flags -- Spot inefficient loops and algorithmic issues -- Suggest converting code to faster or compiled alternatives for large datasets -- Check for memory leaks and resource cleanup -- Review caching opportunities for expensive operations - -## Code Quality Essentials -- Use clear, descriptive naming conventions -- Ensure basic error handling -- Do not suggest additional or excessive commenting of code -- Review tests if they could potentially be unstable or flaky - -## Review Style -- Be short and concise -- Explain the "why" behind recommendations -- Ask clarifying questions when code intent is unclear -- Do not repeat comments that were previously resolved on new pushes - -## Review Summary -- Do not repeat any information that was already in the PR description -- Focus on logic over technical changes From 4382031395ca6ca5b66df5761af4da72aba55c6c Mon Sep 17 00:00:00 2001 From: Joachim Meyer Date: Fri, 3 Apr 2026 21:51:23 +0000 Subject: [PATCH 3/3] .github - Update copilot-instructions.md This was the actual file generated --- .github/copilot-instructions.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 71480bfc..cdac2860 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,7 +1,7 @@ # Copilot Instructions for SMRF ## Repository Description -The Spatial Modeling for Resources Framework (SMRF) is a Python-based framework designed to provide a modular approach to spatial modeling of meteorological data. SMRF acts as the primary forcing data engine for the **Automated Water Supply Model (AWSM)**, distributing point measurements or gridded data over a digital elevation model (DEM) to provide inputs for snow mass and energy balance models. +The Spatial Modeling for Resources Framework (SMRF) is a Python-based framework designed to provide a modular approach to spatial modeling of meteorological data. SMRF acts as the primary forcing data engine for the **Automated Water Supply Model (iSnobal/awsm)**, distributing point measurements or gridded data over a digital elevation model (DEM) to provide inputs for snow mass and energy balance models. ## Repository Structure The project follows a modular Python package structure: @@ -21,18 +21,18 @@ The project follows a modular Python package structure: ## Key Guidelines ### 1. Code Style & Standards -Adhere to the specialized iSnobal organization agents defined in `.github/instructions/`: -- **Python Style**: Follow `python-style-agent.md` for Ruff formatting, type hints, and naming conventions. -- **Legacy Migration**: Consult `legacy-migrator-agent.md` when refactoring complex or obscure legacy code. -- **Documentation**: Follow `documentation-agent.md` for NumPy-style docstrings and RST formatting. -- **Dependencies**: Consult `dependency-modernization-agent.md` for Conda-based environment management. -- **Performance**: Use `performance-cython-agent.md` for C/Cython optimizations and NumPy vectorization. -- **Snow Physics**: Defer to `snow-physics-agent.md` for physical correctness in radiation and energy balance logic. +Adhere to the specialized iSnobal organization agents defined in **`iSnobal/.github`**: +- **Python Style**: Follow `@iSnobal/.github/instructions/python-style-agent.md` for Ruff formatting, type hints, and naming conventions. +- **Legacy Migration**: Consult `@iSnobal/.github/instructions/legacy-migrator-agent.md` when refactoring complex or obscure legacy code. +- **Documentation**: Follow `@iSnobal/.github/instructions/documentation-agent.md` for NumPy-style docstrings and RST formatting. +- **Dependencies**: Consult `@iSnobal/.github/instructions/dependency-modernization-agent.md` for Conda-based environment management. +- **Performance**: Use `@iSnobal/.github/instructions/performance-cython-agent.md` for C/Cython optimizations and NumPy vectorization. +- **Snow Physics**: Defer to `@iSnobal/.github/instructions/snow-physics-agent.md` for physical correctness in radiation and energy balance logic. ### 2. Domain Context -- **Models**: Always consider the relationship between **SMRF** (forcing data/spatial modeling), `pysnobal` (iSnobal wrapper), and **AWSM** (orchestrator). SMRF provides the critical spatial distribution of meteorological variables required by AWSM to drive snow mass and energy balance models. -- **Topographic Context**: SMRF relies on **topocalc** for all topographic processing (slope, aspect, skyview, etc.). When performing domain context checks or modifying spatial calculations (e.g., in `smrf/data/load_topo.py` or `smrf/envphys/solar/toporad.py`), ensure the dependency on `topocalc` is maintained for physical consistency and topographic layer generation. -- **Config Files**: SMRF heavily relies on `.ini` configuration files (managed via `inicheck`). Ensure any changes to distribution methods or parameters are reflected in the expected `.ini` structure to maintain compatibility with model initialization. +- **Models**: Always consider the relationship between **SMRF** (forcing data/spatial modeling), `pysnobal` (iSnobal wrapper), and **iSnobal/awsm** (orchestrator). SMRF provides the critical spatial distribution of meteorological variables required by **iSnobal/awsm** to drive snow mass and energy balance models. +- **Topographic Context**: SMRF relies on **iSnobal/topocalc** for all topographic processing (slope, aspect, skyview, etc.). When performing domain context checks or modifying spatial calculations (e.g., in `smrf/data/load_topo.py` or `smrf/envphys/solar/toporad.py`), ensure the dependency on **iSnobal/topocalc** is maintained for physical consistency and topographic layer generation. +- **Config Files**: SMRF heavily relies on `.ini` configuration files (managed via `inicheck`). Ensure any changes to distribution methods or parameters are reflected in the expected `.ini` structure to maintain compatibility with model initialization and **iSnobal/awsm** orchestration workflows. ### 3. Review Style When providing feedback or reviewing code: @@ -43,7 +43,7 @@ When providing feedback or reviewing code: - **Prioritization**: Focus on logic and physical correctness over purely technical changes. ### 4. Testing & Build -Follow the specialized `testing-coverage-agent.md` for detailed quality and coverage standards: +Follow the specialized `@iSnobal/.github/instructions/testing-coverage-agent.md` for detailed quality and coverage standards: - **Framework**: Use the standard Python `unittest` framework for all tests. - **Location**: Place new tests in `smrf/tests`. - **Execution**: