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

1 Ansicht (letzte 30 Tage)
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 Kommentare
IMC
IMC am 27 Mär. 2021
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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

darova
darova am 28 Mär. 2021
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 Kommentare
IMC
IMC am 28 Mär. 2021
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 am 29 Mär. 2021
You have 0.05 degree step for lattitude. DO you know how to convert it to kilometers?

Melden Sie sich an, um zu kommentieren.


Bruno Luong
Bruno Luong am 29 Mär. 2021
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