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

ameriflux-site-info

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.

インストール方法を見る

含まれるファイル(3)

  • SKILL.md7.1 KB
  • extract_ameriflux_site_data.py29.4 KB
  • test_extract_ameriflux_site_data.py9.1 KB

SKILL.md(原文)

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

AmeriFlux Site Info Extractor

Use When

  • You need EcoSIM site metadata for an AmeriFlux site ID such as US-Ha1.
  • You need to map flux-site attributes into ALATG, ALONG, ALTIG, ATCAG, IETYPG, or IXTYP1.
  • You are building site-level inputs before climate, atmospheric chemistry, or soil extraction.

Constraints

  • NEVER use it extract climate data.

Purpose

Automate the identification and derivation of site-specific attributes (e.g., location, vegetation) from AmeriFlux site pages and map the extracted values to EcoSIM variables. The bundled script uses cached EcoSIM site JSON first, then structured AmeriFlux page text or rendered DOM extraction when a refresh is needed.

Workflow

  1. Resolve the AmeriFlux site ID or site name.
  2. Load existing result/<SITE_ID>/<SITE_ID>_ecosim_site.json metadata when present.
  3. Extract latitude, longitude, elevation, mean annual temperature, Koppen-Geiger code, and IGBP vegetation type.
  4. Map the extracted values to EcoSIM JSON variables and write under result/<SITE_ID>/.
  5. Check units: latitude/longitude are decimal degrees, elevation is meters, and temperature is degrees Celsius.

Metadata Extraction Policy

Use deterministic sources in this order:

  1. Existing local EcoSIM site metadata JSON.
  2. AmeriFlux siteinfo HTML fetched with Python standard library URL tools, or requests when available.
  3. Rendered AmeriFlux DOM text fetched with Playwright if the static HTML is incomplete.

Always inspect the extracted values for physical and ecological plausibility before using them in EcoSIM inputs.

Location Cross-Checks

AmeriFlux pages put each value on its own line under a label (Lat, Long: then -16.4980, -56.4120). Line cleanup must never strip a leading minus sign: an earlier version did, turning southern latitudes (BR-Npw, CL-SDF), sub-zero MAT (US-Brw -12.6, US-Prr -2), and below-sea-level elevation (US-Myb -4) positive. Every extraction is now cross-checked, and the result is stored in _location_validation:

CheckEvidenceOn failure
page_signsEach parsed latitude, longitude, elevation, and MAT appears with the same sign in the raw page text under its labelerror
country_boundsCoordinates fall inside the envelope of the country in the site-ID prefix (BR-, CL-, US-, ...); the message says when the opposite sign would fiterror
description_regionRegion words in the site Description or name (South America, Pantanal, Amazon, Patagonia, Alaska, Arctic, ...) agree with the latitudewarning
koppen_consistencyMAT lies in a plausible range for the Koppen group (A 15 to 35, C -3 to 30, D -25 to 16, E -60 to 8 degC); tropical classes within 35 deg latitudewarning
koppen_from_coordinatesThe page Koppen class appears in the 3x3 neighbourhood of the parsed coordinates on a gridded Beck et al. (2018) Koppen-Geiger map; when it fits the opposite-sign latitude or longitude instead, the warning says to suspect a lost minus signwarning

The Koppen map is a NetCDF with ids(lat, lon) indexing a labels list, such as the ILAMB regions/Koppen.nc 0.5-degree product (Beck et al. 2018, Sci. Data 5:180214). Pass --koppen-raster PATH, set ECOSIM_KOPPEN_RASTER, or place it at data/Koppen.nc; without it the check reports not_available. A plain mismatch (e.g. US-MMS page Cfa, map Dfa) usually reflects a class boundary or a different climatology, so it is a warning, not a coordinate error.

Errors stop the extraction without writing JSON. Cached JSON is validated too; a cached file that fails is refetched automatically. Use --skip-location-check only after confirming the coordinates by hand. Warnings are printed and kept in the JSON; review them before building forcing. The checks are offline and catch sign and gross-location errors, not small coordinate errors inside the right country.

