当前位置:网站首页>MSWEP数据nc格式转tif格式
MSWEP数据nc格式转tif格式
2022-04-21 21:43:00 【L-Qin】
这里将数据从0.1°重采样到0.25°
%%
clc;
clear;
%%
fullpath = mfilename('fullpath');
[path, name] = fileparts(fullpath);
%%
ncpath = strcat(path, '\3hourly_nc\');
tifpath = strcat(path, '\tiffile_test\');
files = dir(strcat(ncpath, '*.nc'));
len = length(files);
for i = 1 : len
filename = files(i).name;
filename = filename(1 : size(filename, 2) - 3);
ncfile = strcat(ncpath, filename, '.nc');
ncinf = ncinfo(ncfile);
if size(filename, 2) > 19
filename = filename(1 : 19);
end
%
stryear = filename(1 : 4);
strdays = filename(5 : 7);
strhour = filename(9 : 10);
filedate = datetime(strcat(stryear, '-01-01')) + caldays(str2double(strdays) - 1);
filedate = char(filedate);
filedate = filedate([1 : 4, 6 : 7, 9 : 10]);
filedate = strcat(filedate, strhour);
OutputPath = strcat(tifpath, filedate, '.tif');
if exist(OutputPath, 'file') == 2
[num2str(i), ' ', num2str(len), ' ', filename, ' ', filedate, ' continue']
continue;
end
[num2str(i), ' ', num2str(len), ' ', filename, ' ', filedate]
preciSets = ncread(ncfile, 'precipitation');
preciSets = rot90(preciSets);
% preciSets = preciSets';
lon = ncread(ncfile, 'lon');
lat = ncread(ncfile, 'lat');
[X, Y] = meshgrid(lon, lat);
lat1 = 89.875 : -0.25 : -89.875;
lon1 = -179.875: 0.25 : 179.875;
[XI, YI] = meshgrid(lon1, lat1);
preciSets1 = interp2(X, Y, preciSets, XI, YI, 'linear');
Refference = georasterref('RasterSize', size(preciSets1), 'Lonlim', [-180 180], 'Latlim', [-90 90]);
geotiffwrite(OutputPath, preciSets1, Refference);
end
版权声明
本文为[L-Qin]所创,转载请带上原文链接,感谢
https://blog.csdn.net/L_J_Kin/article/details/124310037
边栏推荐
- Cyclone IV E系列介绍
- Operation instructions of archives management system
- 3D printer cr-10s cr10s Pro ender-3 Ender 3pro Ender 5 how to modify the pulse value or transmission value E of the extrusion motor when replacing the BMG extruder
- Reflex WMS study experience shelf principle
- Anxun cup 2021_ Crypto_ Reappearance
- MySQL最全整理(面试题+笔记+导图),面试大厂不再被MySql难倒
- 华云积极响应合肥高新区抗疫号召:践行社会责任 贡献科技企业力量
- [UML operation contract]
- 自动生成排除某个字段的sql
- Ffmpeg serial 2 - separate video and audio
猜你喜欢

Hard core strength, recognized by many parties | cloud expansion technology, as the core manufacturer of RPA, was selected into the 2022 China RPA procurement guide

FFmpeg连载1-环境搭建

CTF Crypto中涉及的AES题目

MySQL多表查询小练习

After the virtual machine is shut down, restart Linux and restart Oracle monitoring inside

RVB2601之启动流程

Keil Package常用芯片高速下载地址,含历史版本,快关注我速速收藏

IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolved for DNS name问题

Use try-with-resources or close this “FileOutputStream“

安洵杯2021_Crypto_复现
随机推荐
Summary of force deduction method 824 - goat Latin
Common network tools 4: SG broadband tools
Keil Package常用芯片高速下载地址,含历史版本,快关注我速速收藏
[music suitable for programming]
Bailian4006 little rabbit picks up gold coins [simulation]
华云积极响应合肥高新区抗疫号召:践行社会责任 贡献科技企业力量
avformat_ new_ Stream understanding
Reflex WMS system has several similarities with SAP system
AI应用说-生产制造专场(配件安装质检)
安洵杯2021_Crypto_复现
[use case level definition]
[common English words]
Workflow process setting customization development
ISMAR 2022 Journal Paper (TVCG)投稿交流
一加连发两款耳机产品:充电10分钟 听歌20小时
Eeasybi report system data source selection code development manual
JVM 从入门到放弃之 ZGC 垃圾收集器精讲
Relationship between RFCs
[UML operation contract]
Hospital-Oriented RFID Service