Regridding 2D TROPOMI methane data without interpolation.

6 visualizzazioni (ultimi 30 giorni)
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 Commenti
KSSV
KSSV il 25 Lug 2022
Your data falls somehwere and your region of interest is something else. Ther eis no data in the region of your interest.
Deepshikha Dadhwal
Deepshikha Dadhwal il 25 Lug 2022
Modificato: Deepshikha Dadhwal il 25 Lug 2022
Hello Sir,
The original data in the file is over the Indian region and so is my desired region (Lon at [60 100] and Lat at [0 40]). I think in your plot these two are interchanged.
Panply shot of the same file attached here for reference
Also, even if the desired grids are set to global grids ([-180 180] and [-90 90]), the data was expected to fall in it's designated grids as per it's lat-lon.

Accedi per commentare.

Risposte (1)

VINAYAK LUHA
VINAYAK LUHA il 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

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by