本文へ移動
cccskills
無料GitHub で公開

gapon-coefficient-estimator

Estimate calcium-normalized Gapon selectivity coefficients from paired exchange and solution chemistry, or initialize depth-explicit EcoSIM Gapon inputs from the closest bundled ecosystem template when paired chemistry is unavailable. Use when deriving or checking EcoSIM GKC4, GKCH, GKCA, GKCM, GKCN, or GKCK values; matching a target ecosystem, climate, vegetation, and management regime to a starting profile; remapping template values to target soil layers; or documenting that template-based values require calibration or tuning.

インストール方法を見る

含まれるファイル(29)

  • SKILL.md8.4 KB
  • agents/openai.yaml467 B
  • assets/ecosystem_templates/Arctic_Tundra_AK/soil_gapon_coefficients.csv5.8 KB
  • assets/ecosystem_templates/Arctic_Tundra_NWT/soil_gapon_coefficients.csv6.7 KB
  • assets/ecosystem_templates/Arctic_Wetland_NWT/soil_gapon_coefficients.csv4.5 KB
  • assets/ecosystem_templates/Boreal_Aspen_SK/soil_gapon_coefficients.csv2.2 KB
  • assets/ecosystem_templates/Boreal_Black_Spruce_MB/soil_gapon_coefficients.csv1.8 KB
  • assets/ecosystem_templates/Boreal_Black_Spruce_PQ/soil_gapon_coefficients.csv1.6 KB
  • assets/ecosystem_templates/Boreal_Crop_Rotation_AB/br/soil_gapon_coefficients.csv1.8 KB
  • assets/ecosystem_templates/Boreal_Jack_Pine_SK/soil_gapon_coefficients.csv1.7 KB
  • assets/ecosystem_templates/Cool_Temperate_Douglas_Fir_BC/soil_gapon_coefficients.csv1.7 KB
  • assets/ecosystem_templates/Cool_Temperate_Maize_Soybean_ON/soil_gapon_coefficients.csv2.2 KB
  • assets/ecosystem_templates/Cool_Temperate_Oak_MA/soil_gapon_coefficients.csv1.9 KB
  • assets/ecosystem_templates/Cool_Temperate_Pasture_Switzerland/soil_gapon_coefficients.csv2.0 KB
  • assets/ecosystem_templates/index.csv3.9 KB
  • assets/ecosystem_templates/Meditteranean_Pasture_CA/soil_gapon_coefficients.csv2.0 KB
  • assets/ecosystem_templates/README.md619 B
  • assets/ecosystem_templates/Semiarid_Grassland_AB/soil_gapon_coefficients.csv2.1 KB
  • assets/ecosystem_templates/template_catalog.csv4.4 KB
  • assets/ecosystem_templates/Tropical_Peatland_Indonesia/soil_gapon_coefficients.csv5.5 KB
  • assets/ecosystem_templates/Tropical_Rainforest_Amazon/soil_gapon_coefficients.csv2.3 KB
  • assets/ecosystem_templates/Warm_Temperate_Loblolly_Pine_TN/soil_gapon_coefficients.csv1.7 KB
  • assets/ecosystem_templates/Warm_Temperate_Maize_Soybean_Dryland_NB/soil_gapon_coefficients.csv2.8 KB
  • assets/ecosystem_templates/Warm_Temperate_Maize_Soybean_Irrigated_NB/soil_gapon_coefficients.csv2.8 KB
  • references/data-requirements.md3.4 KB
  • references/template-fallback.md2.8 KB
  • scripts/estimate_gapon_coefficients.py10.1 KB
  • scripts/select_gapon_template.py18.2 KB
  • tests/test_select_gapon_template.py4.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Gapon Coefficient Estimator

Core Rule

Do not compute Gapon coefficients from SSURGO/gSSURGO alone. Prefer a site-specific calculation when both of these data groups are available:

  • Exchange phase: exchangeable cations in charge-equivalent units, ideally cmolc/kg (CaX, MgX, NaX, KX, NH4X, AlX, FeX, HX).
  • Solution phase: ion activities, or at least consistently unit-normalized dissolved concentrations for Ca, Mg, Na, K, NH4, Al, Fe, and H.

SSURGO/gSSURGO can provide priors such as cec7_r, ecec_r, sumbases_r, ph1to1h2o_r, ec_r, sar_r, extracid_r, and extral_r, but standard chorizon does not provide all species-resolved exchangeable bases or solution cation activities.

When paired chemistry is unavailable and an EcoSIM input still needs starting values, use the bundled depth-explicit ecosystem templates as an explicit fallback. Select the ecosystem family closest to the target first, then refine the match with climate, vegetation, water regime, and management. Never describe template values as measured, site-derived, or independently validated.

Every template-based output and user-facing summary must include this reminder:

