How can I calculate the percentage of clouds within each grid box i.e. 1 degree x 1 degree?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
darova
el 28 de Mzo. de 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 comentarios
darova
el 29 de Mzo. de 2021
You have 0.05 degree step for lattitude. DO you know how to convert it to kilometers?
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!