Skip to content

7/8 Add UrbanVPRM model and reference-EVI preprocessing - #44

Open
Timothy-W-Hilton wants to merge 5 commits into
tglauch:mainfrom
Timothy-W-Hilton:feature-urban-vprm
Open

7/8 Add UrbanVPRM model and reference-EVI preprocessing#44
Timothy-W-Hilton wants to merge 5 commits into
tglauch:mainfrom
Timothy-W-Hilton:feature-urban-vprm

Conversation

@Timothy-W-Hilton

Copy link
Copy Markdown

Add UrbanVPRM model and reference-EVI preprocessing

Summary

Add an initial UrbanVPRM extension of the standard VPRM model. It applies the impervious-surface-area (ISA), reference-EVI respiration treatment, and UHI-adjusted temperature drivers from Hardiman et al. (2017), while preserving ordinary VPRM calculations for every non-urban class.

Design

Base-model extension points

The base model now exposes protected GPP and respiration calculation hooks. The existing classwise loop and output assembly remain in the base model. This lets an extension override only the class-specific flux calculation it needs, without duplicating the VPRM prediction workflow.

Urban preprocessing

urban_vprm_preprocessor(vprm_preprocessor) builds a static reference EVI lookup for each satellite-grid cell:

  • eligible reference cells are ISA-zero cells with fractional coverage of a caller-selected vegetated VPRM class;
  • water and non-vegetated classes can therefore be excluded explicitly;
  • the lookup stores nearest-reference row/column indices, distance, the eligibility mask, and available annual EVI extrema.

ISA itself is supplied on the satellite grid by a compatible preprocessing step. The separate GISA-new PR #41 provides one such workflow; this PR does not tie UrbanVPRM to a particular ISA product.

Urban flux model

vprm_urban_model(vprm_base_model):

  • applies UrbanVPRM only to explicitly configured urban classes (default 10 and 11);
  • retains unmodified base-VPRM GPP and respiration for all other classes;
  • accepts a caller-supplied UHI temperature-adjustment callable, rather than embedding region-specific UHI coefficients;
  • implements Hardiman et al. (2017) Appendix A Supplement SI Eqs. 6--8 for urban respiration;
  • converts ISA percentages to a validated 0--1 fraction, allowing only tiny conservative-regridding roundoff beyond the 0--100 percent bounds.

By default, dynamic EVI reference selection finds the nearest eligible cell with finite positive EVI for the current satellite image. The result is cached until the image changes. This avoids using an ISA-zero reference whose EVI is currently cloud-masked or zero while avoiding repeated work for every modelled hour in the same satellite image.

Example

urban_pre = urban_vprm_preprocessor(...)
# Attach ISA using a compatible preprocessing workflow.
urban_pre.add_urban_reference_evi_lookup(
    vegetated_vprm_classes=[3, 4, 6, 7, 9],
)

model = vprm_urban_model(
    vprm_pre=urban_pre,
    met=meteorology,
    fit_params_dict=parameters,
    urban_vprm_classes=(10, 11),
    uhi_temperature_adjustment=lambda temperature, isa, when: temperature,
)

The identity callable in this example represents an explicit zero-UHI assumption; applications should provide a suitable local parameterization when one is available.

Validation

  • Tests confirm the extracted base-model hooks reproduce the former VPRM GPP and respiration equations.
  • UrbanVPRM tests cover the Hardiman ISA/reference-EVI respiration equations, ISA percentage validation, static lookup indexing, dynamic positive-EVI reference selection and cache refresh, and preservation of base behavior for non-urban classes.
  • Focused test suite on this branch: 5 passed.

Timothy W. Hilton added 5 commits August 15, 2026 16:00
Add the UrbanVPRM model subclass and its constructor-level configuration for urban VPRM classes, UHI temperature adjustment, and reference-EVI selection. Later commits implement the UrbanVPRM driver and respiration calculations.
Extract the existing base-VPRM GPP and respiration equations into
protected calculation hooks while preserving the shared prediction loop
and output assembly. Add a numerical regression test to confirm the new
hooks produce the same xarray results as the former inline expressions,
creating a focused override point for UrbanVPRM.
Replace the UrbanVPRM scaffold with a model that applies configurable
UHI-adjusted temperature, normalized ISA, and local reference EVI to
urban and transport classes while retaining base-VPRM behavior
elsewhere. Implement Hardiman Supplement Eqs. 6–8 for respiration,
require explicit UHI adjustment input, and add a numerical regression
test.

Hardiman, B. S., Wang, J. A., Hutyra, L. R., Gately, C. K., Getson, J.
M., & Friedl, M. A. (2017). Accounting for urban biogenic fluxes in
regional carbon budgets. Science of The Total Environment, 592, 366–372.
https://doi.org/10.1016/j.scitotenv.2017.03.028
Cache validated ISA and nearest-reference minimum EVI for each UrbanVPRM
model instance, and cache current reference EVI by selected MODIS
composite. This avoids repeated whole-tile reference gathers for each
urban class and hour while refreshing correctly when the satellite-image
counter changes. Add coverage for ISA bound handling, coordinate-safe
vectorized lookup, cache reuse, and composite refresh.
Add cached per-composite dynamic selection of the nearest zero-ISA
vegetated cell with positive EVI, retain static selection as a fallback,
and return missing respiration rather than magnifying a zero reference
EVI. Record annual extrema for selected static references and add
regression coverage for reference changes between satellite composites.
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.

1 participant