如何算MODIS积雪对不同海拔区域?- 江南体育网页版- - - - -地球科学堆江南电子竞技平台栈交换 最近30从www.hoelymoley.com 2023 - 04 - 08 - t13:38:20z //www.hoelymoley.com/feeds/question/16139 https://creativecommons.org/licenses/by-sa/4.0/rdf //www.hoelymoley.com/q/16139 1 如何算MODIS积雪对不同海拔区域? 伊尔凡 //www.hoelymoley.com/users/12714 2019 - 02年- 02 - t09:05:25z 2019 - 02 - 06 - t15:53:14z < p >我在MOD10C2积雪(8天),当我夹MODIS积雪对不同区域的海拔高度对.i.e总趋势的结果。高海拔低显示积雪和低海拔显示更高的积雪。我用matlab inpolygon函数(inpolygon (yq xq,十五,青年志愿))我无法找出犯错误。< / p > < p >首先,我以这种方式导入数据< / p > < pre > <代码> hdfvars = {‘Eight_Day_CMG_Snow_Cover’,‘Eight_Day_CMG_Clear_Index’,……“Eight_Day_CMG_Cloud_Obscured”、“Snow_Spatial_QA '};测试管理扫描= ' E: \ \ hdf测试”;dinfo = dir (fullfile(管理扫描' * .hdf '));num_files =长度(dinfo);文件名= fullfile(管理扫描,{dinfo.name});Eight_Day_CMG_Snow_Cover =细胞(num_files, 1); Eight_Day_CMG_Clear_Index = cell(num_files, 1); Eight_Day_CMG_Cloud_Obscured = cell(num_files, 1); Snow_Spatial_QA = cell(num_files, 1); for K = 1 : num_files this_file = filenames{K}; Eight_Day_CMG_Snow_Cover{K} = hdfread(this_file, hdfvars{1}); Eight_Day_CMG_Clear_Index{K} = hdfread(this_file, hdfvars{2}); Eight_Day_CMG_Cloud_Obscured{K} = hdfread(this_file, hdfvars{3}); Snow_Spatial_QA{K} = hdfread(this_file, hdfvars{4}); end

Then reshaped data in this way

B2 = zeros(3600,7200,24); for i = 1:3600 for j = 1:7200 B2(i,j,1:24) = reshape(Eight_Day_CMG_Snow_Cover{i,j},[1 3 2]); end end 

Then generate lat lon and subset the area of interest

lon = -180:0.05:180; lat = -90:0.05:90; subsetqa = Eight_Day_CMG_Snow_Cover(2001:2817,4801:5741,:); 

then attempted to extract with elevation polygon, I tried both [monthly] and [8days] fractional snow cover data, elevation polygon are extracted from SRTM DEM. I attempted to use matlab in this way

shapefile = 'shapefile.shp' ; S = shaperead(shapefile) ; N = length(S) ; for i = 1:N plot(S(i).X,S(i).Y) hold on end %% lon = load('testlon.mat') ; lon = lon.testlon ; lat = load('testlat.mat') ; lat = lat.testlat ; [X,Y] = meshgrid(lon,lat) ; data = load('testarray.mat') ; data = data.testarray ; [nx,ny,d] = size(data) ; %%Extract data iwant = cell(d,N) ; for i =1:d A = data(:,:,i) ; for j = 1:N idx = inpolygon(X(:),Y(:),S(i).X,S(i).Y) ; iwant{i,j} = A(idx) ; end 

Then output iwant converted into matrix in this way

test = cell2mat(cellfun(@transpose,iwant,'uniform',0)); 

NOTE: this picture is showing polygon of only one elevation zone and we have six different elevation zones.

enter image description here

//www.hoelymoley.com/questions/16139/-/16170 # 16170 2 答案为如何图Camilo Rada MODIS积雪对不同海拔区域? 卡米洛·Rada //www.hoelymoley.com/users/11908 2019 - 02 - 04 - t17:46:51z 2019 - 02年- 05 - t19:17:21z < p >问题(如果只有一个)的方式导入数据到.mat文件中。如果我提供的文件做< / p > < pre > <代码> data =负载(“sc_8days.mat”);data =数据。sc8days;[nx、纽约、d] =大小(数据);显示亮度图像(数据(:,:1));< /代码> < / pre > < p >我得到这个无稽之谈:< / p > < p > < a href = " https://i.stack.imgur.com/8M5kw.png " rel = " nofollow noreferrer " > < img src = " https://i.stack.imgur.com/8M5kw.png " alt = "在这里输入图像描述" > < / > < / p > < p >和d = 23日MOD10C2数据只有四个乐队:Eight_Day_CMG_Snow_Cover, Eight_Day_CMG_Cloud_Obscured, Eight_Day_CMG_Clear_Index, Snow_Spatial_QA(见< a href = " https://nsidc.org/data/mod10c2 " rel = " nofollow noreferrer " > < / >)产品规格。< / p > < p >然而,如果我直接从.hdf加载数据和图文件共享,与< / p > < pre > <代码> data = hdfread (“MOD10C2.A2000185.006.2016068190452.hdf”、“Eight_Day_CMG_Snow_Cover”);显示亮度图像(数据);< /代码> < / pre > < p >我:< / p > < p > < a href = " https://i.stack.imgur.com/ck4xl.png " rel = " nofollow noreferrer " > < img src = " https://i.stack.imgur.com/ck4xl.png " alt = "在这里输入图像描述" > < / > < / p > < p >这是有意义的和显示实际的数据。< / p > < p >因此,你导入数据到.mat文件事情搞乱。< / p > < p >这条线的误差< / p > < pre > <代码> B2 (i, j,一24)=重塑(Eight_Day_CMG_Snow_Cover {i, j}, [1 3 2]);< /代码> < / pre > < p >因为你分配的像素,j使用数据从一个文件,每个文件的同时,应生成和错误,我不知道这段代码可以运行,像的大小Eight_Day_CMG_Snow_Cover Kx1,你正试图访问元素,j。< / p > < p >,这样太麻烦,避免重塑和使用细胞阵列通过导入:< / p > < pre > <代码> hdfvars = {‘Eight_Day_CMG_Snow_Cover’,‘Eight_Day_CMG_Clear_Index’,…… 'Eight_Day_CMG_Cloud_Obscured', 'Snow_Spatial_QA'}; projectdir = 'E:\test\hdf test'; dinfo = dir( fullfile(projectdir, '*.hdf')); num_files = length(dinfo); filenames = fullfile(projectdir,{dinfo.name}); Eight_Day_CMG_Snow_Cover = zeros(3600,7200,num_files); Eight_Day_CMG_Clear_Index = zeros(3600,7200,num_files); Eight_Day_CMG_Cloud_Obscured = zeros(3600,7200,num_files); Snow_Spatial_QA = zeros(3600,7200,num_files); for K = 1 : num_files this_file = filenames{K}; Eight_Day_CMG_Snow_Cover(:,:,K) = hdfread(this_file, hdfvars{1}); Eight_Day_CMG_Clear_Index(:,:,K) = hdfread(this_file, hdfvars{2}); Eight_Day_CMG_Cloud_Obscured(:,:,K) = hdfread(this_file, hdfvars{3}); Snow_Spatial_QA(:,:,K) = hdfread(this_file, hdfvars{4}); end

So in this case, the variable Eight_Day_CMG_Snow_Cover contains what you wanted to put in B2.

Baidu
map