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

조회 수: 5 (최근 30일)
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 CenterFile Exchange에서 Marine and Underwater Vehicles에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by