-
Notifications
You must be signed in to change notification settings - Fork 5
Home
HappySpring edited this page Jun 6, 2021
·
11 revisions
Welcome to the Easy_NetCDF wiki!
Here are some additional examples
| current folder
|-- 1993
|-- dt_global_allsat_phy_l4_19930101_20170110.nc
|-- dt_global_allsat_phy_l4_19930102_20170110.nc
|-- dt_global_allsat_phy_l4_19930103_20170110.nc
...
|-- 1994
|-- dt_global_allsat_phy_l4_19940101_20170110.nc
|-- dt_global_allsat_phy_l4_19940102_20170110.nc
|-- dt_global_allsat_phy_l4_19940103_20170110.nc
% Generate monthly mean data
clear
close all
clc
%% parameters ====================================================
input_root = fullfile( '.', 'daily' );
output_dir = 'Monthly_mean_SlefGen';
% output_dir = 'F:\temporary\testnc';
mkdir( output_dir );
file_prefix = 'dt_global_allsat_phy_l4_';
%% ===============================================================
yearlist = 1993:2016;
for year_now = yearlist
for month_now = 1:12
%
timelimit_now = [ datenum(year_now, month_now, 1, 0, 0, 0) datenum( year_now, month_now + 1, 0, 23, 59, 59 ) ];
time_mean = datenum(year_now, month_now, 16);
disp([datestr(now,0) ': start averaging data duirng ' datestr(time_mean,'yyyy-mm') ', timelimit: ' datestr(timelimit_now(1),0) ' to ' datestr(timelimit_now(2),0)])
%
input_dir_now = fullfile( input_root, num2str( year_now ) );
file_marker_now = fullfile( input_dir_now, [ file_prefix num2str(year_now) num2str(month_now,'%02i') '*.nc' ] );
filelist_now = dir( file_marker_now );
compatibility_mode = 0;
merge_dim_name = 'time';
output_filename_now = fullfile( output_dir, [ file_prefix file_prefix num2str(year_now) num2str(month_now,'%02i') '.nc' ] );
FUN_nc_merge_save_mean( input_dir_now, filelist_now, output_filename_now, merge_dim_name, compatibility_mode )
end
end