当前位置:网站首页>Matlab TRMM_ 3b42 data format conversion (NC to TIF, with code)
Matlab TRMM_ 3b42 data format conversion (NC to TIF, with code)
2022-07-20 18:59:00 【A-Chin】
[2021 year 4 month 21 Daily update ]
TRMM_3B42_Daily data 【TRMM (TMPA) Precipitation L3 1 day 0.25 degree x 0.25 degree V7 (TRMM_3B42_Daily)】 No transpose required ;
TRMM_3B42RT_Daily data 【TRMM (TMPA-RT) Near Real-Time Precipitation L3 1 day 0.25 degree x 0.25 degree V7 (TRMM_3B42RT_Daily)】 No transpose required ;
TRMM_3B42RT_3h data 【TRMM (TMPA-RT) Near Real-Time Precipitation L3 3 hour 0.25 degree x 0.25 degree V7 (TRMM_3B42RT)】 Need to transpose .
TRMM_3B42_3h The data of 【TRMM (TMPA) Rainfall Estimate L3 3 hour 0.25 degree x 0.25 degree V7 (TRMM_3B42)】 by HDF Format , This article only considers nc turn tif Format , Not for the moment HDF Format .
See the end of the article for the comparison of the three kinds of data .
[2021 year 7 month 14 Daily update ]
Update Refference = georasterref('RasterSize', size(preciSets), 'Lonlim', [-180 180], 'Latlim', [-50 50])
sentence , The code will adaptively set according to the longitude and latitude range of the data .
in addition ,TMPA-RT The latitude range of is [-60 60].
Source code :
Refference = georasterref('RasterSize', size(preciSets), 'Lonlim', [-180 180], 'Latlim', [-50 50]);
Update code :
Refference = georasterref('RasterSize', size(preciSets), ...
'Lonlim', double([floor(min(lon(:))) ceil(max(lon(:)))]), ...
'Latlim', double([floor(min(lat(:))) ceil(max(lat(:)))]) ...
);
TRMM 3B42 The data goes to tif Format .TRMM Please refer to the blog for data download steps —TRMM Precipitation data download steps .
stay nc File transfer tif When you file , We often encounter the problem of image rotation , Encounter such problems often need to use rot90()
Function transposes the data . But not all nc Data needs to be transposed , Before that, you need to judge the number of rows and columns and longitude and latitude of the data (lon and lat) The length of .
【TRMM_3B42RT_3h Transpose of data cannot be used rot90()
function , Direct use B = A'
that will do 】
In the reading nc File data (data) Part and longitude and latitude to judge . If data The partial array is A x B, and lat The length of is A,lon The length of is B when , There is no need to transpose , for example TRMM 3B42 Of nc4 Format data ,data Part of it is 400 x 1440,lat The length of is 400,lon The length of is 1440, There is no need to transpose ; Otherwise, you need to transpose .
Another problem is through georasterref()
Function to set the geogrid data reference object ( class ) when , We need to pay attention to 'Lonlim'
and 'Latlim'
Value range of , The settings here need reference lon and lat. for example lon For the range of [-179.875 179.875],lat For the range of [-49.875 49.875] when ,‘Lonlim’ and ‘Latlim’ The setting of should be 'Lonlim', [-180 180], 'Latlim', [-50 50]
.
TRMM_3B42RT_3h The data goes to tif The reference code and results of format data are as follows :
%%
clc;
clear;
%%
ncpath = 'D:\20200115\3B42RT.2013092200.7.nc4';
ncinf = ncinfo(ncpath);
preciSets = ncread(ncpath, 'precipitation');
preciSets = preciSets';
lon = ncread(ncpath, 'lon');
lat = ncread(ncpath, 'lat');
OutputPath = 'D:\20200115\3B42RT.2013092200.7.tif';
% Geogrid data reference object ( class )
Refference = georasterref('RasterSize', size(preciSets), ...
'Lonlim', double([floor(min(lon(:))) ceil(max(lon(:)))]), ...
'Latlim', double([floor(min(lat(:))) ceil(max(lat(:)))]) ...
);
% It's written in GeoTif Format % It's written in GeoTif Format
geotiffwrite(OutputPath, preciSets, Refference);
TRMM_3B42_Daily data / TRMM_3B42RT_Daily The data goes to tif The reference code and results of format data are as follows :
%%
clc;
clear;
%%
ncpath = 'D:\20200115\3B42_Daily.20000823.7.nc4';
ncinf = ncinfo(ncpath);
preciSets = ncread(ncpath, 'precipitation');
lon = ncread(ncpath, 'lon');
lat = ncread(ncpath, 'lat');
OutputPath = 'D:\20200115\3B42_Daily.20000823.7.tif';
% Geogrid data reference object ( class )
Refference = georasterref('RasterSize', size(preciSets), ...
'Lonlim', double([floor(min(lon(:))) ceil(max(lon(:)))]), ...
'Latlim', double([floor(min(lat(:))) ceil(max(lat(:)))]) ...
);
% It's written in GeoTif Format % It's written in GeoTif Format
geotiffwrite(OutputPath, preciSets, Refference);
Supplementary comparison :
The show is 2013 year 9 month 22 The data of , The reference figure is https://journals.ametsoc.org/view/journals/wcas/11/2/wcas-d-18-0053_1.xml Of Figure 1(a)
TRMM_3B42_Daily data , Unit is mm d-1,DN The value range is [0, 332.7]:
TRMM_3B42RT_Daily data , Unit is mm d-1,DN The value range is [0, 228.96]:
TRMM_3B42RT_3h( Unit is mm hr-1) Synthetic Daily data (3B42RT.2013092200.7.nc4 / 3B42RT.2013092203.7.nc4 / 3B42RT.2013092206.7.nc4 / 3B42RT.2013092209.7.nc4 / 3B42RT.2013092212.7.nc4 / 3B42RT.2013092215.7.nc4 / 3B42RT.2013092218.7.nc4 / 3B42RT.2013092221.7.nc4),DN The value range is [-19.5, 92.49]( multiply 3 After that is daily):
in addition , TRMM_3B42RT_3h The data has a negative value .
3B42RT.2013092203.7.nc4 Express 2013 year 9 month 22 Japan 3 when ±1.5 Precipitation in an hour , Please refer to TRMM_3B42RT_3h Data home page .
边栏推荐
- 测试岗成功有没有捷径,我告诉你,唯一的捷径就是不走弯路
- 背包问题
- Rambus宣布面向数据中心和PC的DDR5内存接口芯片产品组合
- [software testing] test outline method - Test Case Writing
- Lora and its modulation of IOT chip protocol
- 【软件测试】测试大纲法——测试用例编写
- Database persistence +jdbc database connection
- 软件测试岗——面试时三大灵魂拷问,你受得住吗?
- 大屏:页面在不同比例屏幕的显示适配与字体随屏幕改变而改变(字体随屏幕分辨率改变自适应的问题)
- MSWEP数据nc格式转tif格式
猜你喜欢
tp5.1 foreach在控制器记录中新增加一个字段,其它字段不变也不用重新全部写一遍 (不在模板中操作)(分页)
【软件测试】一两个月带出来的新测试人员,到底有多厉害?
Remember to crawl the search engine thumbnail once and save it locally
Pycharm Debug错误“Process finished with exit code -1073741819 (0xC0000005)”解决方案
关于Visual Code终端乱码问题的解决方案
After graduating from college in 19 years, I chose software testing after recognizing the truth of life
Matlab regression analysis obtains the coefficient, P value and R2 of predictive variables (only one line of code)
大屏:页面在不同比例屏幕的显示适配与字体随屏幕改变而改变(字体随屏幕分辨率改变自适应的问题)
Summary of project experience - send it to the friends of the testing post who are doing the project
Cut rope
随机推荐
地学学术资源II
error: redefinition of
Matlab绘制95%置信区间图
How to solve the user name enumeration vulnerability
为什么测试员和测试工程师的薪酬差距那么大?三分钟你全明白了
Matlab regression analysis obtains the coefficient, P value and R2 of predictive variables (only one line of code)
celery ValueError: not enough values to uppack(expected 3, got 0)
CPU reads and writes to memory
信通院《分布式存储发展白皮书(2022年)》发布:华云数据参与编制 为产业发展提速换挡
如何选择开源的自动化测试框架?这9款开源工具你一定要知道
数据查询必备技能SQL调优:Mysql什么情况下不走索引
接口调试还能这么玩?
[software testing] test outline method - Test Case Writing
MATLAB回归分析获取预测变量的系数和p值和R2(仅一行代码)
Matlab cell保存为.csv格式
多线程FTP项目(4)—— Mysql数据库 + FTP
剪绳子
When running selenium remotedriver, there is a problem with nativeconstructoraccessorimpl Newinstance0 bad sessionnotcreatedexception error
关于Visual Code终端乱码问题的解决方案
DevOps 实践多年,最痛的居然是?