new file: surface_slice.py
[wrf-fire-matlab.git] / cycling / subset_small.m
blob232f1e4257255a03a696eda58d6179dfb42a9e54
1 function r = subset_small(red,n,m,full_set)
2 %interpolates onto smaller grid
3 % red = subset_domain(w)
4 % n,m new size of matrices
5 r = red;
6 % d_lat = (red.max_lat-red.min_lat)/m;
7 % d_lon = (red.max_lon-red.min_lon)/n;
8 % lat = linspace(r.min_lat-d_lat,r.max_lat+d_lat,m+2);
9 % lon = linspace(r.min_lon-d_lon,r.max_lon+d_lon,n+2);
10 lon = linspace(r.min_lon,r.max_lon,n);
11 lat = linspace(r.min_lat,r.max_lat,m);
12 [r.fxlat,r.fxlong]=meshgrid(lat,lon);
14 %interpolate dta to smaller grid
15 F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),red.tign_g(:));
16 r.tign_g = F(r.fxlat,r.fxlong);
18 F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),red.tign(:));
19 r.tign = F(r.fxlat,r.fxlong);
21 if ~exist('full_set','var')
22     full_set = input_num('Interpolate full set of values? Yes = 1',0,1);
23 end
24 if full_set == 1
25     F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),red.nfuel_cat(:),'nearest');
26     r.nfuel_cat = F(r.fxlat,r.fxlong);
27     
28     F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),red.fmc_g (:),'nearest');
29     r.fmc_g  = F(r.fxlat,r.fxlong);
30     
31     F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),red.fhgt(:));
32     r.fhgt = F(r.fxlat,r.fxlong);
33     
34     F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),red.ros(:));
35     r.ros = F(r.fxlat,r.fxlong);
36 end
38 r.red = red;
43 end