Best tool for analysing/altering netcdf data (beyond read-only)
5 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a large netcdf file that I would like to do some processing on. CDO software is not adequate enough and I need to resort to using matlab. I can access the data easily with the 'ncread' commands etc but I would like to know how to apply an analysis (say, an equation using a few varibles of the dataset) on the netcdf file using matlab. For instance, can I use matlab to create a new variable in the netcdf file? I have seen the NCToolBox add on for Matlab but this is read-only.
I have a netcdf file with about 10 climate variables and I would like to implement a scheme to calculate a new variable directly within the netcdf. I can use ncread to read in the data but then I am not too sure how I keep other attributes such as time when performing the calculations. My scheme will involve a few steps as well as boolean analysis, so I am a bit confused there.
Thank you!
Hope I explained that well enough,
0 件のコメント
回答 (3 件)
Ashish Uthama
2015 年 6 月 17 日
Once you get the data into MATLAB using ncread, then you can leverage any of MATLAB's analysis functionality on it (its just numbers to MATLAB at this point).
4 件のコメント
Ashish Uthama
2015 年 6 月 17 日
編集済み: Ashish Uthama
2015 年 6 月 17 日
I am not sure I understand what you mean by - "calculate a new variable directly within the netcdf... ", "keep other attributes"... "boolean analysis". My interpretation - "I want to read multiple variables from a netcdf file, do some computation using all of them and write a new variable back to the same file". Yes, this can be done with ncread, all of MATLAB and ncwrite respectively.
You might get a more helpful answer with a more specific detailed question.
Chad Greene
2015 年 6 月 17 日
I'm not sure what the problem is. NetCDF files contain matrices, which are well suited for Matlab (MatrixLaboratory). To get a variable like sea surface temperature,
sst = ncread('myfile.nc','sst');
Then you can do whatever analysis you want on the sst matrix. After you've used ncread the analysis part of your question has nothing to do with the fact that the matrix originally came from a NetCDF file. When you're satisfied with your analysis, use ncwrite to write a NetCDF file with whatever variables you'd like.
hafez ahmad
2020 年 1 月 16 日
I did in the following way.
NETCDF_File1='C:/Users/hafez/personal/GIS DATA/winds/uv201109.nc'
ncid1 = netcdf.open(NETCDF_File1,'NC_NOWRITE');
lon= netcdf.getVar(ncid1,3);
lat= netcdf.getVar(ncid1,2);
u=netcdf.getVar(ncid1,4);
v=netcdf.getVar(ncid1,5);
w=netcdf.getVar(ncid1,6);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NetCDF についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!