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

era5-cds-point-download

Download Copernicus CDS ERA5 single-level point time-series climate forcing for non-US or non-NLDAS EcoSIM sites from longitude/latitude coordinates. Use when a paper-derived site is outside the NLDAS domain, lacks AmeriFlux/FLUXNET curated forcing, or needs global ERA5 variables such as 2m temperature, dewpoint temperature, surface pressure, solar radiation, precipitation, and 10m wind components for EcoSIM preprocessing.

インストール方法を見る

含まれるファイル(4)

  • SKILL.md10.1 KB
  • agents/openai.yaml337 B
  • scripts/convert_cds_era5_to_ecosim.py16.9 KB
  • scripts/download_era5_point_cds.py10.2 KB

SKILL.md(原文)

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

ERA5 CDS Point Download

Overview

Use this skill to retrieve ERA5 single-level point time-series data from the Copernicus Climate Data Store (CDS) for literature sites outside the US/NLDAS workflow. The coordinate convention is longitude first, latitude second, with longitude in [-180, 180] and latitude in [-90, 90].

For US sites inside the NLDAS domain (-125 <= lon <= -67, 25 <= lat <= 53), prefer nldas-gesdisc-point-download unless the user explicitly asks for ERA5 or the paper requires an ERA5-consistent forcing source.

Required Setup

Use the CDS API instructions at https://cds.climate.copernicus.eu/how-to-api when credentials or local configuration are missing. The user must register or log in to locate their API key and configure cdsapi appropriately, usually through ~/.cdsapirc.

Prefer $HOME/.cdsapirc when it exists with url and key entries. This repository also supports fallback credentials from environment variables after sourcing ~/.bashrc: ERA5_USR and ERA5_PSSWD. Accept ERA5_PASSWD as a spelling fallback. If shell sourcing does not expose the values, the bundled script may directly parse simple export KEY=value assignments in ~/.bashrc; this handles unquoted API keys containing shell metacharacters such as &. Current CDS API setup expects the personal-access token without a deprecated <UID>: prefix, so pass ERA5_PSSWD or ERA5_PASSWD as the cdsapi.Client key only when using --credential-source env, and keep ERA5_USR only for compatibility/presence checks. Never print, persist, or echo API keys in result files or responses.

Install cdsapi only when needed. If network or package installation is required, request approval according to the active sandbox policy.

Default Variables

Download these variables for EcoSIM climate forcing preparation:

  • 2m_dewpoint_temperature
  • surface_pressure
  • surface_solar_radiation_downwards
  • 2m_temperature
  • total_precipitation
  • 10m_u_component_of_wind
  • 10m_v_component_of_wind

Default dataset: reanalysis-era5-single-levels. This is the current CDS catalogue entry for ERA5 hourly single-level data. The older point-timeseries short name reanalysis-era5-single-levels-timeseries may be tested with --dataset reanalysis-era5-single-levels-timeseries --request-style timeseries, but if CDS returns endpoint or authorization errors, use the default gridded dataset with a small lon/lat bounding box and extract the nearest grid cell downstream.

Default date range, when the user does not specify a period: 1940-01-01/2025-10-01.

Bundled Script

Prefer the bundled script for repeatable requests and manifest writing:

python .agents/skills/era5-cds-point-download/scripts/download_era5_point_cds.py \
  --site-id Forbonnet-peatland \
  --lon 6.1722 \
  --lat 46.8264 \
  --date 1940-01-01/2025-10-01 \
  --output result/era5/Forbonnet-peatland_era5_single_levels_timeseries

For a current CDS single-levels smoke test, request one day from a small bounding box around the point:

python .agents/skills/era5-cds-point-download/scripts/download_era5_point_cds.py \
  --site-id Forbonnet-peatland \
  --lon 6.1722 \
  --lat 46.8264 \
  --date 2020-01-01/2020-01-01 \
  --output result/era5/Forbonnet-peatland_era5_20200101_test.grib

If the CDS credentials are stored in ~/.bashrc, source it in the shell that launches the script:

source ~/.bashrc >/dev/null 2>&1
python .agents/skills/era5-cds-point-download/scripts/download_era5_point_cds.py \
  --site-id Forbonnet-peatland \
  --lon 6.1722 \
  --lat 46.8264 \
  --date 2020-01-01/2020-01-02 \
  --output result/era5/Forbonnet-peatland_era5_test.grib

To force a source, use --credential-source cdsapirc or --credential-source env. By default, --credential-source auto prefers $HOME/.cdsapirc and falls back to the ERA5 environment variables or simple ~/.bashrc assignments.

Use --dry-run first when checking a paper extraction or CDS setup:

python .agents/skills/era5-cds-point-download/scripts/download_era5_point_cds.py \
  --site-id Forbonnet-peatland \
  --lon 6.1722 \
  --lat 46.8264 \
  --dry-run

The script writes a JSON manifest next to the downloaded file. The manifest records the dataset, variables, location, requested date range, output path, and timestamp, but never records credentials.

Convert to EcoSIM

After downloading the CDS point time-series ZIP, convert it to EcoSIM hourly climate forcing with:

