Transform 2d array latitude into 1d array latitude

5 Ansichten (letzte 30 Tage)
MICHELE GNESOTTO
MICHELE GNESOTTO am 1 Mai 2022
Kommentiert: M_D8993 am 29 Mai 2022
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

Antworten (2)

Tevel Hedi
Tevel Hedi am 1 Mai 2022
search "transpose" in matlab and use that command on your vectors.
  1 Kommentar
MICHELE GNESOTTO
MICHELE GNESOTTO am 1 Mai 2022
it's not working, i want to go from a matrix to vactors , transpose is not recucing the dimension though.

Melden Sie sich an, um zu kommentieren.


Keegan Carvalho
Keegan Carvalho am 1 Mai 2022
Bearbeitet: Keegan Carvalho am 1 Mai 2022
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 Kommentare
MICHELE GNESOTTO
MICHELE GNESOTTO am 1 Mai 2022
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 am 29 Mai 2022
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by