标签:
1. ArcGIS
Multidimention tools, Make NetCDF Raster Layer
Note:仅通过arcgis很难知道, 显示的图像和真实的图像存在线性关系
通过matlab可查看文件结构:
blh
Size: 561x401x12
Dimensions: longitude,latitude,time
Datatype: int16
Attributes:
scale_factor = 0.0326
add_offset = 1.09e+03
_FillValue = -3.28e+04
missing_value = -3.28e+04
units = ‘m‘
long_name = ‘Boundary layer height‘
2. Matlab
% convert NC to Tiff written by Chengli Wang
%the workfile should be directed to the NC file
clc
clear
file_dir=‘K:\刘磊\U盘内容\张秀英\BaseLayers\Boundary Layer Height\NC\‘;
addpath(file_dir);
out_dir=strcat(file_dir,‘\output‘);
mkdir(out_dir); % create new file
file_id=ls([file_dir,‘*.nc‘]);% find all the *.nc
[m,n]=size(file_id);
%ncdisp(file_id(1,:)); % the workfile should be directed to the NC file
%ncinfo(file_id(1,:));
R=georasterref(‘RasterSize‘,[401 561],‘RasterInterpretation‘,‘cells‘,...
‘Latlim‘,[5 55],‘Lonlim‘,[70 140],‘ColumnsStartFrom‘,‘north‘);
% R=georasterref(‘RasterSize‘,[561 401],‘RasterInterpretation‘,‘cells‘,...
% ‘Latlim‘,[5-0.125 55+0.125],‘Lonlim‘,[70-0.125 140+0.125],‘ColumnsStartFrom‘,‘south‘);
various=‘blh‘;
for A=1:m
YY=file_id(A,1:4);
img=ncread(file_id(A,:),various);
% img=ncread(file_id(A,:),‘/Variables/blh‘)
% lat=ncread(file_id(A,:),‘latitude‘);
% lon=ncread(file_id(A,:),‘longitude‘);
% time=ncread(file_id(A,:),‘time‘);
[a,b,c]=size(img)
for i=1:c
data0=img(:,:,i);
scale_factor=0.032599;
add_offset=1019.5013;
data=data0*scale_factor+add_offset;
data=data‘;
if i>=10
MM=num2str(i);
else MM=strcat(‘0‘,num2str(i));
end
out_id=strcat(out_dir,‘\‘,YY,MM,‘.tif‘)
geotiffwrite(out_id,data,R);
end
end
标签:
原文地址:http://www.cnblogs.com/rockman/p/5018912.html