필터 지우기
필터 지우기

How save an Array in nc

조회 수: 4 (최근 30일)
FELIPE PIMENTEL
FELIPE PIMENTEL 2019년 10월 3일
답변: FELIPE PIMENTEL 2019년 10월 3일
Hi,
I had .nc files and I performed some analysis on them.
I now have a single dice in an array with dimensions 360, 181, 348 (lat, lon, time).
How can I save this final data to a nc?

답변 (2개)

meghannmarie
meghannmarie 2019년 10월 3일
You need to save your lat, lon, time, and data to nc file. Look at documentaion for nccreate. It should be something like this but you will probably need to set attributes depending on fill value, time units, etc.
out_nc = 'outfile.nc';
nccreate(out_nc,'lat',...
'Dimensions',{'lat',360});
ncwrite(out_nc,'lat',lat)
nccreate(out_nc,'lon',...
'Dimensions',{'lon',181});
ncwrite(out_nc,'lon',lon)
ncreate(out_nc,'time',...
'Dimensions',{'time',348})
ncwrite(out_nc,'time',time)
nccreate(out_nc,'data',...
'Dimensions',{'lat',360,'lon',181,'time',348})
ncwrite(out_nc,'data', data)

FELIPE PIMENTEL
FELIPE PIMENTEL 2019년 10월 3일
Thank you very much!!!
It worked better than expected.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by