|
import numpy as np |
|
|
|
def indices(X): |
|
|
|
|
|
|
|
|
|
X["MTCI"] = (X["B06"]-X["B05"])/(X["B05"]-X["B04"]) |
|
X["AWEInsh"] = 4.0*(X["B03"]-X["B11"])-0.25*X["B08"]+2.75*X["B12"] |
|
X["NBSIMS"] = 0.36*(X["B03"]+X["B04"]+X["B08"]) - (((X["B02"]+X["B12"])/X["B03"])+X["B11"]) |
|
X["MuWIR"] = -4.0*((X["B02"]-X["B03"])/(X["B02"]+X["B03"]))+2.0*((X["B03"]-X["B08"])/(X["B03"]+X["B08"]))+2.0*((X["B03"]-X["B12"])/(X["B03"]+X["B12"]))-((X["B03"]-X["B11"])/(X["B03"]+X["B11"])) |
|
X["VARI700"] = (X["B05"]-1.7*X["B04"]+0.7*X["B02"])/(X["B05"]+1.3*X["B04"]-1.3*X["B02"]) |
|
|
|
X["S2WI"] = (X["B05"]-X["B12"])/(X["B05"]+X["B12"]) |
|
|
|
X["NBAI"] = ((X["B12"]-X["B11"])/X["B03"])/((X["B12"]+X["B11"])/X["B03"]) |
|
|
|
X["TCARI"] = 3*((X["B05"]-X["B04"]))-0.2*(X["B05"]-X["B03"])*(X["B05"]/X["B04"]) |
|
|
|
X["WI2015"] = 1.7204+171*X["B03"]+3*X["B04"]-70*X["B08"]-45*X["B11"]-71*X["B12"] |
|
|
|
X["BAIM"] = 1.0/((0.05-X["B08"])**2.0)+((0.2-X["B12"])**2.0) |
|
|
|
X["NDDI"] = (( (X["B08"]-X["B04"])/(X["B08"]+X["B04"])-((X["B03"]-X["B08"])/(X["B03"]+X["B08"])))/((X["B08"]-X["B04"])/(X["B08"]+X["B04"]))+((X["B03"]-X["B08"])/(X["B03"]+X["B08"]))) |
|
X["BCC"] = X["B02"]/(X["B04"]+X["B03"]+X["B02"]) |
|
|
|
X["RCC"] = X["B04"]/(X["B04"]+X["B03"]+X["B02"]) |
|
|
|
X["IKAW"] = (X["B08"]-X["B02"])/(X["B08"]+X["B02"]) |
|
|
|
X["ARI"] = (1/X["B03"])-(1/X["B05"]) |
|
|
|
X["MIRBI"] = 10.0*X["B12"]-9.8*X["B11"]+2.0 |
|
|
|
X["NMDI2"] = (X["B08"]-(X["B11"]-X["B12"]))/(X["B08"]+(X["B11"]-X["B12"])) |
|
|
|
X["TTVI"] = 0.5*((865.0-740.0)*(X["B8A"]-X["B06"]-(X["B07"]-X["B06"])*(783.0-740))) |
|
|
|
X["NHFD"] = (X["B05"]-X["B01"])/(X["B05"]+X["B01"]) |
|
|
|
X["NDSWIR"] = (X["B11"]-X["B8A"])/(X["B11"]+X["B8A"]) |
|
|
|
X["NBRSWIR"] = (X["B12"]-X["B11"]-0.02)/(X["B12"]+X["B11"]+0.1) |
|
|
|
X["NBR"] = (X["B12"]-X["B8A"])/(X["B12"]+X["B8A"]) |
|
|
|
X["NBRplus"] = (X["B12"]-X["B8A"]-X["B03"]-X["B02"])/(X["B12"]+X["B8A"]+X["B03"]+X["B02"]) |
|
|
|
X["NDWI2"] = (X["B02"]-X["B08"])/(X["B02"]+X["B08"]) |
|
|
|
X["NDWI2"] = (X["B01"]-X["B08"])/(X["B01"]+X["B08"]) |
|
|
|
|
|
X["S2REP"] = 705 + 35 * ((((X["B07"] + X["B04"])/2) - X["B05"])/(X["B06"] - X["B05"])) |
|
|
|
|
|
X["CCCI"] = ((X["B08"] - X["B05"]) / (X["B08"] + X["B05"])) / ((X["B08"] - X["B04"]) / (X["B08"] + X["B04"])) |
|
|
|
|
|
X["MCARI"] = ((X["B05"] - X["B04"]) - 2 * (X["B05"] - X["B03"])) * (X["B05"] / X["B04"]) |
|
|
|
|
|
X["TCARI"] = 3 * ((X["B05"] - X["B04"]) - 0.2 * (X["B05"] - X["B03"]) * (X["B05"] / X["B04"])) |
|
|
|
|
|
X["PVI"] = (X["B08"] - 0.3 * X["B04"] - 0.5) / ((1 + 0.3 * 2) ** (1/2.0)) |
|
|
|
|
|
X["ndvi"] = (X["B08"] - X["B04"]) / (X["B08"] + X["B04"]) |
|
|
|
|
|
X["evi"] = 2.5 * (X["B08"] - X["B04"]) / (X["B08"] + 6 * X["B04"] - 7.5 * X["B02"] + 1) |
|
|
|
|
|
X["savi"] = (X["B08"] - X["B04"]) / (X["B08"] + X["B04"] + 0.5) |
|
|
|
X["mndwi"] = (X["B03"] - X["B08"]) / (X["B03"] + X["B08"]) |
|
|
|
|
|
|
|
X["ARVI"] = (X["B08"] - (2 * X["B04"]) + X["B02"]) / (X["B08"] + (2 * X["B04"]) + X["B02"]) |
|
|
|
|
|
X["SIPI"] = (X["B08"] - X["B02"]) / (X["B08"] - X["B04"]) |
|
|
|
|
|
X["RENDVI"] = (X["B06"] - X["B05"]) / (X["B06"] + X["B05"]) |
|
|
|
|
|
X["MRESR"] = (X["B06"] - X["B01"]) / (X["B05"] - X["B01"]) |
|
|
|
|
|
|
|
X["RYI"] = X["B03"] / X["B02"] |
|
|
|
|
|
X["NDYI"] = (X["B03"] - X["B02"]) / (X["B03"] + X["B02"]) |
|
|
|
|
|
X["DYI"] = X["B03"] - X["B02"] |
|
|
|
|
|
X["ACI"] = X["B08"] * (X["B04"] + X["B03"]) |
|
|
|
|
|
|
|
X["CVI"] = (X["B08"] / X["B03"]) * (X["B04"] / X["B03"]) |
|
|
|
|
|
X["AVI"] = (X["B08"] * (1 - X["B04"]) * (X["B08"] - X["B04"])) |
|
|
|
|
|
X["SI"] = ((1 - X["B02"]) * (1 - X["B03"]) * (1 - X["B04"])) |
|
|
|
|
|
X["BSI"] = ((X["B11"] + X["B04"]) - (X["B08"] + X["B02"])) / ((X["B11"] + X["B04"]) + (X["B08"] + X["B02"])) |
|
|
|
|
|
|
|
X["MTCI"] = (X["B06"] - X["B05"])/(X["B05"] - X["B04"]) |
|
|
|
|
|
X["NPCRI"] = (X["B04"] - X["B02"]) / (X["B04"] + X["B02"]) |
|
|
|
|
|
|
|
|
|
|
|
X["BAI"] = 1/((0.1 - X["B04"]) ** 2 + (0.06 - X["B08"]) ** 2) |
|
|
|
|
|
|
|
MTVI2 = list(1.5*(1.2 * (i - j) - 2.5 * (k - j))* ((2 * i + 1)**2-(6 * i - 5 * k ** (1/2.0)) - 0.5)**(1/2.0) for i, j, k in zip(X["B08"], X["B03"], X["B04"])) |
|
X["MTVI2"] = np.array(MTVI2) |
|
|
|
X["NDSI"] = (X["B03"] - X["B11"]) / (X["B03"] + X["B11"]) |
|
|
|
|
|
|
|
|
|
|
|
X["NDMI"] = (X["B08"] - X["B11"])/(X["B08"] + X["B11"]) |
|
|
|
|
|
TNDVI = [(x)**(1/2.0) for x in ((X["B08"] - X["B04"]) / (X["B08"] + X["B04"]) + 0.5)] |
|
X["TNDVI"] = np.array(TNDVI) |
|
|
|
|
|
|
|
X["TVI"] = (120 * (X["B06"] - X["B03"]) - 200 * (X["B04"] - X["B03"])) / 2 |
|
|
|
X["EXG"] = 2 * X["B03"] - X["B04"] - X["B02"] |
|
|
|
X["PSRI"] = (X["B04"] - X["B02"]) / X["B06"] |
|
|
|
|
|
return X |