当前位置: 首页 > 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')
http://www.dtcms.com/a/143783.html

相关文章:

  • 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使用总结
  • 【工控基础】工业相机设置中,增益和数字增益有什么区别?
  • 网络爬虫和前端相关知识
  • 数据结构——栈以及相应的操作
  • 健康养生:拥抱美好生活的基石
  • 9 C 语言变量详解:声明与定于、初始化与赋值、printf 输出与 scanf 输入、关键字、标识符命名规范
  • 嵌入式exfat-nofuse文件系统移植和使用
  • Java核心技术卷第三章
  • 5G基站设计难题:尺寸、重量、功耗和散热
  • Python Requests 库:从安装到精通
  • 【人工智能】Agent智能体关键技术分析