当前位置: 首页 > 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使用总结
  • 海南一男子涨潮时赶海与同伴走散,警民协同3小时将其救上岸
  • 科普|一名肿瘤医生眼中的肺癌诊疗变化:从谈癌色变到与癌共存
  • 管理规模归零,华夏基金“ETF规模一哥”张弘弢清仓卸任所有产品
  • 履新荆州市委书记次日,汪元程走访看望老同志
  • 货车追尾前车引发LNG泄漏起火,消防救援保住七成快递物资
  • 华勤技术回应H20政策调整:产业链已做充分准备,预计年营收维持20%以上增长