Skip to content

Add ClimateDataAgent for PyDaymet integration with ERT workflows - #5

Merged
geohang merged 4 commits into
mainfrom
copilot/add-meteorological-data-fetcher
Nov 6, 2025
Merged

geohang merged 4 commits into
mainfrom
copilot/add-meteorological-data-fetcher

Conversation

Copilot AI commented Nov 6, 2025 •

Copy link
Copy Markdown
Contributor

Implements meteorological data retrieval and PET computation agent to contextualize ERT resistivity changes with climate forcing (precipitation, ET, temperature).

Core Implementation

ClimateDataAgent (PyHydroGeophysX/agents/climate_data_agent.py)

  • Retrieves climate variables from PyDaymet API: prcp, tmin, tmax, srad, vp, dayl
  • Computes PET via Penman-Monteith, Priestley-Taylor, Hargreaves-Samani with configurable parameters
  • Supports point (get_bycoords) and gridded (get_bygeom) data retrieval with CRS handling
  • Generates derived features: antecedent precipitation (1/3/7/14-day), P-PET water balance
  • Aligns climate data to ERT acquisition timestamps for event correlation
  • Compares PET methods and reports coefficient of variation for robustness assessment

Integration

  • Extended AgentCoordinator workflow to support optional climate step (Step 0)
  • Added climate configuration to workflow config dict
  • Exports ClimateDataAgent in agents __init__.py

Dependencies

  • Added pydaymet>=0.16.0, pandas>=1.3.0, xarray>=0.19.0 as "climate" extras in setup.py

Usage

from PyHydroGeophysX.agents import AgentCoordinator, ClimateDataAgent

coordinator = AgentCoordinator()
coordinator.register_agent('climate_data', ClimateDataAgent())

config = {
    'data_file': 'ert_data.dat',
    'use_climate': True,
    'climate_config': {
        'coords': (-105.3, 40.0),  # lon, lat
        'dates': ('2023-06-01', '2023-09-30'),
        'pet_method': 'penman_monteith',
        'pet_params': {'arid_correction': True},
        'antecedent_days': [1, 3, 7]
    },
    'ert_timestamps': ['2023-06-15', '2023-07-15']
}

results = coordinator.execute_workflow(config)
# results['climate_data'] contains aligned features for resistivity correlation

Example & Documentation

  • examples/Ex_climate_ert_integration.py: Demonstrates point/gridded retrieval, PET comparison, event analysis
  • Updated README with climate integration section (1.5)
  • Updated agents README with ClimateDataAgent details and workflow configuration

Notes

  • Coverage: North America, Hawaii, Puerto Rico (PyDaymet limitation)
  • Coordinates must be (longitude, latitude) for EPSG:4326
  • Requires internet access to daymet.ornl.gov

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • daymet.ornl.gov
    • Triggering command: python (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I also want another agent to get the meterological data like precip, temp and ET from https://github.com/hyriver/pydaymet, then we can use them with subsurface resistiivty image to have a better analysis with report agent“Agent role
Purpose: given a site geometry or ERT line coordinates and a time window, fetch daily climate variables and compute PET using supported methods, returning feature‑ready time series for fusion with ERT inversions and moisture products.​

Methods: support PET via Penman–Monteith, Priestley–Taylor, and Hargreaves–Samani with parameter hooks (e.g., arid_correction) to improve estimates in arid regions, and return results as pandas or xarray with caching for reproducibility.​

Data flow
Inputs: polygon/bbox or line coordinates derived from ERT survey footprint, campaign dates, variable list (e.g., prcp, tmin, tmax, srad, dayl), and PET method with parameters and time scale (daily/monthly/annual).​

Outputs: harmonized climate dataset with PET, plus derived features (e.g., antecedent 1/3/7‑day totals, P−PET) aligned to ERT acquisition timestamps for correlation with resistivity change and moisture maps in the report agent.​

Key capabilities to expose
Retrieval APIs: get_bycoords for points/lines and get_bygeom for polygons, with CRS handling and optional conversion to xarray for gridded studies or multi‑line projects.​

PET configuration: penman_monteith and priestley_taylor accept parameters including soil_heat_flux, albedo, alpha, and arid_correction; hargreaves_samani provides a low‑data alternative for robustness checks.​

Integration with ERT agent
Temporal alignment: map daily series to ERT survey times, compute antecedent and concurrent climate features, and pair them with resistivity/petrophysical outputs from pyGIMLi/ResIPy pipelines for joint analysis and interpretation in the report.​

Cross‑modal reasoning: use climate features to explain or flag resistivity changes (e.g., post‑rainfall decreases, drying during high PET) and feed these cues to the report agent for structured claims and caveats tied to data quality and inversion diagnostics.​

Analyses to automate
Event alignment: detect rainfall/infiltration events and compute resistivity and moisture responses in fixed windows (e.g., 0–3–7 days) to quantify sensitivity and lag at depth.​

Water‑balance proxy: compare changes in moisture estimates against P−PET features to evaluate hydrologic consistency and to identify hysteresis or storage effects across lithologies and seasons.​

Method robustness: report PET method sensitivity by contrasting Penman–Monteith vs Priestley–Taylor vs Hargreaves–Samani and noting parameter effects like arid_correction in arid basins.​

Coupled uncertainty: propagate inversion fit/resolution diagnostics alongside PET method spread to bound hydrologic inferences in the report, with standardized figures and metrics for each site.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 6, 2025 22:30
Co-authored-by: geohang <75149424+geohang@users.noreply.github.com>
Co-authored-by: geohang <75149424+geohang@users.noreply.github.com>
…handling

Co-authored-by: geohang <75149424+geohang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to fetch meteorological data and compute PET Add ClimateDataAgent for PyDaymet integration with ERT workflows Nov 6, 2025
Copilot AI requested a review from geohang November 6, 2025 22:42
@geohang
geohang marked this pull request as ready for review November 6, 2025 22:44
@geohang
geohang merged commit 4c25ae1 into main Nov 6, 2025
2 checks passed
@geohang
geohang deleted the copilot/add-meteorological-data-fetcher branch November 7, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants