1. Data Link
https://www.glass.hku.hk/download.html

2. Batch Download Specified Year Data Using MATLAB
base_url = 'https://www.glass.hku.hk/archive/FAPAR/AVHRR/0.05D/';
download_dir = 'D:\GLASS\FAPAR';
if ~exist(download_dir, 'dir')
mkdir(download_dir);
end
start_year = 1985;
end_year = 1987;
year_links = {};
html = webread(base_url);
expr = '<a href="(\d+)/">';
tokens = regexp(html, expr, 'tokens');
for i = 1:length(tokens)
y = str2double(tokens{i}{1});
if y >= start_year && y <= end_year
year_links{end+1} = [base_url tokens{i}{1} '/'];
end
end
for y = 1:length(year_links)
year_url = year_links{y};
year_name = regexp(year_url, '/(\d+)/$', 'tokens');
year_name = year_name{1}{1};
year_dir = fullfile(download_dir, year_name);
if ~exist(year_dir, 'dir')
mkdir(year_dir);
end
try
html_year = webread(year_url);
catch
continue;
end
hdf_expr = '<a href="([^"]+\.hdf)">';
hdf_tokens = regexp(html_year, hdf_expr, 'tokens');
for h = 1:length(hdf_tokens)
hdf_name = hdf_tokens{h}{1};
hdf_url = [year_url hdf_name];
save_path = fullfile(year_dir, hdf_name);
if exist(save_path, 'file')
continue;
end
options = weboptions('Timeout', 60);
try
data = webread(hdf_url, options);
fid = fopen(save_path, 'w');
fwrite(fid, data);
fclose(fid);
catch
pause(5);
end
end
end
3. Viewing HDF Attributes with Panoply
4. Convert HDF to TIFF Using MATLAB
input_folder = 'D:\GLASS\FAPAR';
output_folder = 'D:\GLASS\FAPAR_TIF';
years = dir(fullfile(input_folder, '*'));
years = years([years.isdir] & ~startsWith({years.name}, '.'));
for y = 1:length(years)
year_folder = fullfile(input_folder, years(y).name);
out_year_folder = fullfile(output_folder, years(y).name);
if ~exist(out_year_folder, 'dir')
mkdir(out_year_folder);
end
hdf_files = dir(fullfile(year_folder, '*.hdf'));
for f = 1:length(hdf_files)
hdf_path = fullfile(year_folder, hdf_files(f).name);
info = hdfinfo(hdf_path);
fapar_data = [];
for v = 1:length(info.Vgroup)
if strcmp(info.Vgroup(v).Name, 'GLASS09B02')
data_fields = info.Vgroup(v).Vgroup(1);
for d = 1:length(data_fields.SDS)
if strcmp(data_fields.SDS(d).Name, 'FAPAR')
fapar_data = hdfread(hdf_path, data_fields.SDS(d).Name);
end
end
end
end
if isempty(fapar_data)
continue;
end
fapar_data = double(fapar_data) * 0.004;
fapar_data(fapar_data < 0 | fapar_data > 1) = NaN;
fapar_data = flipud(fapar_data);
R = georefcells([-90 90], [-180 180], size(fapar_data));
[~, name, ~] = fileparts(hdf_files(f).name);
tif_path = fullfile(out_year_folder, [name, '_FAPAR.tif']);
geotiffwrite(tif_path, fapar_data, R);
end
end

