Transform 2d array latitude into 1d array latitude
5 次查看(过去 30 天)
显示 更早的评论
Hi, i have downlod the climate projection of sea surface temeperature obtained with the cmip6 model.
My problem is that i have a 2d array for latitude and longitude and my sst is a 3d array sst(tos, i , j) where
the combination of i,j corrisponds to a value for latitude and longitude, i would like to have sst as sst(tos, lon,lat) in order to have
easy way to plot it and confront it with other results. Do you have any advice .
What I want to do is something like : countourf( latitude(i,j) , longitude(i,j) , tos ).
it is not working becasue i and j are vectori and not single values i think.
Thanks
Mike
0 个评论
回答(2 个)
Keegan Carvalho
2022-5-1
编辑:Keegan Carvalho
2022-5-1
Is "tos" the SST variable? I don't see "sst" it in the figure.
If "tos" is the SST variable, then 256 x 220 x 1032 would correspond to lon x lat x time OR lat x lon x time; where "time" would be the SST values for the given "time" (eg. daily/monthly values)
If it is the first instance, then
newsst = permute(tos, [3 1 2]);
% This would make it time x lon x lat
If it the second instance, then
newsst2 = permute(tos, [3 2 1]);
% This would make it time x lat x lon
2 个评论
M_D8993
2022-5-29
Hello! Was wondering whether you found the answer to this? I am also experiencing the same issue of thrying to get latitude and longitude into a vector (i.e. moving from a 2D array to 1D) so I can extract data for a geographical area. I think my indexing is not working because latitude and longitude are 2D.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!