필터 지우기
필터 지우기

Transform 2d array latitude into 1d array latitude

조회 수: 3 (최근 30일)
MICHELE GNESOTTO
MICHELE GNESOTTO 2022년 5월 1일
댓글: M_D8993 2022년 5월 29일
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

답변 (2개)

Tevel Hedi
Tevel Hedi 2022년 5월 1일
search "transpose" in matlab and use that command on your vectors.
  댓글 수: 1
MICHELE GNESOTTO
MICHELE GNESOTTO 2022년 5월 1일
it's not working, i want to go from a matrix to vactors , transpose is not recucing the dimension though.

댓글을 달려면 로그인하십시오.


Keegan Carvalho
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
MICHELE GNESOTTO
MICHELE GNESOTTO 2022년 5월 1일
yes tos is sst variable, sorry for bad explanation. My problem is that latitude is 256x220 and not something like 256x1, so for example when i try to plot with countourf and add the coaslines i have problem to match the graphics since i don't know how how to handle the fact that tos depends on i and j and not on latitude and longitude , where i and j corrisponds to the couple of the matrix of latitude and longitude , that is latitude is i x j and same longitude
M_D8993
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.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by