.venv-cmip6/bin/python .agents/skills/era5-cds-point-download/scripts/convert_cds_era5_to_ecosim.py \
  --input result/era5/Forbonnet-peatland_era5_timeseries_19400101_20251001.zip \
  --output result/era5/Forbonnet-peatland_ecosim_climate_1940_2024.nc \
  --site-id Forbonnet-peatland \
  --lon 6.1722 \
  --lat 46.8264 \
  --quality-report result/era5/Forbonnet-peatland_ecosim_climate_1940_2024_quality.json \
  --forcing-yaml result/Forbonnet-peatland/Forbonnet-peatland_forcing.yaml

The converter accepts either the CDS ZIP or the extracted NetCDF. By default, it writes only complete UTC calendar years and drops partial first or last years, because EcoSIM climate arrays are annual year/day/hour blocks and partial years leave fill values inside a simulation year. Use --include-incomplete-years only when a partial-year diagnostic file is explicitly needed, and document the missing hours in the quality report.

The converter maps:

  • t2m K to TMPH degC.
  • sqrt(u10^2 + v10^2) to WINDH m s^-1.
  • tp m to RAINH mm h^-1.
  • d2m K to vapor pressure DWPTH kPa.
  • ssrd J m^-2 hourly accumulation to SRADH W m^-2 by dividing by 3600.
  • sp Pa to PATM kPa.

For US grids in the same auxiliary-data domain used by the US/AmeriFlux workflow (-125 <= lon <= -67, 25 <= lat <= 53), the converter defaults to --add-us-chemistry auto and adds annual EcoSIM precipitation chemistry variables from NADP rasters under data/nadp_data_grids:

  • PHRG: pH in precipitation.
  • CN4RIG: NH4-N concentration in precipitation.
  • CNORIG: NO3-N concentration in precipitation.
  • CSORG: SO4-S concentration in precipitation.
  • CCARG: Ca concentration in precipitation.
  • The output NetCDF is renamed if needed so its name carries the forcing years it contains (e.g. _1940_2024.nc is kept; a name without years gets _<first>-<last>.nc).
  • Other template chemistry variables supported by Tools/create_ecosim_climate_forcing.py, including CMGRG, CNARG, CKARG, and CCLRG when NADP source rasters exist.

NADP values are validated the same way as US/AmeriFlux climate forcing: reject NoData, non-finite, negative concentrations, and pH outside 0-14; fill annual gaps by linear interpolation with nearest-edge filling; if no valid PHRG exists, use neutral PHRG=7 and record the fallback. Use --add-us-chemistry never to skip this for a US grid, or --add-us-chemistry always to force it. Use --chemistry-input to point to another NADP raster directory and --chemistry-output to set the intermediate JSON path.

For non-US grids, do not silently add NADP-derived chemistry. Leave the annual chemistry variables absent unless the user supplies an appropriate regional precipitation-chemistry source or asks for a site-specific mapping. When a non-US site needs annual EcoSIM precipitation chemistry, use global-aux-climate-chemistry to stage CAMS first, then EBAS/EANET station overrides or MERRA-2 fallback context as appropriate.

Use .venv-cmip6/bin/python for conversion because it includes xarray and netCDF4.

Minimal CDS API Pattern

When writing a one-off Python snippet, use this request shape:

import cdsapi

def download_era5_climate(lon=123.75, lat=44.75):
    dataset = "reanalysis-era5-single-levels-timeseries"
    request = {
        "variable": [
            "2m_dewpoint_temperature",
            "surface_pressure",
            "surface_solar_radiation_downwards",
            "2m_temperature",
            "total_precipitation",
            "10m_u_component_of_wind",
            "10m_v_component_of_wind",
        ],
        "location": {"longitude": lon, "latitude": lat},
        "date": ["1940-01-01/2025-10-01"],
    }

    client = cdsapi.Client()
    client.retrieve(dataset, request).download()

EcoSIM Unit Cautions

Before converting ERA5 output to EcoSIM NetCDF, inspect the returned file metadata because CDS response format and accumulation conventions can differ by service version.

Core conversions commonly needed:

  • 2m_temperature: K to degC for TMPH.
  • 10m_u_component_of_wind and 10m_v_component_of_wind: scalar wind speed sqrt(u^2 + v^2) for WINDH.
  • 2m_dewpoint_temperature: derive vapor pressure in kPa for DWPTH.
  • surface_pressure: Pa to kPa for PATM.
  • surface_solar_radiation_downwards: if accumulated energy in J m^-2, divide by the accumulation interval in seconds for SRADH in W m^-2.
  • total_precipitation: convert accumulated water depth to hourly RAINH; check whether source units are meters of water equivalent or another accumulation convention.

Run physical range checks before writing EcoSIM forcing:

  • TMPH: -90 to 60 degC.
  • WINDH: 0 to 75 m s^-1.
  • RAINH: non-negative.
  • DWPTH: 0 to 15 kPa.
  • SRADH: 0 to 1400 W m^-2.
  • PATM: 50 to 110 kPa.

Reporting

For any delivered ERA5 extraction, report:

  • Dataset name and requested date range.
  • Requested longitude/latitude.
  • Variables requested.
  • Output path and manifest path.
  • Whether cdsapi credentials were configured through $HOME/.cdsapirc, ERA5_USR/ERA5_PSSWD, or ERA5_USR/ERA5_PASSWD, without revealing credential values.
  • Any unresolved unit or format assumptions that must be checked before EcoSIM conversion.

レビュー

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

同じリポジトリのスキル

概要と使いどころ

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

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