matlab modis sst,MATLAB 处理 MODIS 数据(MOD04_L2)
找了好久,终于找到了一种方法处理 modis 数据。
% Copyright (C) 2015 The HDF Group
% All Rights Reserved
%
% This example code illustrates how to access and visualize LAADS
% MODIS MOD04 L2 swath file in MATLAB.
%
% If you have any questions, suggestions, comments on this example, please use
% the HDF-EOS Forum (http://hdfeos.org/forums).
%
%
% If you would like to see an example of any other NASA HDF/HDF-EOS data
% product that is not listed in the HDF-EOS Comprehensive Examples page
% (http://hdfeos.org/zoo), feel free to contact us at eoshelp@hdfgroup.org
% or post it at the HDF-EOS Forum (http://hdfeos.org/forums).
%
% Usage:save this script and run (without .m at the end)
%
% $matlab -nosplash -nodesktop -r MOD04_L2_A2010001_0000_005_2010005211741_hdf
%
% Tested under: MATLAB R2015a
% Last updated: 2015-07-29
clear
% Set file name and swath name.
FILE_NAME='MOD04_L2.A2015014.1215.006.2015035101044.hdf';
SWATH_NAME='mod04';
% Open HDF-EOS2 file.
file_id = hdfsw('open', FILE_NAME, 'rdonly');
% Open swath.
swath_id = hdfsw('attach', file_id, SWATH_NAME);
% Read data from a data field.
DATAFIELD_NAME='Optical_Depth_Land_And_Ocean';
[data, fail] = hdfsw('readfield', swath_id, DATAFIELD_NAME, [], [], []);
% Read lat and lon data.
[lon, status] = hdfsw('readfield', swath_id, 'Longitude', [], [], []);
[lat, status] = hdfsw('readfield', swath_id, 'Latitude', [], [], []);
% Detach from the Swath Object.
hdfsw('detach', swath_id);
hdfsw('close', file_id);
% Convert the data to double type for plot.
data=double(data);
lon=double(lon);
lat=double(lat);
% Read attributes from the data field
SD_id = hdfsd('start',FILE_NAME, 'rdonly');
sds_index = hdfsd('nametoindex', SD_id, DATAFIELD_NAME);
sds_id = hdfsd('select',SD_id, sds_index);
% Read _FillValue from the data field.
fillvalue_index = hdfsd('findattr', sds_id, '_FillValue');
[fillvalue, status] = hdfsd('readattr',sds_id, fillvalue_index);
% Read units from the data field.
units_index = hdfsd('findattr', sds_id, 'units');
[units, status] = hdfsd('readattr',sds_id, units_index);
% Read scale_factor from the data field.
scale_index = hdfsd('findattr', sds_id, 'scale_factor');
[scale, status] = hdfsd('readattr',sds_id, scale_index);
% Read add_offset from the data field.
offset_index = hdfsd('findattr', sds_id, 'add_offset');
[offset, status] = hdfsd('readattr',sds_id, offset_index);
% Terminate access to the corresponding data set.
hdfsd('endaccess', sds_id);
% Close the file.
hdfsd('end', SD_id);
% Replace the filled value with NaN.
data(data==fillvalue) = NaN;
% Multiply scale and adding offset, the equation is scale *(data-offset).
data = scale*(data-offset);
% Plot the data using contourfm and axesm.
pole=[-90 0 0];
latlim=[-90,ceil(max(max(lat)))];
lonlim=[floor(min(min(lon))),ceil(max(max(lon)))];
min_data=floor(min(min(data)));
max_data=ceil(max(max(data)));
f = figure('Name', FILE_NAME, 'visible', 'off');
% Create the plot.
axesm('MapProjection','eqdcylin',...
'Frame','on','Grid','on', ...
'MeridianLabel','on','ParallelLabel','on','MLabelParallel','south')
coast = load('coast.mat');
% surfm is faster than contourfm.
surfm(lat, lon, data);
colormap('Jet');
h=colorbar();
plotm(coast.lat,coast.long,'k')
% Draw unit.
set(get(h, 'title'), 'string', 'None', ...
'FontSize', 12, 'FontWeight','bold', ...
'Interpreter', 'none');
% Put title.
tstring = {FILE_NAME;DATAFIELD_NAME};
title(tstring, 'Interpreter', 'none', 'FontSize', 16, ...
'FontWeight','bold');
% The following fixed-size screen size will look better in JPEG if
% your screen is too large.
scrsz = [1 1 800 600];
set(f, 'position', scrsz, 'PaperPositionMode', 'auto');
saveas(f, [FILE_NAME '.m.jpg']);
exit;
```
具体使用方法:
修改要处理的file_name
修改输出路径
运行m文件,会在输出路径得到一张处理后的全球图片
可以修改地理位置是输出图片为地区
更详细信息可以访问网址
如果觉得有用请点个赞呗~
matlab modis sst,MATLAB 处理 MODIS 数据(MOD04_L2)相关推荐
- matlab中normfit,MATLAB中如何得到一组统计数据的分布特征
MATLAB中如何得到一组统计数据的分布特征 我想通过MATLAB知道一组统计数据的分布特征,如属于哪种分布,均值方差等,请问如何实现?谢谢! function f=p_judge(A,alpha) ...
- MATLAB中文件的读写和数据的导入导出
http://blog.163.com/tawney_daylily/blog/static/13614643620111117853933/ 在编写一个程序时,经常需要从外部读入数据,或者将程序运行 ...
- 在Matlab中可视化3D体积图像数据,例如MRI图像
转载自Binlin Wu (2020). Visualize 3D volumetric image data such as MRI images in Matlab (https://www.ma ...
- 【 MATLAB 】使用 MATLAB 得到高密度谱(补零得到DFT)和高分辨率谱(获得更多的数据得到DFT)的方式对比(附MATLAB脚本)
上篇博文分析了同一有限长序列在不同的N下的DFT之间的不同: MATLAB ]使用 MATLAB 作图讨论有限长序列的 N 点 DFT(强烈推荐)(含MATLAB脚本) 那篇博文中,我们通过补零的方式 ...
- QT Creator使用matlab库文件读取.mat文件数据
QT Creator使用matlab库文件读取.mat文件数据 一.环境配置 二.关于编程介绍 三.关于使用函数的介绍 1:关于假设数据类型介绍 2:关于使用函数介绍 一.环境配置 第一步先点开我的电 ...
- matlab如何excel数据,Matlab如何读取Excel里的数据
Matlab如何读取Excel里的数据呢?一起看看下面这篇文章吧! 我们可以使用xlswrite,用法是这样的:xlswrite('Excel路径+Excel的名称','需要输出的矩阵名称')当然,如 ...
- matlab输入excel高版本,『matlab读取excel指定列』excel中大量数据如何导入matlab当中?超过1000个数据无法一个一个输入...
如何将excel表格中大量数据导入matlab中并作图 哈哈,选我吧!使用xlsread函数体的语法你在帮助里面搜索xlsread就可以了.我要是现在回答也接翻译帮助文件.xlsread的参数有文件表 ...
- MODIS与Landsat获取LST数据
MODIS与Landsat获取LST数据 MODIS 数据下载 LST数据处理 Landsat 数据下载 *level-1批量下载: LST反演 level-2批量下载: MODIS TERRA为上午 ...
- 用matlab处理表格,matlab删除excel表格数据-如何用matlab处理多个excel表格中的数据...
如何用matlab处理多个excel表格中的数据 biao='D:\Program Files\matlab\bin\filename.xls'; A1=xlsread (biao,'Sheet1', ...
最新文章
- C++访问属性和继承属性浅析
- 丢人现眼……GitHub阿波罗11号代码仓库惨遭中文灌水
- solaris UFS文件系统 要点
- 物理光学 计算倏逝波/渐逝波在界面上存在的范围
- 什么是服务器信息怎么看,怎么查看服务器信息
- tp连接mysql mysql_thinkphp学习简易教程(二) thinkphp连接读取MySQL数据库
- excel 表格lookup 的操作
- 开源Registry项目Harbor源代码结构解析
- python logging模块使用教程
- Linux网络 - 数据包的接收过程
- Oracle的启动和关闭
- 语音识别系统_智能语音识别系统_第三方语音识别系统 - 云+社区 - 腾讯云
- 马老师的996,不是鸡汤,是​我的人生信条!
- 2018年度亚太区最佳机场贵宾室公布
- Web项目中手机注册短信验证码实现的全流程及代码
- 使用云效应用交付平台 AppStack进行应用管理
- OA系统管理项目工作内容
- linux驱动开发之内核线程
- Python基础练习
- Windows 隐藏小电影?
热门文章
- python计算机视觉--全景图像拼接
- ps-混合模式使用技巧
- Java基础习题(四)
- Autojs在线云更新教程
- 分辨率自动调节html,如何让网页自适应手机屏幕分辨率_html/css_WEB-ITnose
- 问题解决:取消Mac下Karabiner-Elements开机时弹出窗口、用Capslock切换中英文输入法、外接机械键盘 option 和 cmd 互换
- 英汉《营销学》常用词汇-1
- python 更换图像背景_Python几行代码更换照片底色 图像处理 openCV
- 为什么说OKRS-E是适合的OKR框架
- 免费论文下载:林巧稚的论文期刊