How to extract perticular variable from multiple netcdf files (daily data). And merge them together as a one .mat file.

조회 수: 8 (최근 30일)
I have sst daily data in .netCDF format from 1990 to 2020. some files have 365 days, some have 366. How can I extract sst variable from each file and make a one single .mat file.
Then how can I calculate climatalogy for each day for 31 years.
file ='sst.day.mean.1990.nc'
following figure shows the 'sst' variable.
I hope to have final .mat file as
total (at least) = '1440*720*11315'

채택된 답변

Asvin Kumar
Asvin Kumar 2021년 6월 25일
편집: Asvin Kumar 2021년 6월 25일
I'm not sure if there is a single function to do that. Here are some functions you can use to create a script for yourself.
  1. ncread to read from you NetCDF files.
  2. dir function with the dir name syntax to get a list all the files in your folder.
  3. save to save the data that has been read into a MAT File.
You can concatenate the matrices along the third dimension before saving them. Admittedly, it will be a large matrix. You can explore tall arrays and other options mentioned on this page about handling Large Files and Big Data.
  댓글 수: 1
Dushantha Sandaruwan WIJENDRA NAIDHELAGE
Thank you very much for your kind advice, i could able to extract . But as you mentioned , i faced a system error due to insufficient memory.I will follow the mentioned path for handling the matrix . Thanks again

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

추가 답변 (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