Gapon coefficients are initialized from the closest ecosystem template, not derived from site-specific paired exchange and solution chemistry. They are starting values and are subject to calibration or tuning when needed.

Lyotropic Adsorption Prior

Use the cation adsorption lyotropic series as a calibration and QC prior:

Al = Fe > Ca > Mg > K = NH4

This means trivalent Al and Fe should generally be treated as the strongest exchange competitors, followed by Ca, then Mg, with K and NH4 approximately tied at lower adsorption strength. Use this order to interpret uncertain coefficients, set plausible priors, and flag suspicious data inversions. Do not overwrite paired exchange-solution evidence solely to force the series. Na is retained for EcoSIM sodicity calculations but is not part of this specific adsorption series, and H is pH-controlled rather than a simple base-cation competitor.

Data-Derived Workflow

  1. Gather exchangeable cations from local lab data, WoSIS profiles, national soil lab datasets, or project measurements. Use SSURGO/gSSURGO only for CEC/ECEC/pH/acidity priors and gap flags.

  2. Gather solution chemistry from saturated paste, soil solution, lysimeter, groundwater, stream chemistry, or a geochemical speciation model.

  3. Convert exchangeable cations to consistent charge-equivalent units.

  4. Convert solution concentrations to activities if possible. If using raw concentrations, label the output as an activity approximation.

  5. Compute Ca-normalized Gapon coefficients with:

    K_G(Ca-i) = (E_i / E_Ca) * a_Ca^(1/2) / a_i^(1/z_i)

    where E_i and E_Ca are exchange-phase equivalent amounts and z_i is the cation charge. This gives exponents of 1 for monovalent ions, 1/2 for divalent ions, and 1/3 for Al3+ or Fe3+.

  6. Report quality flags: missing solution data, CaX closure assumptions, concentration-as-activity assumptions, negative closures, lyotropic-series inconsistencies, and conditional Al/Fe/H interpretations.

Ecosystem-Template Fallback

Use this route only when paired exchange-solution chemistry is missing or insufficient for a defensible calculation:

  1. Identify the target ecosystem family. Use the actual land use or ecosystem, such as cropland, forest, pasture, grassland, tundra, wetland, peatland, or rainforest; do not match from climate alone.
  2. Record climate, dominant vegetation or crop, water regime, and management. These attributes distinguish otherwise similar cases, including dryland and irrigated maize-soybean systems.
  3. Run scripts/select_gapon_template.py. Automatic selection requires a same-family template. Use --template-id only for a deliberate, documented override.
  4. Preserve the source profile layers or map the selected profile to the target EcoSIM layer-bottom depths. Mapping uses the source layer that contains each target bottom depth and extends the deepest source value only when needed.
  5. Transfer all six supported coefficients together: GKC4 (Ca-NH4), GKCH (Ca-H), GKCA (Ca-Al), GKCM (Ca-Mg), GKCN (Ca-Na), and GKCK (Ca-K).
  6. Keep the generated provenance JSON with the EcoSIM input. Where the target format supports metadata, also record gapon_source_method, gapon_template_id, and the mandatory template/tuning reminder.
  7. Replace or calibrate the starting values when paired chemistry, exchange observations, soil-solution data, or site response data become available.

Important Scientific Cautions

  • Ca-Mg under the general Gapon form uses sqrt(a_Ca) / sqrt(a_Mg), not a_Ca / a_Mg. If a project uses Vanselow or Gaines-Thomas selectivity conventions, state that explicitly and do not mix coefficients.
  • extracid_r is exchangeable acidity, not pure exchangeable H. If Al is separately available, estimate HX = max(extracid - AlX, 0) only as a flagged approximation.
  • extral_r or lab-extractable Al is not automatically aqueous Al3+. Solution Al should be speciated because hydrolysis and DOC complexation strongly affect activity.
  • Exchangeable Fe and solution Fe3+ are usually difficult to interpret from total or extractable Fe alone. Fe hydrolysis, oxide precipitation, redox state, and organic complexation can dominate apparent Fe activity; use speciated Fe activities when possible and flag total-Fe substitutions.
  • [H+] = 10^-pH is a fallback activity estimate only; pH method and solution matrix matter.
  • NH4X is transient and usually absent from regional soil maps; prefer local agronomic or incubation data.
  • The lyotropic series Al = Fe > Ca > Mg > K = NH4 is a prior for cation adsorption strength, not a mass-balance equation. If fitted coefficients violate it, keep the measured result but report the inversion and check extraction chemistry, activity corrections, and units.
  • For EcoSIM, treat data-derived coefficients as uncertain calibrated parameters and ecosystem-template coefficients as initialization priors. Neither route makes them deterministic outputs from global soil products.

Script

