Skip to content

Investigate Differences in On-the-Fly Unit Conversion and Raster Calculations #448

Description

@siddharth0248

Summary

While testing the new TiTiler-CMR capabilities, we observed discrepancies between dynamically generated layers and the reference COG products. We'd like to better understand the source of these differences before enabling these features more broadly.

1. On-the-Fly Unit Conversion

TiTiler-CMR can now perform unit conversions directly from NASA CMR. We tested converting MiCASA NPP from kg C/m²/s to g C/m²/day on the fly.

Preview:
https://deploy-preview-858--ghg-demo.netlify.app/exploration?search=&datasets=%5B%7B%22id%22%3A%22micasa-co2-flux-npp-cmr%22%2C%22settings%22%3A%7B%22isVisible%22%3Atrue%2C%22opacity%22%3A100%2C%22analysisMetrics%22%3A%5B%7B%22id%22%3A%22mean%22%2C%22label%22%3A%22Average%22%2C%22chartLabel%22%3A%22Average%22%2C%22themeColor%22%3A%22infographicB%22%7D%5D%2C%22colorMap%22%3A%22purd%22%2C%22reScale%22%3A%7B%22min%22%3A0%2C%22max%22%3A8%7D%2C%22scale%22%3A%7B%22min%22%3A0%2C%22max%22%3A8%7D%7D%7D%2C%7B%22id%22%3A%22micasa-co2-flux-npp-cmr-raw%22%2C%22settings%22%3A%7B%22isVisible%22%3Atrue%2C%22opacity%22%3A100%2C%22analysisMetrics%22%3A%5B%7B%22id%22%3A%22mean%22%2C%22label%22%3A%22Average%22%2C%22chartLabel%22%3A%22Average%22%2C%22themeColor%22%3A%22infographicB%22%7D%5D%2C%22colorMap%22%3A%22purd%22%2C%22reScale%22%3A%7B%22min%22%3A0%2C%22max%22%3A9.25925926e-8%7D%2C%22scale%22%3A%7B%22min%22%3A0%2C%22max%22%3A9.25925926e-8%7D%7D%7D%5D&taxonomy=%7B%7D&date=2024-12-31T06%3A00%3A00.000Z&aois=%5B%5D&dateRange=&dateCompare=

The preview includes:

  • (Monthly-On fly) Net Primary Production (NPP) – on-the-fly converted from the CMR source.
  • (No conversion - Monthly) Net Primary Production (NPP) – raw CMR values for comparison.

You can also compare these with the existing (Monthly Mean) Net Primary Production (NPP) COG layer currently available in the GHG Center.

Observation

We noticed small differences between the converted layer and the reference data. The differences appear to vary spatially, which is unexpected since the unit conversion is simply multiplication by a constant.

2. Raster Calculations

TiTiler-CMR can also generate derived layers through raster expressions.

Preview:
https://deploy-preview-858--ghg-demo.netlify.app/exploration?search=&datasets=%5B%7B%22id%22%3A%22micasa-co2-flux-nbe-m%22%2C%22settings%22%3A%7B%22isVisible%22%3Atrue%2C%22opacity%22%3A100%2C%22analysisMetrics%22%3A%5B%7B%22id%22%3A%22mean%22%2C%22label%22%3A%22Average%22%2C%22chartLabel%22%3A%22Average%22%2C%22themeColor%22%3A%22infographicB%22%7D%5D%2C%22colorMap%22%3A%22coolwarm%22%2C%22reScale%22%3A%7B%22min%22%3A-4%2C%22max%22%3A4%7D%2C%22scale%22%3A%7B%22min%22%3A-4%2C%22max%22%3A4%7D%2C%22analysisVariableOptions%22%3A%5B%22b1%22%5D%2C%22analysisVariable%22%3A%22b1%22%7D%7D%2C%7B%22id%22%3A%22micasa-co2-flux-nbe1-cmr-raster%22%2C%22settings%22%3A%7B%22isVisible%22%3Atrue%2C%22opacity%22%3A100%2C%22analysisMetrics%22%3A%5B%7B%22id%22%3A%22mean%22%2C%22label%22%3A%22Average%22%2C%22chartLabel%22%3A%22Average%22%2C%22themeColor%22%3A%22infographicB%22%7D%5D%2C%22colorMap%22%3A%22coolwarm%22%2C%22reScale%22%3A%7B%22min%22%3A-4%2C%22max%22%3A4%7D%2C%22scale%22%3A%7B%22min%22%3A-4%2C%22max%22%3A4%7D%2C%22analysisVariableOptions%22%3A%5B%22b1%22%5D%2C%22analysisVariable%22%3A%22b1%22%7D%7D%2C%7B%22id%22%3A%22micasa-co2-flux-nbe-cmr-raster%22%2C%22settings%22%3A%7B%22isVisible%22%3Atrue%2C%22opacity%22%3A100%2C%22analysisMetrics%22%3A%5B%7B%22id%22%3A%22mean%22%2C%22label%22%3A%22Average%22%2C%22chartLabel%22%3A%22Average%22%2C%22themeColor%22%3A%22infographicB%22%7D%5D%2C%22colorMap%22%3A%22coolwarm%22%2C%22reScale%22%3A%7B%22min%22%3A-4%2C%22max%22%3A4%7D%2C%22scale%22%3A%7B%22min%22%3A-4%2C%22max%22%3A4%7D%2C%22analysisVariableOptions%22%3A%5B%22b1%22%5D%2C%22analysisVariable%22%3A%22b1%22%7D%7D%5D&taxonomy=%7B%7D&date=2019-05-28T05%3A00%3A00.000Z&aois=%5B%5D&dateRange=

The preview contains:

  • Original NBE COG
  • NBE calculated using Rh + FIRE + FUEL − NPP
  • NBE calculated using NEE + FIRE + FUEL

The documentation references both equations in different places, so we tested both. The NEE + FIRE + FUEL result appears to more closely match the reference COG, although differences remain (particularly over Central Africa).

Expected behavior

Since:

NEE = Rh − NPP

the following expressions should be mathematically equivalent:

NBE = Rh + FIRE + FUEL − NPP

and

NBE = NEE + FIRE + FUEL

Therefore, we would expect both raster calculations to produce identical outputs. The observed differences suggest either:

  • one of the raster expressions may not be evaluated as intended,
  • there is an implementation issue, or
  • numerical precision is affecting the results.

Questions

  • Can we visualize the difference (or residual) between the generated layers and the reference COGs?
  • For the unit conversion, why would multiplying by a constant produce spatially varying differences?
  • For the raster calculations, are both expressions being evaluated correctly?
  • Could these discrepancies simply be due to single- vs. double-precision floating point arithmetic?

Understanding these differences will help determine whether the behavior is expected or if there is an issue in the implementation.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions