NetCDF格式转换TIFF-以全球GIMMS3g-NDVI数据为例.docx

NetCDF格式转换TIFF-以全球GIMMS3g-NDVI数据为例.docx

ID:53279551

大小:128.98 KB

页数:3页

时间:2020-04-02

NetCDF格式转换TIFF-以全球GIMMS3g-NDVI数据为例.docx_第1页
NetCDF格式转换TIFF-以全球GIMMS3g-NDVI数据为例.docx_第2页
NetCDF格式转换TIFF-以全球GIMMS3g-NDVI数据为例.docx_第3页
资源描述:

《NetCDF格式转换TIFF-以全球GIMMS3g-NDVI数据为例.docx》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、NetCDF格式转换TIFF-以全球GIMMS3gNDVI数据为例1.全球GIMMS3gNDVI数据格式为.nc4.通过Matlab中的ncdisp即可查看数据内容。2.数据范围为全球尺度,[-9090][-180180]3.每个GIMMS3gNDVI数据中包含十二幅栅格影像,时间尺度为每月两幅。Matlab代码如下%%clear;clc%%settheinputpathforcontaininginputdataInputPath='input';%readthenerCDF4file%initialimagelat[-

2、9090]lon[-180180]filename='*.nc4';OutputPath=(['output']);ifexist(OutputPath,'dir')==0%whenthedirexist,thevalueis7,orthevalueis0mkdir(OutputPath);%buildthenewdirectendIfiles=dir([InputPath,filename]);nIfiles=length(Ifiles);%%addthereferenceinformation%setthemaximu

3、mandminimunlatitudeandlongitudelatlim=[-9090];lonlim=[-180180];%definethegeo-referenceR=georefcells(latlim,lonlim,[36007200],'ColumnsStartFrom','north');fornf=1:nIfilesIfilename=Ifiles(nf).name;Ifiletime=Ifilename(end-6);year=Ifilename(end-12:end-9);year=str2double

4、(year);IData=ncread([InputPath,Ifilename],'ndvi');%each.nc4filecontain12NDVIimagesinhalfyearifstr2double(Ifiletime)==1Imonth=1;elseImonth=7;endfori=1:12ndvidata=IData(:,:,i);ndvidata=ndvidata';%resamplethedatato0.05degreendvi05deg=imresize(ndvidata,[36007200],'near

5、est');ndvi05deg=double(ndvi05deg)/10000;ndvi05deg(ndvi05deg(:,:)<=0)=NaN;ifmod(i,2)==0ndviname=year*10000+Imonth*100+2;ndviname=num2str(ndviname);%savethematfilesave([OutputPath,ndviname,'.mat'],'ndvi05deg','-v7.3');%saveaTIFFimagegeotiffwrite([OutputPath,ndviname]

6、,ndvi05deg,R);%%converttheNDVIfromhalfmonthtomonth%choosethemaxinumasthemonthndvivlaueNDVImax=ndvi05deg;C1=(NDVImax-NDVI1>=0);C2=(NDVI1-NDVImax>0);NDVImon=C1.*NDVImax+C2.*NDVI1;%savethematfilendviMoname=year*100+Imonth;ndviMoname=num2str(ndviMoname);save([OutputPat

7、h,ndviMoname,'.mat'],'NDVImon','-v7.3');%saveaTIFFimagegeotiffwrite([OutputPath,ndviMoname],NDVImon,R);clearC1C2NDVI1NDVImaxNDVImon;Imonth=Imonth+1;elsendviname=year*10000+Imonth*100+1;ndviname=num2str(ndviname);%savethematfilesave([OutputPath,ndviname,'.mat'],'ndv

8、i05deg','-v7.3');%saveaTIFFimagegeotiffwrite([OutputPath,ndviname],ndvi05deg,R);NDVI1=ndvi05deg;endendend

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。