当前位置: 首页 > news >正文

matlab读取CMEMS海洋温度数据并调整图片的比例

matlab读取CMEMS海洋温度数据并调整图片的比例

matlab读取CMEMS海洋温度数据并调整图片的比例
matlab读取CMEMS海洋温度数据并调整图片的比例
数据的下载见上期:
链接到CMEMS数据下载{python}
本文还会给出另一个关键技巧:
通常设置图片比列直接可以通过

set(picture,'position',[10 20 3*300,2*300])

但在海图中此设置不起作用。
而需要通过调用函数设置:

daspect([0.8 1 1])  % 设置 X:Y:Z 比例为 2:1:1

直观感受不同比列的图片
图片在这里插入图片描述

图片在这里插入图片描述

图片
在这里插入图片描述

数据的读取:

clear;clc;close all;
%%  step _ 01 read data and get ano data
ncdisp 'cmems_mod_glo_phy_my_0.083deg-climatology_P1M-m_1742636563411.nc'
file = 'cmems_mod_glo_phy_my_0.083deg-climatology_P1M-m_1742636563411.nc';
lon = double(ncread(file,'longitude'));
lat = double(ncread(file,'latitude'));
thetao = squeeze(ncread(file,'thetao'));
数据的画图close all
figure('position',[10 3 650 350],'color','w');
set(gcf,'Position',[100,100,1200,800]);
m_proj('miller','lon',[-180 180],'lat',[-90 90 ]);
m_pcolor(lon,lat,thetao')
shading interp
colormap(jet)
colorbar;
hold on
[C,h]=m_contour(lon,lat,thetao',[0:10:30]);
set(h,'ShowText','on','linestyle','-','Color', 'r','LineWidth',1.5);%显示等值线 ,'TextList',mylabel
clabel(C,h,'fontsize',12,'color','k','LabelSpacing',4000) ;
% m_gshhs_f('patch',[0.7 0.7 0.7],'edgecolor','k','linewidth',1.2);
m_coast('patch',[0.7 0.7 0.7],'edgecolor','k','linewidth',1.2);
m_grid('linest','-.','xtick',8,'ytick',5,'tickdir','in','linewidth',2,'FontName','Times new roman','FontSize',16,'color','k','box','on','fontweight','bold')
title('Aspect ratio is default','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')
export_fig('read_cmems_ratio_original.jpg','-r300')
% 调整比例
title('Aspect ratio is 0.8:1','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')
比例的调整daspect([0.8 1 1])  % 设置 X:Y:Z 比例为 2:1:1
图片的输出export_fig('read_cmems_ratio_1.jpg','-r300')
全部的代码:
clear;clc;close all;
%%  step _ 01 read data and get ano data
ncdisp 'cmems_mod_glo_phy_my_0.083deg-climatology_P1M-m_1742636563411.nc'
file = 'cmems_mod_glo_phy_my_0.083deg-climatology_P1M-m_1742636563411.nc';
lon = double(ncread(file,'longitude'));
lat = double(ncread(file,'latitude'));
thetao = squeeze(ncread(file,'thetao'));close all
figure('position',[10 3 650 350],'color','w');
set(gcf,'Position',[100,100,1200,800]);
m_proj('miller','lon',[-180 180],'lat',[-90 90 ]);
m_pcolor(lon,lat,thetao')
shading interp
colormap(jet)
colorbar;
hold on
[C,h]=m_contour(lon,lat,thetao',[0:10:30]);
set(h,'ShowText','on','linestyle','-','Color', 'r','LineWidth',1.5);%显示等值线 ,'TextList',mylabel
clabel(C,h,'fontsize',12,'color','k','LabelSpacing',4000) ;
% m_gshhs_f('patch',[0.7 0.7 0.7],'edgecolor','k','linewidth',1.2);
m_coast('patch',[0.7 0.7 0.7],'edgecolor','k','linewidth',1.2);
m_grid('linest','-.','xtick',8,'ytick',5,'tickdir','in','linewidth',2,'FontName','Times new roman','FontSize',16,'color','k','box','on','fontweight','bold')
title('Aspect ratio is default','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')
export_fig('read_cmems_ratio_original.jpg','-r300')
% 调整比例
title('Aspect ratio is 0.8:1','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')daspect([0.8 1 1])  % 设置 X:Y:Z 比例为 2:1:1export_fig('read_cmems_ratio_1.jpg','-r300')
% 调整比例
% 调整比例
title('Aspect ratio is 0.5:1','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')daspect([0.5 1 1])  % 设置 X:Y:Z 比例为 2:1:1export_fig('read_cmems_ratio_2.jpg','-r300')
% 调整比例
title('Aspect ratio is 1:1','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')% 调整比例
daspect([1 1 1])  % 设置 X:Y:Z 比例为 2:1:1export_fig('read_cmems_ratio_3.jpg','-r300')
% 调整比例
title('Aspect ratio is 1:1.5','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')% 调整比例
daspect([1 1.5 1])  % 设置 X:Y:Z 比例为 2:1:1export_fig('read_cmems_ratio_4.jpg','-r300')
% 调整比例
title('Aspect ratio is 1:2','FontName','Times new roman','FontSize',16,'color','k','fontweight','bold')% 调整比例
daspect([1 2 1])  % 设置 X:Y:Z 比例为 2:1:1export_fig('read_cmems_ratio_5.jpg','-r300')

相关文章:

  • Linux基础IO(九)之软链接
  • 前端面试真题集合(一)
  • QT聊天项目DAY06
  • 【开发心得】筑梦上海:项目风云录(16)
  • Workflow轻量级工作流引擎实现
  • C++高并发内存池ConcurrenMemoPool
  • mysql8.0.17以下驱动导致mybatis blob映射String乱码问题分析与解决
  • gis系统中如何提高shp大文件加载效率
  • B端可视化像企业数据的透视镜,看清关键信息
  • C 语 言 --- 指 针 3
  • jangow靶机笔记(Vulnhub)
  • 深度学习数据预处理:Dataset类的全面解析与实战指南
  • 在Windows创建虚拟环境如何在pycharm中配置使用
  • 【滑动窗口】最⼤连续 1 的个数 III(medium)
  • MLA(多头潜在注意力)原理概述
  • leetcode 2563. 统计公平数对的数目 中等
  • turtle库绘制进阶图形
  • 【Canvas与旗帜】标准英国米字旗
  • 深入解析进程与线程:区别、联系及Java实现
  • 【大模型框架】LLAMA-FACTORY使用总结
  • 神十九乘组安全顺利出舱
  • 青海省林业和草原局副局长旦增主动投案,正接受审查调查
  • 人民日报评论员:汇聚起工人阶级和广大劳动群众的磅礴力量
  • 深圳宝安区一宗涉宅用地中止出让,起始总价86.27亿元
  • 监狱法修订草案提请全国人大常委会会议审议
  • 上海第三家“胖永辉”在浦东开业,设立了外贸产品专区