1 function [XH,WH]=wind_at_h(X,CX,W,m,bbox)
2 % [XH,WH]=wind_at_h(X,CX,W,m,bbox)
3 % interpolate wind at model independent mesh size m(1) m(2) m(3)
4 % in a bbox above terrain
7 [XH{1},XH{2},XH{3}]=ndgrid(linspace(bbox(1),bbox(2),m(1)),...
8 linspace(bbox(3),bbox(4),m(2)),...
9 linspace(bbox(5),bbox(6),m(3)));
10 % interpolate terrain from nodes
11 terrain = griddata(X{1}(:,:,1),X{2}(:,:,1),X{3}(:,:,1),XH{1},XH{2});
13 XH{3}(:,:,i)=XH{3}(:,:,i)+terrain;
15 % interpolate wind components from cell centers
17 WH{i}=griddata(CX{1},CX{2},CX{3},W{i},XH{1},XH{2},XH{3});