I have attached the data file,'ssh.nc'. I used the following code to obtain regression coefficients between 'bottomT' and 'zos' variables. After which I plotted the coefficients on a map (map1.jpg). I then tried to overlay this map with the world map from the landareas.shp (landonmap1.jpg). Hoowever, the orientation of both maps are not equal. I have used the following code:
lat = ncread('ssh.nc','latitude');
lon = ncread('ssh.nc','longitude');
ssh = ncread('ssh.nc','zos');
t = ncread('ssh.nc','bottomT');
nx=length(lon);
ny=length(lat);
rxy = zeros(nx,ny) ;
sxy = zeros(nx,ny) ;
>> for i=1:nx
for j=1:ny
[r,s] = corr(squeeze(t(i,j,:)),squeeze(ssh(i,j,:)));
rxy(i,j)=r;
sxy(i,j)=s;
end
end
>> pcolor(lon,lat,rxy) ;
shading interp
colorbar
drawnow
hold on
geoshow('landareas.shp', 'FaceColor', [0.15 0.5 0.15])
I tried using view(90, -90) but still face a problem. I would be grateful to receive assistance in this.

 Akzeptierte Antwort

KSSV
KSSV am 24 Dez. 2018

1 Stimme

Try transposing your data while plotting the data.

6 Kommentare

Keegan Carvalho
Keegan Carvalho am 24 Dez. 2018
Thanks KSSV! By the way I have another question regarding the final image. I attached the final output.There appears to be some white pixels, maybe noise which reduces the aesthetics of the output (it's more like a personal viewing preference). I tried looking at some previous questions on the MATLAB community but they're a little different than my requirement.
And I need to remove the white pixels before exporting as an image.
How do I remove it?
untitled.jpg
Try like below:
h = pcolor(lon,lat,rxy) ;
h.EdgeColor = 'none'
colorbar
drawnow
hold on
geoshow('landareas.shp', 'FaceColor', [0.15 0.5 0.15])
Keegan Carvalho
Keegan Carvalho am 24 Dez. 2018
I tried the above code and got a minor change. Still a lot of the white pixels.
Could it be becasue of the data?
Try this:
rxy = fillmissing(rxy,'nearest') ;
h = pcolor(lon,lat,rxy) ;
h.EdgeColor = 'none'
colorbar
drawnow
hold on
geoshow('landareas.shp', 'FaceColor', [0.15 0.5 0.15])
KSSV
KSSV am 24 Dez. 2018
Attach your data...
Keegan Carvalho
Keegan Carvalho am 24 Dez. 2018
I tried the above code and it worked! Thanks once again KSSV

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by