Skip to content

How to integrate ERA LTE data with the Climate Toolkit #110

Description

@Rwema25

Background

ERA Long-Term Experiments (LTEs) provide site-level agricultural trial records with geolocation, season definitions, rainfall totals, crop names, and yield outcomes. These datasets are a strong candidate for validation and benchmarking of the Climate Toolkit’s seasonal climate summaries.

Motivation

Integrating ERA LTE data would enable:

  • site-specific climate summary generation with the toolkit
  • comparison of toolkit-derived season totals against ERA-reported values
  • exploration of how climate statistics can help explain crop yield outcomes
  • a practical workflow for connecting LTE metadata to toolkit analytics

Proposed integration approach

  1. Extract LTE site/year metadata:

    • Site.LatD, Site.LonD
    • Time.Start.Year, Time.End.Year
    • Site.Start.S1, Site.End.S1
    • Site.Start.S2, Site.End.S2 (if present)
    • crop name, yield, and experiment identifiers
  2. Convert LTE season windows into toolkit fixed-season syntax:

    • single season: MM-DD:MM-DD
    • two seasons: MM-DD:MM-DD,MM-DD:MM-DD
    • year-crossing season: MM-DD:MM-DD where end date belongs to next year
  3. Run climate statistics for each ERA LTE site/year using fixed seasons:

    • location = latitude,longitude
    • years = experiment start/end
    • fixed season = LTE season window
    • source = appropriate climate source for the site
  4. Collect toolkit outputs such as:

    • seasonal rainfall total
    • rainy day count
    • dry day count
    • water balance / ET0 metrics
    • VPD/humidity-derived summaries if humidity data are available
  5. Compare results:

    • LTE-reported rainfall vs toolkit seasonal rainfall
    • LTE season dates vs toolkit season window interpretation
    • climate-derived metrics vs yield outcomes

Data fields of interest

From LTE datasets, the most useful fields are:

  • Site.Out

    • Site.LatD, Site.LonD
    • Site.Start.S1, Site.End.S1
    • Site.Start.S2, Site.End.S2
    • Site.Rain.Seasons
  • Time.Out

    • Time.Start.Year, Time.End.Year
    • Time.Season
  • Climate.Out

    • climate normals by site/year
  • Data.Out

    • experiment records with crop/yield outcomes

Why this is feasible

The toolkit already supports fixed-season climate summaries and seasonal metrics, so LTE date metadata can be translated into direct toolkit inputs without major code changes.

Suggested next steps

  • explore the ERA LTE repository and export core site/year metadata
  • prototype a script that reads LTE rows and constructs toolkit fixed-season calls
  • validate with a few representative sites by comparing reported rainfall and season windows
  • assess whether additional data preprocessing or source selection is needed

Outcome

This integration should demonstrate that the Climate Toolkit can:

  • reproduce ERA LTE seasonal climate statistics
  • provide a climate-derived explanatory layer for yield analysis
  • support cross-site comparisons between LTE reports and toolkit-generated metrics

Further explanation :

Suggested workflow

1. Get the ERA LTE metadata

From the ERA dataset, the key fields you need are:

  • Site.LatD, Site.LonD
  • Time.Start.Year, Time.End.Year
  • Site.Start.S1, Site.End.S1 (and Site.Start.S2 / Site.End.S2 if two seasons)
  • Time.Season or crop-specific experiment year
  • crop name / yield

This gives you:

  • location
  • year(s)
  • season window(s)
  • crop / yield for later comparison

2. Convert ERA season dates to toolkit fixed-season format

The toolkit uses fixed-season windows like:

  • "03-01:05-31" for March 1 to May 31
  • "10-01:12-15" for October 1 to December 15
  • "11-01:02-28" for a season crossing calendar year

So map:

  • Site.Start.S1 / Site.End.S1MM-DD:MM-DD
  • if there is a second season, use "S1,S2" format

3. Use the toolkit to generate climate statistics for each site/year

The best module is climate_toolkit.climate_statistics.statistics.

If you want a command-line path, use:

python -m climate_tookit.climate_statistics.statistics \
  --location="-1.286,36.817" \
  --start-year=2018 \
  --end-year=2020 \
  --fixed-season "03-01:05-31" \
  --source era_5 \
  --format pandas

For ERA LTE, change:

  • -1.286,36.817 → site latitude,longitude
  • --start-year / --end-year → experiment years
  • --fixed-season → season window from ERA metadata
  • --source → best available data source for the site

If the site has two seasons, use:

--fixed-season "03-01:05-31,10-01:12-15"

If you want to use the toolkit from Python instead:

from climate_tookit.climate_statistics import statistics

# if there is a Python API wrapper available, or use module CLI via subprocess

4. Use the toolkit outputs to compute the metrics you need

The toolkit can give you season-based summaries such as:

  • total rainfall
  • rainy days
  • dry days
  • water balance
  • VPD / humidity-derived metrics
  • seasonal climate statistics

This matches your target:

  • compare ERA reported total rainfall vs toolkit-calculated total rainfall
  • compare season length / rainfall season definition
  • compare weather-derived climate statistics against yield outcomes

5. Build a comparison dataset

For each ERA site-year:

  • ERA reported variables:
    • crop yield
    • total rainfall
    • season start/end
    • crop name
  • Toolkit-derived variables:
    • seasonal rainfall total
    • rainy day count
    • dry day count
    • mean temperature, max/min, water balance
    • VPD/humidity metrics if available

Then you can analyze:

  • How close toolkit rainfall totals are to ERA totals
  • whether tool-based climate summaries explain yield variation
  • whether the toolkit can be used as an explanatory input layer for yield modeling

Practical integration advice

If ERA LTE data are currently in R

  • You can still export the key fields as CSV/Parquet from R
  • Then read them in Python
  • For each ERA row, call the toolkit or the CLI with the site-season inputs

If you want a more automated pipeline

Create a small integration script that:

  1. reads ERA LTE site/year records
  2. builds location, start_year, end_year, fixed_season
  3. runs the toolkit stats module
  4. saves climate metrics to a table
  5. merges the result with ERA yield data

What to pay attention to

  • ERA Site.Start.S1 and Site.End.S1 may be seasonal dates, not full-year dates.
  • Use the same fixed-season window for every year of that site if the ERA dataset records a stable season.
  • If a season crosses year-end, the toolkit supports that format.
  • Choose the climate source carefully: era_5, agera_5, chirps_v2, etc. are available depending on the data needed.

Conclusion

This is a very reasonable integration task and should be done as a workflow/project, not as a toolkit bug fix.

You can integrate ERA LTE by:

  • extracting lat/lon and season windows
  • passing them into climate_toolkit.climate_statistics with --fixed-season
  • generating climate statistics per ERA site-year
  • comparing toolkit outputs to ERA reported rainfall and yield

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmichelIssue requested directly by Michel

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions