Grid to time and Grid to lon/lat conversion
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have rotated the current grid and then plot. But the plot is giving on grid for both axis. How can I show (lat,lon) on y axis and time on x axis.
I tried to use datetick; but it's giving wrong date.
(As the grid is rotated; everything is calculated acordingly. Also because of grid rotation there should be lat and lon both on y axis.)
[NTR NIR]=size(UTR);
[NTR NIR]=meshgrid(1:NIR,1:NTR);
figure(4); clf; quiver(NIR,NTR,UTR,VTR,1,'k')
% set(gca,'xlim',[ min(TIMEw) max(TIMEw)])
datetick('x','mm/dd/yy','keeplimits','keepticks')
1 个评论
Walter Roberson
2020-10-20
It is not clear that it makes sense to display a time axes in that plot. Your X and Y are NIR and NTR which go up to about 320 and 55 respectively. Is the 320 intended to be days? If so then for mm/dd/yy to be meaningful there would need to be a base date to start from.
回答(1 个)
Tanziha Mahjabin
2020-10-21
3 个评论
dpb
2020-10-21
time=ncread(fileIn, 'TIME');
reftime=ncreadatt(fileIn,'TIME','units'); reftime=reftime(12:end-4);
reftime=datenum(reftime,'yyyy-mm-dd HH:MM:SS');
time=time+reftime;
Don't use deprecated datenum, use datetime instead. Then plot routines are datetime aware and you'll get time axes automagically if using a datetime variable as the abscissa.
If the time is some number of time units from a reference, it will be a duration added to the reference datetime
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!