clear all
close all

%where modis files are located
path = '/uufs/chpc.utah.edu/common/home/horel-group4/model/cfoster/matlab/modis/20110101/';

file = [path 'MCD43B3.A2011001.h09v04.005.2011028095641.hdf']
%file = [path 'MCD43B3.A2011001.h09v05.005.2011028013127.hdf']

LatLon=[40.75 111.88;41.16 112.58];

[X,Y,projType,mdist2point,xRes,yRes] = findIndexes(LatLon,file,1);
            
sat=hdfsd('start',file,'read');


albedo = hdfsd('select',sat, 19);

[name,numdim,dimvector,type,numdescr] = hdfsd('getinfo', albedo);

startvector = [0 0];
endvector = dimvector;
stride = [] ;
        
albedovar = hdfsd('readdata', albedo, startvector, stride, endvector);

albedovar=double(albedovar).*.001;
albedovar(albedovar>1)=nan;

figure(1)
h = pcolor(albedovar(400:900,900:1200))
set(h, 'EdgeColor', 'none');
colorbar()
caxis([0.3 0.8])
colormap('jet')