How can I calculate the percentage of clouds within each grid box i.e. 1 degree x 1 degree?

4 次查看(过去 30 天)
Hello everyone,
My data (clouds: 11376*270) has a spatial resolution of 5 km. It contains values: 1 (clear), 2 (probably clear), 3 (cloudy) and 4 (probably cloudy). How can I calculate the percentage/fraction of clouds within each grid box i.e. 1 degree x 1 degree (for just condition 3 (cloudy))? I want to make a figure of spatial distribution of percentage frequencies of cloudy (case 3).
My code and the figure it produces:
figure
h1=axesm('mercator', 'MapLatLimit',[15 55],'MapLonLimit',[80 150]);
gridm;
framem on;
mlabel on;
plabel on;
xlabel ('Spatial distribution of occurence frequencies (%) of clouds')
tightmap;
geoshow(h1,lat,lon,clouds,'DisplayType','texturemap')
colormap(jet(4))
labels={'Clear','P_Clear','Cloudy','P_Cloudy'};
lcolorbar(labels,'fontweight','bold');
hold on
coast=load('coast');
geoshow(coast.lat, coast.long,'DisplayType','line','Color','red')
Any suggestions what I'm missing or what changes should I need to do in my code?
Kindly help.
  2 个评论
IMC
IMC 2021-3-27
Didn't get your question.
I have data from 2 days (around 18 files/granules per day for my defined area) . And for each granule, latitude and longitude values are different. Below image shows lat values for just one granule (406 rows and 270 columns). Similarly lon and data (clouds) for one granule will also have 406*270.

请先登录,再进行评论。

回答(2 个)

darova
darova 2021-3-28
Here is an example using griddata
% x y v are your data
% create new mesh 0.1 degree in each direciton
x1 = min(x(:)):0.1:max(x(:));
y1 = min(y(:)):0.1:max(y(:));
v1 = griddata(x,y,z,x1,y1); % interpolate data
v11 = v1*0; % preallocate
for i = 1:10:size(x1,1)
for j = 1:10:size(x1,2)
C = v1(i:i+9,j:j+9);
v11(i:i+9,j:j+9) = sum(C(:)==3)/100; % find '3' and sum
end
end
pcolor(v11)
  4 个评论
IMC
IMC 2021-3-28
It's actually data from geostationary satellite and had lat (y) and lon (x) as a column vector. So, I used meshgrid to create a matrix. Below is figure of latitude values (4802*2401).

请先登录,再进行评论。


Bruno Luong
Bruno Luong 2021-3-29
Take a look at function histcount2 and histogram2

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by