rogerlew / wepppy

Other
12 stars 7 forks source link

remove outliers for snotel data #275

Closed rogerlew closed 4 months ago

rogerlew commented 4 months ago

f(from Anurag)

Hi Roger - could we use this function to remove outliers for snotel data. I think taking interquartile data should work fine. After data is removed then it could be filled as usual from either daymet or gridmet (not sure which one you used):

# Function to remove outliers
def remove_outliers(df, column):
    Q1 = df[column].quantile(0.25)
    Q3 = df[column].quantile(0.75)
    IQR = Q3 - Q1
    lower_bound = Q1 - 1.5 * IQR
    upper_bound = Q3 + 1.5 * IQR
    return df[(df[column] >= lower_bound) & (df[column] <= upper_bound)]

# Remove outliers from TMAX and TMIN
df_clean = remove_outliers(df, 'TMAX')
df_clean = remove_outliers(df_clean, 'TMIN')
rogerlew commented 4 months ago

snotelf tmax and tmin were reversed in the prn

rogerlew commented 4 months ago

image

rogerlew commented 4 months ago

image

rogerlew commented 4 months ago

New fixed snotel files are {snotel_id}_snotelf2.cli

Validation of fix for 1005_CO

.prn image

.cli image