필터 지우기
필터 지우기

Mean/max/min map from multiple netcdf file

조회 수: 6 (최근 30일)
Mir Talas Mahammad Diganta
Mir Talas Mahammad Diganta 2021년 5월 14일
답변: Pratyush Roy 2021년 5월 21일
I want to create mean/max/min map from multiple netcdf file (each file contains data for one month) in MATLAB. can anyone help me with the procedure or the code to excute this task?
thank you in advanced.

답변 (1개)

Pratyush Roy
Pratyush Roy 2021년 5월 21일
Hi,
We can use the ncread command for reading the data from NetCDF files.
The following code might be used to read NetCDF files given that all the files are stored in a particular folder called netCDF_files:
folderName = "netCDF_files";
fileinfo = dir(folderName);
fnames = {fileinfo.name};
arr_3d = [];
for i=1:length(fnames)
filePath = fullfile(folderName,fnames{i});
arr = ncread(filePath,variable);%variable is the name of the data variable that we are trying to read.
arr_3d = cat(3,arr_3d,arr);% Here we are assuming that the data obtained using ncread is a 2D array and we are creating a 3D volume by concatenating them
end
mean_nc = mean(arr_3d,3);
max_nc = max(arr_3d,[],3);
min_nc = min(arr_3d,[],3);
Hope this helps!

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by