Creating hourly average data with geographic coordinates to produce 3D matrix

4 ビュー (過去 30 日間)
Aristo Pacino
Aristo Pacino 2021 年 7 月 24 日
コメント済み: dpb 2021 年 7 月 26 日
I have 4 column matrix, which include irregular time, temperature, latitude and longitude. I want to creat 3-D matrix such that I have hourly averages of temperature within particular latitude and longitude grid. Thereby producing a 3D matrix of latitude x longitude x hourly averaged temperature.
Please find the attached dataset.
Thanks in advance!
  3 件のコメント
dpb
dpb 2021 年 7 月 25 日
Are there missing hours that would have to be interpolated/filled first (or if missing ignored)?
Aristo Pacino
Aristo Pacino 2021 年 7 月 25 日
Hi @KSSV, please find the attached data file with this reply. They are using hourly decimal units.
Hello @dpb, they are sometimes missing hours and can be considered as NaN. I have attached the data files with this reply .
Thanks for your interest in the my question.

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

採用された回答

dpb
dpb 2021 年 7 月 25 日
編集済み: dpb 2021 年 7 月 25 日
rowfun to the rescue yet again... :)
tData=readtable();
longrid=-180:10:180;
latgrid=-90:10:90;
[~,~,~,tData.lon_g,tData.lat_g]=histcounts2(tData.lon,tData.lat,longrid,latgrid);
tGroup=rowfun(@mean,tData,'InputVariables','temp', ...
'GroupingVariables',{'hour','lon_g','lat_g'}, ...
'OutputVariableNames','temp');
produces:
>> [head(tGroup,5);tail(tGroup,5)]
ans =
10×5 table
hour lon_g lat_g GroupCount temp
____ _____ _____ __________ ______
0 2 14 1 89.94
0 3 5 1 99.68
0 3 7 1 87.31
0 3 9 1 100.86
0 3 15 1 71.35
23 35 14 2 89.96
23 35 15 1 101.81
23 35 16 1 107.89
23 35 18 1 101.6
23 36 9 1 91.3
>>
  6 件のコメント
Aristo Pacino
Aristo Pacino 2021 年 7 月 26 日
Thanks @dpb, but I would like to have gridwise [latitude x longitude] correlation coefficient so as to finally have a contour plot!
dpb
dpb 2021 年 7 月 26 日
Well, that's not the Answer of the link... <VBG>
Then see
doc xcorr2
It's in Signal Processing TB

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

その他の回答 (1 件)

KSSV
KSSV 2021 年 7 月 25 日
T = readtable('New Text document.txt') ;
t = T.hour ;
lon = T.lon ;
lat = T.lat ;
temp = T.temp ;
[c,ia,ib] = unique(t) ;
n = length(c) ;
iwant = cell(n,1) ;
for i = 1:n
iwant{i} = [t(ib==i) lon(ib==i) lat(ib==i) temp(ib==i)] ;
end
  1 件のコメント
Aristo Pacino
Aristo Pacino 2021 年 7 月 25 日
Hi @KSSV, thank you very much but this is not what I desired. Sorry, I might be unclear but I wanted something for e.g within the longitude [-180 -170] and latitude [0 10] grid, I wanted the temperature to be sampled every one hour. So that I have some what like n x m x z matrix, where n is longitudinal size with grid size of 10 degrees, m is latitudinal size with grid size every 10 degrees and z is temperature size at every one hour sampling frequency.
I would be very happy if you could help me further but much thanks for your effort.
Cheers

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

カテゴリ

Help Center および File ExchangeMarine and Underwater Vehicles についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by