Download ldcast/models/benchmarks/transform.py from weatherforecast1024/ldcast_code: direct link, hf CLI and curl.
- Browser
- Download file 367 Bytes
-
https://huggingface.co/weatherforecast1024/ldcast_code/resolve/main/ldcast/models/benchmarks/transform.py
- Command line
-
hf download hf://weatherforecast1024/ldcast_code/ldcast/models/benchmarks/transform.py
-
curl -L -o transform.py https://huggingface.co/weatherforecast1024/ldcast_code/resolve/main/ldcast/models/benchmarks/transform.py
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 | |