how to get the values from netcdf to ascii format through matlab?
조회 수: 2 (최근 30일)
이전 댓글 표시
The data is in .nc form (e.g data.nc). 1) How to extract a grid from this file format? 2) How to find the values of the extracted grid in ascii form?
댓글 수: 2
Ashish Uthama
2014년 8월 13일
Girija, please say more. Its hard to give a helpful answer since your question does not have enough information. For example - how is the data in the netcdf file structured? Do you have lat /lon and data. Are they 1D 2D or nD? What do you mean by ASCII form? As a variable as a CSV file a text file?
To get started, please have a look at the ncread function.
채택된 답변
Chad Greene
2014년 8월 13일
Check out the names of the variables with ncdisp('data.nc') and if one of the variables is lat, you can load it with
lat = ncread('data.nc','lat');
Then you can write variables to ascii with dlmwrite.
댓글 수: 1
Chad Greene
2014년 8월 13일
It is difficult to understand your question. Try to ask a specific question about a specific step that you're having trouble with.
추가 답변 (1개)
Supreeth Subbaraya
2014년 8월 14일
Take a look at the function ncread. Here you can specify the indices of the starting location of a variable and the number of elements to be read. If a variavle "var" is a two dimensional variable, then you can use the following line of code:
ncread('data.nc','var',[1, 1], [1,1])
참고 항목
카테고리
Help Center 및 File Exchange에서 NetCDF에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!