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

ameriflux-atmchem-info

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.

インストール方法を見る

含まれるファイル(3)

  • SKILL.md5.6 KB
  • extract_nadp_range.py4.3 KB
  • extract_tdep_from_dir.py4.3 KB

SKILL.md(原文)

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

AmeriFlux Atmospheric Chemistry Extractor

Use When

  • You need tDEP atmospheric deposition data for a latitude/longitude and year range.
  • You need NADP wet chemistry values for EcoSIM precipitation chemistry variables.
  • You are preparing EcoSIM climate forcing inputs that include PHRG, CN4RIG, CNORIG, CSORG, or CCARG.

Constraints

  • NEVER use it to extract soil data.

Workflow

  1. Confirm whether the user needs tDEP fluxes or NADP wet chemistry.
  2. Locate the source rasters under data/ first, then elsewhere in the repo if needed.
  3. Run the matching extractor with latitude, longitude, and the inclusive year range.
  4. Reject NoData, non-finite, negative concentration values, and pH values outside 0-14.
  5. Preserve units and derivation notes in the output JSON.

Overview

This tool extracts atmospheric deposition data from the EPA/NADP Total Deposition (tDEP) database. It processes high-resolution GeoTIFF files to retrieve chemical concentrations and precipitation totals for a specific geographic location (latitude/longitude) over a user-defined range of years.

The tool automatically handles the Albers Equal Area Conic projection used by tDEP and performs unit conversions to provide concentrations in $g/m^3$, matching the requirements for environmental models like EcoSIM.

Dependencies

The script requires a Python 3.12+ environment with the following libraries:

  • rasterio: For reading and sampling GeoTIFF data.
  • pyproj: For coordinate transformation from WGS84 to the tDEP Albers projection.
  • argparse: For command-line interface management.
  • json: For structured data output.

Install dependencies via pip:

pip install rasterio pyproj

Data Structure Requirements

The script expects the tDEP database to be organized into year-specific sub-directories within a base folder. Each sub-directory must contain the .tif files for the desired chemical species.

Example tDEP Directory Tree:

data/tDEP/
├── tDEP-2012/
│   ├── nh4_ww.tif
│   ├── no3_ww.tif
│   └── precip_ww.tif
├── tDEP-2013/
│   ├── ...

Example NADP Directory Tree:

data/nadp_data_grids/
├── 2012/
│   ├── Ca_conc_2012/conc_ca_2012.tif
│   ├── Cl_conc_2012/conc_cl_2012.tif
│   └── K_conc_2012/conc_k_2012.tif
├── 2013/
│   ├── ...

Variable Mapping

for tDEP: The following variables are extracted and mapped to internal keys:

Template VariabletDEP PrefixDescription
CN4RIGnh4_wwAmmonium ($NH_4$) concentration
CNORIGno3_wwNitrate ($NO_3$) concentration
CSORGs_wwSulfate ($SO_4$) concentration
CCARGca_wwCalcium ($Ca$) concentration

for NADP:

Template VariableNADP PrefixDescription
PHRGphlabpH in precipitation
CN4RIGnh4Ammonium ($NH_4$) concentration
CNORIGno3Nitrate ($NO_3$) concentration
CSORGso4Sulfate ($SO_4$) concentration
CCARGcaCalcium ($Ca$) concentration

NADP extraction must reject NoData, non-finite, negative concentration values, and pH values outside 0-14. The pH raster phlab must be emitted under the raw key ph so the climate writer can derive PHRG.

When the EcoSIM climate forcing writer consumes NADP chemistry, valid annual gaps are filled by linear interpolation with nearest-edge filling. If no valid NADP pH is available for PHRG, set PHRG to 7 for every year and record that default in the derivation report.

Usage

Command Line Arguments

  • --input: The base path to the tDEP data directory.
  • --output: Path where the resulting .json file will be saved.
  • --longitude: Longitude in decimal degrees (WGS84).
  • --latitude: Latitude in decimal degrees (WGS84).
  • --year1: The starting year of the range (e.g., 2012).
  • --year2: The ending year of the range (e.g., 2022).

Execution Example

To extract atmospheric chemistry data from tDEP for a site located at longitude -72.17 and latitude 42.54 from 2012 to 2022:

python .agents/skills/ameriflux-atmchem-info/extract_tdep_from_dir.py \
    --input data/tDEP/ \
    --output result/site_chem.json \
    --longitude -72.17 \
    --latitude 42.54 \
    --year1 2012 \
    --year2 2022

To extract atmospheric chemistry data from NADP for the same site and time range:

python .agents/skills/ameriflux-atmchem-info/extract_nadp_range.py \
    --input data/nadp_data_grids/ \
    --output result/site_chem.json \
    --longitude -72.17 \
    --latitude 42.54 \
    --year1 2012 \
    --year2 2022

Technical Details

Coordinate Transformation

tDEP data is natively stored in a custom Albers Equal Area projection. The script bypasses common ProjError issues by manually defining the PROJ string to ensure precise pixel sampling: +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs

Unit Conversion

for tDEP: The script converts wet deposition flux ($kg/ha$) into atmospheric concentration ($g/m^3$) using the annual precipitation ($P$): $$Concentration = \frac{Flux_{kg/ha} \times 0.1}{P_{meters}}$$

for NADP: The script converts concentration from $mg/L$ to $g/m^3$ using the formula: $$Concentration = \frac{Conc_{mg/L}}{1000} \times 1000$$

レビュー

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

同じリポジトリのスキル

概要と使いどころ

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 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日 更新

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 のスキルをすべて見る

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