Download scripts/result.py from OneScience-Group/Climate2Weather: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/OneScience-Group/Climate2Weather/resolve/main/scripts/result.py
- Command line
-
hf download hf://OneScience-Group/Climate2Weather/scripts/result.py
-
curl -L -o result.py https://huggingface.co/OneScience-Group/Climate2Weather/resolve/main/scripts/result.py
763 Bytes
| from pathlib import Path | |
| import sys,numpy as np;import matplotlib;matplotlib.use('Agg');import matplotlib.pyplot as plt | |
| R=Path(__file__).resolve().parents[1];sys.path.insert(0,str(R));from model.climate2weather import cfg,write | |
| c=cfg(R);d=np.load(R/c['paths']['predictions']);e=d['ensemble'];t=d['target'];mean=e.mean(0);rmse=float(np.sqrt(np.mean((mean-t)**2)));spread=float(e.std(0).mean());pit=float(np.mean(e<t[None]));coherence=float(np.mean(abs(np.diff(mean,axis=0))));write(R/c['paths']['evaluation'],{'rmse':rmse,'spread':spread,'pit_mean':pit,'temporal_difference':coherence,'synthetic':True});plt.imshow(mean[0,0]-t[0,0],cmap='coolwarm');plt.colorbar();p=R/c['paths']['figure'];p.parent.mkdir(parents=True,exist_ok=True);plt.savefig(p,dpi=150);print(p) | |