# Contour plot of spatial distribution of temperature

7 ビュー (過去 30 日間)
David Lopez 2012 年 5 月 15 日

i have 5 block data i only need 3
Lat lon month year temp
22.25000 -98.25, 1, 2000, 0.1061891
22.25000, -97.75, 1, 2000, 0.2013340
22.25000, -97.25, 1, 2000, -999.9000
22.25000, -96.75, 1, 2000, -999.9000
22.75000, -100.75, 1, 2000, 0.4650421
22.75000, -100.25, 1, 2000, 0.3308848
22.75000, -99.75, 1, 2000, 0.2076520
22.75000, -99.25, 1, 2000, 0.1700439
22.75000, -98.75, 1, 2000, 0.1031799
22.75000, -98.25, 1, 2000, 0.1318403
22.75000, -97.75, 1, 2000, 0.3397914
22.75000, -97.25, 1, 2000, -999.9000
22.75000, -96.75, 1, 2000, -999.9000
23.25000, -100.75, 1, 2000, 0.4653015
23.25000, -100.25, 1, 2000, 0.3465271
i have develop a contour plot of spatial distribution of temperature
even some values have -999.999 some way to interpolate these values and replace it in the vector of temp.
lat=archivo(:,1);
lon=archivo(:,2);
month=archivo(:,3);
year=archivo(:,4);
inc=archivo(:,5);
[m,n]=size(archivo);
nx = length(lon);
ny = length(lat);
[X,Y]=meshgrid(lon,lat);

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

### 採用された回答

Geoff 2012 年 5 月 15 日
I would start by removing the invalid readings:
archivo( archivo(:,5) < -999, : ) = [];
latmin = min(lat); latmax = max(lat);
lonmin = min(lon); lonmax = max(lon);
glat = linspace( latmin, latmax, ceil((latmax-latmin)/0.01) );
glon = linspace( lonmin, lonmax, ceil((lonmax-lonmin)/0.01) );
[X,Y] = meshgrid(glon, glat);
Now, you want to interpolate your data into that grid. Look at the following function:
doc interp2
##### 1 件のコメント表示非表示 なし
David Lopez 2012 年 5 月 15 日
and for plot a spatial distribution which command do you recommend me?

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

### その他の回答 (1 件)

Chad Greene 2021 年 4 月 4 日
The regular quarter-degree spacing of the data suggests that no interpolation is necessary for this dataset--it just needs to be restructured. An easy way to do that is with a function of mine called xyz2grid.
For your matrix M whose columns correspond to [lat, lon, month, year, temp], use longitude as the "x" data and latitude as the "y" data, then grid it up like this:
[Lon,Lat,Temp] = xyz2grid(M(:,2),M(:,1),M(:,5));
Then NaN-out the no-data values like this:
Temp(Temp==-999.9) = nan;

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

### Community Treasure Hunt

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

Start Hunting!

Translated by