Style Guide & Instructions for AI Agents
Welcome, AI coding agent! Please follow these guidelines when editing or adding code to this repository:
1. Project Context & Scope
- Domain: Historical daily precipitation records (statewide average for South Dakota) and weekly U.S. Drought Monitor (USDM) statistics for South Dakota counties:
- Oglala Lakota County (FIPS code
46102, formerly Shannon County46113). - Todd County (FIPS code
46121).
- Oglala Lakota County (FIPS code
- Timeframe: 10 years of historical data from July 2016 to the present.
2. Environment & Dependencies
Target Python Executable: Always run Python commands and scripts using the Conda environment configured for Quarto:
/users/brianyandell/miniconda3/envs/earth-analytics-python/bin/pythonPip Installations: If installing Python packages, run:
/users/brianyandell/miniconda3/envs/earth-analytics-python/bin/python -m pip install <package>Plotting Library: Use Plotly (
plotly.graph_objects,plotly.express) for main visualizations inplot_records.qmdto create interactive dashboards.
3. Quarto Website & Build Output
- Project Structure: This repository is a Quarto Website configured via
_quarto.yml. - Output Directory: The website builds into the
/docsfolder for GitHub Pages. - Embedded Resources: Resource embedding is enabled via
embed-resources: trueunderformat.htmlin_quarto.yml. Each page is compiled as a self-contained standalone HTML file. - Git Ignoring: The folder
docs/site_libs/is ignored in.gitignore. Do not track or commitdocs/site_libs/to the repository, as all scripts are embedded in the HTML files. Only stage the HTML files anddocs/search.json. - Build Command: Do not render the entire website. Prompt user to run
quarto renderafter significant changes.
4. Data Processing Standards
- Drought Severity and Coverage Index (USDM DSCI):
- Computed using cumulative percentages:
DSCI = D0 + D1 + D2 + D3 + D4(range0to500).
- Computed using cumulative percentages:
- Precipitation Units: Precipitation values are in inches.
- Trace Amounts: Convert daily trace precipitation values (
'T'or'T ') to0.0001inches. - Cumulative Calculations: When visualizing annual progressions, group values by year (
date.dt.year) and perform a cumulative sum (cumsum()) onprecipitation_inchesanddsci.