matlab - how to determin the North west radiant score(270-360 degree) to decide score -


i have code in matlab below. code confusing. need decide north west part of disk (270-360) degree if fuel type f3 , f5, shia. need return yes or no shia.

% base path fireline_path = 'documents/fireline/';  % eosd landcover file landcover_file = fullfile(fireline_path,'landcover/eosd/083o_lc_1/083o_lc_1.tif'); [landcover,cmap_landcover,r_landcover0] = geotiffread(landcover_file); proj_landcover = geotiffinfo(landcover_file); pixelsize = 25; % 25m utm grid  % trim raster area around town of lake i_trim = 3001:3500; j_trim = 3001:3500; landcover = landcover(i_trim,j_trim); [x11,y11] = pix2map(r_landcover0,i_trim(1),j_trim(1)); r_landcover = makerefmat(x11,y11,pixelsize,-pixelsize);  % read in damaged propeties , locations in grid damage_shapefile = fullfile(fireline_path,'work/slavelake/damaged_properties_sl.shp'); damage = shaperead(damage_shapefile); x_damage = [damage(~strcmp({damage.damage},'undamaged')).x]; y_damage = [damage(~strcmp({damage.damage},'undamaged')).y]; [i_damage, j_damage] = map2pix(r_landcover,x_damage,y_damage); ind_damage = sub2ind(size(landcover),round(i_damage),round(j_damage));  % create landcover -> fuel mappings fuelmappings = zeros(max(landcover(:)),1); ind_vegclass = [52,81,82,83,100,211,221,231]; % indicies of classes present vegetation veg_loadings = [...     3,...'shrub low'     3,...'wetland-treed'     3,...'wetland-shrub'     1,...'wetland-herb'     1,...'herbs'     5,...'coniferous-dense'     5,...'broadleaf-dense'     5]; %mixedwood-dense' fuelmappings(ind_vegclass) = veg_loadings; landcover(landcover==0) = 1; % set nodata cells 1, map no fuel fuelmap = fuelmappings(landcover);  % create binary fuel map (f3 or f5) fuelmapbw = fuelmap>=3;   %% % flag pixels within 1/2 mile of dense areas shiasum = zeros(size(landcover)); % initialize summary disp('percent of damaged/destroyed properties in shia:') densitythresholds = .25;%[.75, .67, .5, .33, .25]; densitythreshold = densitythresholds      % create filter calculate shia (create disk , 0 out unwanted     % pixels)     shiadistmiles = .5; %miles     shiadistmeters = shiadistmiles*unitsratio('meters','miles');     shiadistpix = shiadistmeters/pixelsize;     hshia = fspecial('disk',shiadistpix);     hshia(1:floor(shiadistpix),:) = 0;     xy = -floor(shiadistpix):floor(shiadistpix);     [x,y] = meshgrid(xy,fliplr(xy));     f70 = -tan(deg2rad(70))*x;     hshia(y<f70) = 0;     f20 = -tan(deg2rad(20))*x;     hshia(y>f20) = 0;     hshia(hshia>0) = 1;     hshia = hshia/sum(hshia(:));      close     shiavals = filter2(hshia,fuelmapbw);     shia = filter2(hshia,fuelmapbw) > densitythreshold;      linkimage(fuelmapbw,shia)     hold on     plot(j_damage,i_damage,'x')     hold off      propsinshia = sum(shia(ind_damage))/numel(ind_damage);      disp(['with threshold of ' num2str(densitythreshold) ':'])     disp(propsinshia * 100)      outfile = [fireline_path 'shia/slavelake_'...         num2str(densitythreshold*100,'%02d') '.tif'];     geotiffwrite(outfile,shia,r_landcover,...         'coordrefsyscode',proj_landcover.geotiffcodes.pcs)      shiasum = shiasum+shia; end   lookup = [0 fliplr(densitythresholds) * 100]; shia = lookup(shiasum+1); outfile = [fireline_path 'shia/slavelake_v2.tif']; geotiffwrite(outfile,uint8(shia),r_landcover,...         'coordrefsyscode',proj_landcover.geotiffcodes.pcs) 


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -