ua-snap / rasdaman-ingest

Collection of ingredients/configurations + docs for ingesting data into Rasdaman
MIT License
3 stars 0 forks source link

Design freezing index data correction #47

Closed charparr closed 2 years ago

charparr commented 2 years ago

XREF https://github.com/ua-snap/arctic-eds/issues/181

I think editing the function below to remove the low conditional and to always summarize the three largest values will yield correct design values for both freezing and thawing index values.

def avg_extremes(arr, low=True):
    # if first element is np.nan, then all should be
    if np.isnan(arr[0]):
        return np.nan
    # otherwise, sort and return avg
    #  based on `low` param
    arr = np.sort(arr)
    if low:
        return arr[:3].mean()
    else:
        return arr[-3:].mean()