Use scripts/estimate_gapon_coefficients.py for repeatable CSV calculations. It accepts flexible column aliases, estimates missing CaX by a flagged CEC or ECEC closure when requested, and writes coefficient plus QC columns, including kg_ca_fe, lyotropic_series, and possible lyotropic inversion flags.

Example:

python .agents/skills/gapon-coefficient-estimator/scripts/estimate_gapon_coefficients.py \
  --input data/site_exchange_solution.csv \
  --output result/site_gapon_coefficients.csv \
  --estimate-ca

Use --self-test to run a built-in smoke test.

Use scripts/select_gapon_template.py when paired chemistry is unavailable. It selects the closest ecosystem profile, remaps it to requested layer-bottom depths, writes all six EcoSIM coefficients, and creates a provenance sidecar.

Example:

python .agents/skills/gapon-coefficient-estimator/scripts/select_gapon_template.py \
  --ecosystem-type "maize soybean cropland" \
  --climate "warm temperate" \
  --water-regime dry \
  --management "dryland rotation" \
  --target-depths "0.01,0.03,0.06,0.10,0.16,0.23,0.33,0.45,0.60,0.80,1.20,2.00" \
  --output result/site_gapon_template.csv

Use --list-templates to inspect the catalog. Use --template-id for an explicit override when local knowledge supports a different source case.

References

For column aliases, closure rules, and source-database suitability, read references/data-requirements.md when the task involves unfamiliar data schemas or global/national soil products.

Read references/template-fallback.md before using a bundled ecosystem template or transferring the selected coefficients into an EcoSIM input.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Extract EPA/NADP tDEP atmospheric deposition and NADP precipitation chemistry rasters for an AmeriFlux or EcoSIM site. Use when deriving atmospheric chemistry inputs such as NH4, NO3, SO4, Ca, or precipitation pH for EcoSIM forcing workflows.

日本語の概要は準備中です。原文の説明を表示しています。

bioepic-data/ecosim-agent32026年10月12日 更新

Extract AmeriFlux BASE-BADM/BIF crop management records into EcoSIM-editable plant-management and soil-management Excel workbooks that can be converted to EcoSIM NetCDF files. Use when asked to derive EcoSIM planting, harvest, fertilizer, or tillage management inputs from AMF *_BIF_*.xlsx or BIF CSV files, especially for crop sites where management details live in GRP_DM_* records and DM_COMMENT fields.

日本語の概要は準備中です。原文の説明を表示しています。

bioepic-data/ecosim-agent32026年10月12日 更新

Sort AmeriFlux BASE-BADM BIF variables from Excel or CSV files into observation, management-event, static metadata, and plotting-ready target time-series tables. Use when Codex is asked to sort AmeriFlux BIF variables into time series; organize BADM/BIF variables by date; pivot AMF *_BIF_*.xlsx files by GROUP_ID; output total LAI, leaf mass per area, above-ground biomass, canopy height, fruit yield, or total yield time series; write MATLAB readers for BIF time-series plotting; or prepare dated AmeriFlux site observations and management records for EcoSIM workflows.

日本語の概要は準備中です。原文の説明を表示しています。

bioepic-data/ecosim-agent32026年10月12日 更新

Convert AmeriFlux ERA5 half-hourly meteorological CSV files into EcoSIM hourly climate forcing NetCDF files, compare generated forcing against overlapping measured tower meteorology when a FULLSET file is available, and report large biases or errors. Use when preparing or validating EcoSIM climate inputs for AmeriFlux sites, checking ERA5 against in situ records, diagnosing forcing discrepancies, or writing climate-quality reports. For non-AmeriFlux paper sites that need a fresh Copernicus CDS ERA5 point download by longitude/latitude, use era5-cds-point-download first.

日本語の概要は準備中です。原文の説明を表示しています。

bioepic-data/ecosim-agent32026年10月12日 更新

Create EcoSIM Fortran namelist files and workable EcoSIM run folders for AmeriFlux site runs from site-specific grid, plant management, climate forcing, and greenhouse-gas inputs. Use when preparing or updating an EcoSIM `.namelist`, run folder, runfolder, run directory, or executable-ready site case for AmeriFlux or FLUXNET sites, especially after generating `*_ecosim_grid.nc`, `*_ecosim_climate.nc`, and `*_pft_mgmt.nc` inputs.

日本語の概要は準備中です。原文の説明を表示しています。

bioepic-data/ecosim-agent32026年10月12日 更新

Extract AmeriFlux site metadata and map it to EcoSIM JSON variables. Use when a task needs site latitude, longitude, elevation, mean annual temperature, Koppen climate code, or vegetation type for an AmeriFlux site ID or flux-site name.

日本語の概要は準備中です。原文の説明を表示しています。

bioepic-data/ecosim-agent32026年10月12日 更新

bioepic-data のスキルをすべて見る

このスキルの問題を報告する