遥感地理信息系统遥感

GIMMS NDVI3g转成GeoTif数据格式

2017-10-26  本文已影响34人  zyhthinking

GiMMS ndvi 8km数据(https://glam1.gsfc.nasa.gov/)以 .n07-VI3g 格式存储,不能直接使用ARCGIS打开,提供matlab代码,转换为geotiff格式
代码如下:

% Convert Raw Data(GIMMS NDVI3g) to  
% GeoTIFF and project to GeoCoodSystem 'WGS84'  
% Output:  
% A NDVI file with its real value  
% A flag file indicating the piexl source  
  
  
% Thanks to Li Xu. His blog http://bbs.sciencenet.cn/home.php?mod=space&uid=1148346&view=lixujeremy  
% Thanks to Prof. Nan(giscn@msn.com) for inspiring.  
% His code: http://nanzt.info/2797.html  
  
  
% run as:  ndvi3g2geotiff_Function('D:\gisData\GIMSS_NDVI\3g\1980s\', '*VI3g', 'D:\gisData\GIMSS_NDVI\3g\NDVI_Flag\')  
function [] = ndvi3g2geotiff_Function( inFilePath, inFilePattern, outFilepath )  
  
  
    files = dir( [inFilePath, inFilePattern] );  
  
  
    num_files = length(files);  
  
  
    for i = 1:num_files  
        ndvi_FileName = files(i).name;  
        ndvi3g = [inFilePath, ndvi_FileName];  
        %%ndvi3g='geo82dec15a.n07-VI3g';     
  
  
        % Image info  全球尺度行列数,区域尺度需自行赋值
        col = 4320;  
        row = 2160;  
  
  
        % Read Raw Data  
        fid = fopen(ndvi3g,'r','b');  
        A=fread(fid,col*row, '*int16');  
        fclose(fid);  
        A=reshape(A,row,col);  
        A = A';  
        A = rot90(A,3);  
        A = fliplr(double(A));  
  
  
        % Define the Lat/Long range  
        %LonRange=[-180+1/24:1/12:180-1/24];  
        %LatRange=[-90+1/24:1/12:90-1/24];  
        % Write a Data Referenced to Geographic Coordinates  
        R=georasterref('RasterSize', [row, col], 'Latlim', [-90+1/24, 90-1/24],...  
            'Lonlim', [-180+1/24, 180-1/24], 'ColumnsStartFrom', 'north');  
  
  
  
  
        % Ouput NDVI.tif  
        disp('...Writing out NDVI file...');  
        ndvi=floor(A./10)./1000;  
        ndvipath=[outFilepath, ndvi_FileName, '_NDVI.tif'];  
        geotiffwrite(ndvipath, ndvi, R);  
        fprintf('%s done!\n', ndvipath);  
  
  
        % Output Flag.tif  
        disp('...Writing out Flag file...');  
        flag=A-floor(A./10) .* 10 +1;  
        flagpath=[outFilepath, ndvi_FileName, '_Flag.tif'];  
        geotiffwrite(flagpath, flag, R);  
        fprintf('%s done!\n', flagpath);  
  
  
        disp('END');  
    end  
end  

其中:
NDVI值
Theoretical range between -1 and 1;
values around 0 for bare soil (low or no vegetation)
values of 0.7 or larger for dense vegetation.
Water= -0.1
No Data = -0.05
质量文件
The meaning of the FLAG:
FLAG = 7 (missing data)
FLAG = 6 (NDVI retrieved from average seasonal profile, possibly snow)
FLAG = 5 (NDVI retrieved from average seasonal profile)
FLAG = 4 (NDVI retrieved from spline interpolation, possibly snow)
FLAG = 3 (NDVI retrieved from spline interpolation)
FLAG = 2 (Good value)
FLAG = 1 (Good value)
更详细的数据文档:

链接:http://pan.baidu.com/s/1kVaJUez 密码:zahi

参考:http://blog.csdn.net/giskekezhou/article/details/43800415
http://blog.sciencenet.cn/blog-1148346-841045.html

上一篇下一篇

猜你喜欢

热点阅读