Analyse Time Series Data based on Seasonality
Show older comments
Hello everyone,
I'm trying to analyse seasonal dataset from 2015 to 2022. I have total 88 'nc' file. file name as "H08_20190301_0000_1MSST200_FLDK.06001_06001.ncI". I aims to seperate data into four seasons (e.g., Spring from March to May). I used coding below to store all data into cell structure.
My problem is I don't know how to scanning the file name to seperate and integrate data into season. For example, this data name ""H08_20190301_0000_1MSST200_FLDK.06001_06001.ncI" provides time in 20190301 belonging to Spring. I need to read specific date time to store all data with same season into one strucuture. Please help me to deal with this. Thank in advance!
pth = 'C:\Users\LongHoang\OneDrive\Desktop\Spring_2023\Ocean_Atmosphere_Mathlab\Mid_Term\H8_SST\H8_SST\';
ncvars = {'lat', 'lon', 'sea_surface_temperature'};
dinfo = dir( fullfile(pth, '*.nc') );
num_files = length(dinfo);
filenames = fullfile( pth, {dinfo.name} );
name = fullfile({dinfo.name}); %I have cell file to store all file name but don't know how to scan the file to get
% date time
lats = cell(num_files, 1);
lons = cell(num_files, 1);
ssts = cell(num_files, 1);
for k = 1: num_files
this_file = filenames{k};
Name_file = name{k};
lats{k} = ncread(this_file, ncvars{1});
lons{k} = ncread(this_file, ncvars{2});
ssts{k} = ncread(this_file, ncvars{3});
end
1 Comment
Peter Perkins
on 6 Apr 2023
Edited: Peter Perkins
on 6 Apr 2023
Long, it's not clear what are in your files. Does each file contain one lat-by-lon SST array for each season in each year? That sounds wrong, because that would be 8*4=32 files, not 88. Does each file contain daily SST values, i.e. lat-by-lon-by-day, over some range, like monthly files?
Accepted Answer
More Answers (0)
Categories
Find more on Electromagnetics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!