Skip to content

Updates to OCI CI

We'd like to make some updates to the CI code! A few things:

  1. Remove the band averaging from the algorithm, and instead just use single OCI bands centered at 665, 681, and 709 for the calculation.
  2. Add an edge pixel filter using NDWI (a different one than in the LANDVI suite) before the calculation. The equation is (rhos560 - rhos842) / (rhos560 + rhos842), also using single bands (i.e., no averaging).
  3. Filter out any pixels below CI = 5e-5

See below for a portion of my code, happy to supply the whole file if it helps:

ds = # SFREFL file with rhos

# filter for NDWI > 0.0, which means pixels are ~water-only pixels
ndwi_ds = get_ndwi(ds)
ds = ds.where(ndwi_ds > 0.0, np.nan)

r665 = ds.sel({"wavelength_3d": 665}, method="nearest")
r681 = ds.sel({"wavelength_3d": 681}, method="nearest")
r709 = ds.sel({"wavelength_3d": 709}, method="nearest")

# Calculate CI (Stumpf et al.)
band_ratio = (681 - 665) / (709 - 665)
ci_cyano = ((r709 - r665)*band_ratio - (r681 - r665))
ci_cyano = ci_cyano.where(np.logical_or((ci_cyano.rhos >= 5.5e-5), (np.isnan(ci_cyano.rhos))), 0)

And for NDWI:

def get_ndwi(ds)
    ds = # rhos from SFREFL
    r560 = ds.sel({"wavelength_3d": 560}, method="nearest")
    r842 = ds.sel({"wavelength_3d": 842}, method="nearest")

    return (r560 - r842) / (r560 + r842)