WRF-ML / scripts /fake_data.py
zhangrenchao's picture
Publish WRF-ML reproduction
d3225f2 verified
Raw
History Blame Contribute Delete
805 Bytes
from pathlib import Path
import sys,json,torch
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT))
from model.wrf_ml import *
c=load_config(ROOT);x,p,b=synthetic_columns(0);wrf=x.reshape(1,57,1,10);assert preprocess_layout(wrf).shape==(1,57,10) and p.shape==(1,57,4) and b.shape==(1,2);path=ROOT/c["data"]["manifest"];path.parent.mkdir(parents=True,exist_ok=True);path.write_text(json.dumps({"format_version":c["data"]["format_version"],"logical_wrf_grid":[190,170,57],"column_input_shape":[57,10],"profile_target_shape":[57,4],"boundary_target_shape":[2],"input_feature_ledger":INPUT_NAMES,"output_ledger":OUTPUT_NAMES,"feature_ledger_note":"input names are an explicit engineering ledger because the paper omits the list","sampling_minutes":30,"synthetic":True},indent=2));print(path)