ldcast_code / ldcast /models /benchmarks /transform.py
weatherforecast1024's picture
Upload folder using huggingface_hub
d2f661a verified
Raw
History Blame Contribute Delete
367 Bytes
import numpy as np
def transform_to_rainrate(x, mean=-0.051, std=0.528, threshold=0.1):
x = x*std + mean
R = 10**x
R[R < threshold] = 0
return R
def transform_from_rainrate(
R, mean=-0.051, std=0.528,
threshold=0.1, fill_value=0.02
):
R = R.copy()
R[R < threshold] = fill_value
return (np.log10(R)-mean) / std