1. Site Metadata Extraction (Flux Network)

Given an AmeriFlux site name or ID (e.g., "Blodgett Forest" or "US-Blo"), read cached metadata or parse the rendered AmeriFlux site page text, then map the extracted values to the required EcoSIM JSON variables.

JSON VariableSource AttributeDescription
ALATGSite LatitudeDecimal degrees north.
ALONGSite LongitudeDecimal degrees east.
ALTIGElevationMeters above sea level.
ATCAGMATMean Annual Temperature (°C).
IETYPGClimate ClassKoppen-Geiger climate zone code.
IXTYP1IGBP TypeDominant vegetation type (mapped to plant litter flags).

Logic for Vegetation Mapping:

  • If IGBP is ENF (Evergreen Needleleaf) → Set IXTYP1 to 9 or 11 (Coniferous).
  • If IGBP is DBF (Deciduous Broadleaf) → Set IXTYP1 to 8 or 10 (Deciduous).

Koppen climate classification mapping: Using the koppenDict mapping, convert the site's Koppen-Geiger code (e.g., "Csa") to the corresponding integer code for IETYPG. This will allow the model to apply appropriate climate-specific parameters during simulations.

koppenDict = { "Af": 11, "Am": 12, "As": 13, "Aw": 14, "BWk": 21, "BWh": 22, "BSk": 26, "BSh": 27, "Cfa": 31, "Cfb": 32, "Cfc": 33, "Csa": 34, "Csb": 35, "Csc": 36, "Cwa": 37, "Cwb": 38, "Cwc": 39, "Dfa": 41, "Dfb": 42, "Dfc": 43, "Dfd": 44, "Dsa": 45, "Dsb": 46, "Dsc": 47, "Dsd": 48, "Dwa": 49, "Dwb": 50, "Dwc": 51, "Dwd": 52, "ET": 61, "EF": 62 }

2. Implementation & Execution

Prerequisites

  • Python 3.8+
  • requests: Optional HTTP fetch helper; the script also has a standard-library HTTP fallback.
  • Playwright: Optional fallback for rendered DOM extraction when static HTML is incomplete.

Setup for the Bundled Local Script

pip install playwright requests
playwright install chromium

No local vision service is required.

Usage

To execute the skill, run the following command from the project root. The resulting JSON will be saved under ./result/<SITE_ID>/ by default:

python .agents/skills/ameriflux-site-info/extract_ameriflux_site_data.py <SITE_ID>

Example:

python .agents/skills/ameriflux-site-info/extract_ameriflux_site_data.py US-Ha1

To bypass cached metadata and refresh from AmeriFlux:

python .agents/skills/ameriflux-site-info/extract_ameriflux_site_data.py US-Ha1 --force-refresh

Output

The script creates a JSON file named result/<SITE_ID>/<site_name>_ecosim_site.json with the following structure:

{
  "site_name": "US-Ha1",
  "ALATG": 40.0,      # Latitude (decimal degrees north)
  "ALONG": -120.0,    # Longitude (decimal degrees east)
  "ALTIG": 1000.0,    # Elevation (meters above sea level)
  "ATCAG": 10.0,      # Mean Annual Temperature (°C)
  "IETYPG": 34,       # Koppen climate zone code
  "IXTYP1": 10        # Vegetation type code
}

レビュー

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

同じリポジトリのスキル

概要と使いどころ

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_<first>-<last>.nc`, and `*_pft_mgmt.nc` inputs.

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

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

Extract dominant-component soil profile variables for EcoSIM grid or template inputs from gSSURGO, with FAO HWSD v2.0 fallback when gSSURGO data are unavailable or incomplete. Use when deriving soil depth, bulk density, field capacity, wilting point, hydraulic conductivity, texture, rock fraction, pH, CEC, or soil organic carbon; or when converting EcoSIM grid NetCDF files to editable Excel workbooks and back.

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

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

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

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