I had a netCDF file comprising of SST data . I plotted a graph using pcolor but now i have to plot same data for a shorter location, i have latitude longitude limits but dont know how to make plot for that specific lat lon limits . Pls help , I am attaching my initial plot

답변 (2개)

KSSV
KSSV 2022년 6월 7일

0 개 추천

Read about interp2.

댓글 수: 4

Isn't there some other way ?? Some change in the existing code?
filename="filepath"
ncdisp(filename)
%degrees east = COADSX=longitude
%degrees north = COADSY = latitude
lat=ncread(filename,'COADSY')
long=ncread(filename,'COADSX')
sst=ncread(filename,'SST')
sst_march=sst(:,:,3:3)
sst_march=sst_march'
[longg, latg] = meshgrid(long, lat);
load coastlines
island = inpolygon(longg, latg, coastlon, coastlat);
sst_march(island)=NaN;
pcolor(longg,latg,sst_march)
hold on
plot(wrapTo360(coastlon), coastlat, 'r.', 'MarkerSize', 6);
set(gca, 'color', 'k');
shading flat
title('SST PLOT')
dx = min(unique(long)) ; % resolution along lon
dy = min(unique(lat)) ; % resolution along lat
xi = 0:dx:360 ;
yi = 80:dy:50 ;
[Xi,Yi] = meshgrid(xi,yi) ;
sst_marchi = interp2(longg,latg,sst_march,Xi,Yi) ;
Arnav Gupta
Arnav Gupta 2022년 6월 7일
since latitude has to be from 80S TO 50S shouldnt i put yi = -80:dy:-50 ;
in data it is given latitude is degrees north
KSSV
KSSV 2022년 6월 7일
Thats fine..check the range or format of the lat, lon.

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

Yang Liu
Yang Liu 2022년 6월 7일
편집: Yang Liu 2022년 6월 7일

0 개 추천

% if you just want to show data in specific extent, set the axis limit as follows after ploting all data
ylim([-80 -50])
% if you want to plot data in specific extent, change your pcolor line as follows
sub = longg > -80 & longg < -50;
pcolor(longg(sub),latg(sub),sst_march(sub));

질문:

2022년 6월 7일

편집:

2022년 6월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by