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

1 回表示 (過去 30 日間)
IMC
IMC 2021 年 3 月 27 日
編集済み: IMC 2021 年 9 月 2 日
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 件のコメント
Image Analyst
Image Analyst 2021 年 3 月 27 日
How many rows and columns correspond to one degree?
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).
darova
darova 2021 年 3 月 29 日
You have 0.05 degree step for lattitude. DO you know how to convert it to kilometers?

サインインしてコメントする。


Bruno Luong
Bruno Luong 2021 年 3 月 29 日
Take a look at function histcount2 and histogram2

Community Treasure Hunt

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

Start Hunting!

Translated by