gitinore *.txt files
[wrf-fire-matlab.git] / femwind / wind_at_h.m
blob5c8ab4ab7faa8782f6868cfc7094e522235d62d6
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
6 % create query mesh
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});
12 for i=1:m(3),
13     XH{3}(:,:,i)=XH{3}(:,:,i)+terrain;
14 end
15 % interpolate wind components from cell centers
16 for i=1:3
17     WH{i}=griddata(CX{1},CX{2},CX{3},W{i},XH{1},XH{2},XH{3});
18 end
19 end