|
| 1 | +# PEcAn-to-ILAMB Conversion |
| 2 | + |
| 3 | +Converts PEcAn SDA carbon reanalysis outputs (downscaled GeoTIFF ensemble maps) |
| 4 | +into ILAMB-compatible CF-convention netCDF files for benchmarking against |
| 5 | +TRENDY, CMIP, and observational datasets. |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The PEcAn North American carbon reanalysis (Zhang et al. 2026) provides |
| 10 | +downscaled 1 km ensemble maps of four state variables. This tool reads those |
| 11 | +GeoTIFFs, computes the ensemble mean, coarsens to ILAMB's default 0.5 degree |
| 12 | +resolution, applies unit conversions, and writes CF-1.8 compliant netCDF that |
| 13 | +ILAMB can ingest directly. |
| 14 | + |
| 15 | +## Input |
| 16 | + |
| 17 | +GeoTIFF ensemble maps organized as: |
| 18 | + |
| 19 | +``` |
| 20 | +<input_dir>/<year>/<variable>_<year>/ensemble_<n>_<year>_<variable>.tiff |
| 21 | +``` |
| 22 | + |
| 23 | +- 13 years (2012-2024), annual snapshots fixed to July 15 |
| 24 | +- 4 variables, 100 ensemble members each |
| 25 | +- 1 km resolution (9360 x 19080), EPSG:4326 |
| 26 | + |
| 27 | +## Variable mapping and unit conversions |
| 28 | + |
| 29 | +| PEcAn variable | CMOR name | Source units | Conversion | ILAMB units | |
| 30 | +|----------------|-----------|--------------|------------|-------------| |
| 31 | +| AbvGrndWood | cVeg | Mg C ha-1 | x 0.1 | kg m-2 | |
| 32 | +| TotSoilCarb | cSoil | kg C m-2 | none | kg m-2 | |
| 33 | +| SoilMoistFrac | mrsol | vol. percent | x 9.98 | kg m-2 | |
| 34 | +| LAI | lai | m2 m-2 | none | m2 m-2 | |
| 35 | + |
| 36 | +**Aboveground biomass** is already a carbon density (Mg C ha-1), so the |
| 37 | +conversion to kg m-2 is purely unit scaling: 1 Mg ha-1 = 0.1 kg m-2. |
| 38 | + |
| 39 | +**Soil moisture** is volumetric water content expressed as percent over the |
| 40 | +0-100 cm root zone. Conversion to mass per area: |
| 41 | + |
| 42 | +``` |
| 43 | +kg m-2 = percent / 100 x 1.0 m depth x 998 kg/m3 = percent x 9.98 |
| 44 | +``` |
| 45 | + |
| 46 | +The 0-100 cm root-zone depth was confirmed with the dataset author |
| 47 | +(D. Zhang, pers. comm.), and matches the depth span of the ILAMB Wang2021 |
| 48 | +soil-moisture benchmark (0-10, 10-30, 30-50, 50-100 cm layers). |
| 49 | + |
| 50 | +## Output |
| 51 | + |
| 52 | +CF-1.8 compliant netCDF on a 0.5 degree regular grid (156 x 318) covering the |
| 53 | +North American study area (7-85N, 179-20W): |
| 54 | + |
| 55 | +- `<output_dir>/<cmor_name>/<cmor_name>_<year>.nc` (one file per year) |
| 56 | +- `<output_dir>/<cmor_name>.nc` (merged multi-year file) |
| 57 | + |
| 58 | +Latitude is monotonically increasing (south to north); coordinates are rounded |
| 59 | +to 0.01 degrees; time is encoded as days since 1850-01-01 with full-year |
| 60 | +bounds. |
| 61 | + |
| 62 | +## Usage |
| 63 | + |
| 64 | +```bash |
| 65 | +module load python3 gcc/13.2.0 |
| 66 | +export PATH=$HOME/.local/bin:$PATH |
| 67 | + |
| 68 | +# Convert all variables, all years |
| 69 | +python convert_geotiff_to_ilamb.py \ |
| 70 | + --input_dir /path/to/NA_SDA_maps_zipped \ |
| 71 | + --output_dir /path/to/output |
| 72 | + |
| 73 | +# Single variable / year range |
| 74 | +python convert_geotiff_to_ilamb.py --variables AbvGrndWood --years 2014 2014 |
| 75 | + |
| 76 | +# Skip the merge step |
| 77 | +python convert_geotiff_to_ilamb.py --skip-merge |
| 78 | +``` |
| 79 | + |
| 80 | +On an HPC system, reading 100 full-resolution members per variable exceeds |
| 81 | +interactive CPU limits; submit the full run as a batch job. |
| 82 | + |
| 83 | +## Testing |
| 84 | + |
| 85 | +```bash |
| 86 | +pytest test_convert.py -v |
| 87 | +``` |
| 88 | + |
| 89 | +13 tests cover file existence, CMOR variable naming, all four unit |
| 90 | +conversions, output grid shape, CF-1.8 compliance, latitude direction, |
| 91 | +spatial coverage, chronological multi-year merging, and ILAMB `ModelResult` |
| 92 | +loading. Set `ILAMB_OUTPUT_DIR` to point the tests at your output directory. |
| 93 | + |
| 94 | +## Dependencies |
| 95 | + |
| 96 | +`numpy`, `xarray`, `rasterio`, `netCDF4`, and `ILAMB` (for the loading test). |
| 97 | + |
| 98 | +## Notes |
| 99 | + |
| 100 | +- Fluxes (GPP, NEE) are not included; the downscaled product covers only the |
| 101 | + four state variables above. Flux benchmarking will draw from the raw SDA |
| 102 | + netCDF outputs in a later contribution. |
| 103 | +- A known structural discontinuity exists in the underlying LandTrendr input |
| 104 | + around 2017-2018 (see the ORNL DAAC documentation); it is preserved as-is in |
| 105 | + the converted output rather than adjusted here. |
0 commit comments