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

4 visualizaciones (últimos 30 días)
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 comentarios
dpb
dpb el 25 de Jul. de 2021
Are there missing hours that would have to be interpolated/filled first (or if missing ignored)?
Aristo Pacino
Aristo Pacino el 25 de Jul. de 2021
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.

Iniciar sesión para comentar.

Respuesta aceptada

dpb
dpb el 25 de Jul. de 2021
Editada: dpb el 25 de Jul. de 2021
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 comentarios
Aristo Pacino
Aristo Pacino el 26 de Jul. de 2021
Thanks @dpb, but I would like to have gridwise [latitude x longitude] correlation coefficient so as to finally have a contour plot!
dpb
dpb el 26 de Jul. de 2021
Well, that's not the Answer of the link... <VBG>
Then see
doc xcorr2
It's in Signal Processing TB

Iniciar sesión para comentar.

Más respuestas (1)

KSSV
KSSV el 25 de Jul. de 2021
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 comentario
Aristo Pacino
Aristo Pacino el 25 de Jul. de 2021
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

Iniciar sesión para comentar.

Categorías

Más información sobre Marine and Underwater Vehicles en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by