Download src/rad_clim.py from weatherforecast1024/unet_code: direct link, hf CLI and curl.
- Browser
- Download file 707 Bytes
-
https://huggingface.co/weatherforecast1024/unet_code/resolve/main/src/rad_clim.py
- Command line
-
hf download hf://weatherforecast1024/unet_code/src/rad_clim.py
-
curl -L -o rad_clim.py https://huggingface.co/weatherforecast1024/unet_code/resolve/main/src/rad_clim.py
707 Bytes
| import os | |
| import torch | |
| import math | |
| import numpy as np | |
| from copy import deepcopy | |
| path_load = '/data/weather2025/NhaBe/train/rad' | |
| path_save = '/data/weather2025/NhaBe' | |
| num = 0 | |
| rad_clim = {} | |
| for name in os.listdir(path_load): | |
| file = np.load(os.path.join(path_load,name)) | |
| for field in file.keys(): | |
| if(num == 0): | |
| rad_clim[field] = file[field] | |
| else: | |
| rad_clim[field] = rad_clim[field] + file[field] | |
| num += 1 | |
| print(num,end='\r') | |
| for field in rad_clim.keys(): | |
| rad_clim[field] = rad_clim[field]/num | |
| rad_clim[field] = np.expand_dims(rad_clim[field],axis =0) | |
| print(rad_clim[field].shape) | |
| np.savez(os.path.join(path_save,'rad_clim.npz'),**rad_clim) |