Regridding 2D TROPOMI methane data without interpolation.
6 views (last 30 days)
Show older comments
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 Comments
KSSV
on 25 Jul 2022
Your data falls somehwere and your region of interest is something else. Ther eis no data in the region of your interest.
Answers (1)
VINAYAK LUHA
on 4 Feb 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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!