필터 지우기
필터 지우기

How to open a netCDF file

조회 수: 46 (최근 30일)
Thishan Dharshana Karandana Gamalathge
댓글: KSSV 2017년 7월 6일
Hello,
I have a few netCDF files which contain geographical coordinates and values corresponding to those coordinates. For an example longitude, latitude, temperature. How to easily open those files? I found a code with many lines but I wonder whether there is a direct function.

채택된 답변

KSSV
KSSV 2017년 7월 6일
편집: KSSV 2017년 7월 6일
It is very easy to open netCDF files in MATLAB. You only need to know few functions like ncdisp, ncinfo, ncread.
First use ncdisp('myncfile') this will list all the contents of the file like variables (say lon,lat,temp) present in it and their dimensions. Once you know what are the variables present in the file, use ncread to load that variable.
lon = ncread('myncfile','lon') ;
lat = ncread('myncfile','lat') ;
Read about ncdisp and ncread.
  댓글 수: 2
Thishan Dharshana Karandana Gamalathge
Thanks.
KSSV
KSSV 2017년 7월 6일
I hope now you are able to open netCDF. You must remember that if your variable is a 3D i.e say temperature is a 3D matrix. Don't try to load it completely, you can only load a part of the variable which you want. Read the documentation of ncread carefully and thoroughly.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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