How do I extract daily data from a NC yearly (which contain 365days) file?

2 次查看(过去 30 天)
I need to extract the daily data from netCDF yearly data which contains 365 days. in the code, the asign prep could not read the variable precipitation from the file
clc
close all
clear all
filename = ('D:\Rainfall_Data_from_Satelite\CHIRPS\chirps-v2.0.2002.days_p05.nc');
info = ncinfo(filename);
% Variable 1
lat = double(ncread(filename,'latitude'));
% Variable 2
lon = double(ncread(filename,'longitude'));
% Variable 3
% data are for each day of the year (2019)
time = ncread(filename,'time');
unitsTime = info.Variables(4).Attributes(1).Value;
fprintf(1,'Time Units: %s\n',unitsTime);
tDatenum = datenum(1980,1,1,time,0,0); %1980-1-1 0:0:0
% Variable 4
prep = ncread(filename,'precip');

回答(1 个)

Augusto Gabriel da Costa Pereira
See, this link below has the answer you want. if you don't get your goal comment here
https://la.mathworks.com/matlabcentral/answers/1882277-error-sending-data-to-xlsx-netcdf?s_tid=mlc_ans_email_view#answer_1133137

标签

Community Treasure Hunt

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

Start Hunting!

Translated by