Regridding 2D TROPOMI methane data without interpolation.
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am working with TROPOMI methane data which is 2D in original format (data file attached). Now I want to collect all the datas falling inside a corser grid of 2.5x2.5 degree without interpolation and count the number of data points falling per grid. I tried histcounts2 but it could count only the data points. I tried Griddata to check with interpolation method and another method (codes attached) by changing the dimensions but no luck.
In griddata- The code fails as I move up the resolution, the coarser the resolution, fewer the data points in the output file.
In the other method- The data points are not collected inside the grids, it gives me NaNs.
2 comentarios
KSSV
el 25 de Jul. de 2022
Your data falls somehwere and your region of interest is something else. Ther eis no data in the region of your interest.
Respuestas (1)
VINAYAK LUHA
el 4 de Feb. de 2024
Hi Deepshikha,
I understand that you are working with the TROPOMI methane data and want to collect using MATLAB all the data falling inside a grid of 2.5x2.5 degree without interpolation and further count the number of data points falling per grid.
You can use the MATLAB "histcount2" for getting the count of datapoints per grid bin and grouping the actual datapoints by the grid bins.
Refer to the following code snippet for the implementation part
1. Finding the count of datapoints per bin
lat_edges = 0:2.5:40;
lon_edges = 60:2.5:100;
% Count the number of points in each bin
[N, lat_bin_edges, lon_bin_edges,binX,binY] = histcounts2(latitudes, longitudes, lat_edges, lon_edges);
% Plot the result using imagesc
figure;
imagesc(lon_bin_edges(1:end-1), lat_bin_edges(1:end-1), N);
axis xy; % To flip the y-axis so that 0 is at the bottom and 40 is at the top
colorbar; % To show the color scale corresponding to the counts
xlabel('Longitude (degrees)');
ylabel('Latitude (degrees)');
title('2.5° x 2.5° Grid Point Counts');
2.Grouping the actual datapoints by the grid bins.
The variables "binX" and "binY" contains the x and y indices of the bin in the 2.5 x 2.5 gridded matrix to which the datapoints belong.
Further, you may refer to the following documentation of "histcounts2" function for more details -
Hope this answers your query,
Thanks
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!