Download scripts/result.py from OneScience-Group/FuXi-Weather: direct link, hf CLI and curl.
- Browser
- Download file 690 Bytes
-
https://huggingface.co/OneScience-Group/FuXi-Weather/resolve/main/scripts/result.py
- Command line
-
hf download hf://OneScience-Group/FuXi-Weather/scripts/result.py
-
curl -L -o result.py https://huggingface.co/OneScience-Group/FuXi-Weather/resolve/main/scripts/result.py
690 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.fuxi_weather import * | |
| c=cfg(R);d=np.load(R/c['paths']['predictions']);p=d['prediction'];truth=np.stack([[sample(i,s+1)[0].numpy() for s in range(12)] for i in range(2)]);rmse=np.sqrt(np.mean((p-truth)**2,axis=(0,2,3,4)));write(R/c['paths']['evaluation'],{'rmse':rmse.tolist(),'is_complete_global':False,'synthetic':True});plt.plot(d['lead_hours'],rmse);plt.xlabel('Lead (h)');plt.ylabel('RMSE');q=R/c['paths']['figure'];q.parent.mkdir(parents=True,exist_ok=True);plt.savefig(q,dpi=150);print(q) | |