# I'm trying to convert a 1 dimension lat,lon,data to 2d data without interpolating (without griddata command). Is this possible?

5 ビュー (過去 30 日間)
DIPENDRA007 2021 年 7 月 24 日

I have a one dimensional latitude,longitude, data. Essentially all are in one dimension. However I want to create a 2D plot with the data.
So, what I want is the data should be in 2D format without using the griddate which uses interpolation. So, in 2D format of data there should be original value of 1D data present at every original latitude, longitude point and other points it will be NaN or zero.

サインインしてコメントする。

### 採用された回答

Chunru 2021 年 7 月 24 日

Updated solution:
dg = 1;
longrid = (-180:dg:180);
latgrid = (-90:dg:90);
z = nan(length(latgrid), length(longrid));
for ilat=1:length(latgrid)
for ilon=1:length(longrid)
ii = T1.LATITUDE-latgrid(ilat)>=-dg/2 & T1.LATITUDE-latgrid(ilat)<dg/2 & ...
T1.LONGITUDE-longrid(ilon)>=-dg/2 & T1.LONGITUDE-longrid(ilon)<dg/2;
z(ilat, ilon) = mean(T1.DATA(ii));
end
end
figure
imagesc(longrid, latgrid, z);
axis xy
xlabel('lon');
ylabel('lat');
colorbar
figure;
cmap = turbo(1024); cmap = cmap(257:768,:);
ax = axesm('MapProjection','apianus','MapLatLimit',[-90 90], 'MapLonLimit', [-180 180]);
[lon, lat] = meshgrid(longrid, latgrid);
geoshow(ax, lat, lon, z, cmap , 'DisplayType', 'image')
Your description of the problem is not detailed. Is this what you want?
n = 100;
lat = rand(n, 1);
lon = rand(n, 1);
z = rand(n, 1);
figure
stem3(lon, lat, z);
xlabel('lon'); ylabel('lat'); zlabel('z');

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by