Commit 8981f8e7 authored by Willi Rath's avatar Willi Rath
Browse files

Save figure as PNG and avoid time keyword

parent 7cfc6b23
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ for iy = 1 : length(year_folder)
        for ik = 1:length(kk)
            filename_current_day = [filename_year, '/', KK(kk(ik)).name];

            time(ik) = double(ncread(filename_current_day, 'time'));
            time(ik) = time(ik) + datenum(1950, 1, 1, 0, 0, 0);
            time_vec(ik) = double(ncread(filename_current_day, 'time'));
            time_vec(ik) = time_vec(ik) + datenum(1950, 1, 1, 0, 0, 0);

            ugos = double(ncread(filename_current_day, 'ugos'));
            u_geo(:,:,ik) = ugos(idx, idy);
@@ -65,7 +65,7 @@ for iy = 1 : length(year_folder)
        % average and store in final arrays
        u_geo_m(:, :, (iy - 1) * 12 + im) = nanmean(u_geo, 3);
        v_geo_m(:, :, (iy - 1) * 12 + im) = nanmean(v_geo, 3);
        time_m((iy - 1) * 12 + im) = nanmean(time);
        time_m((iy - 1) * 12 + im) = nanmean(time_vec);

        % update status bar
        waitbar(((iy - 1) * 12 + im) / (length(year_folder) * 12), h)
@@ -79,10 +79,12 @@ close(h)
% save as matfile
lon = lon_nc(idx) - 360;
lat = lat_nc(idy);
time = time_m;
time_vec = time_m;
ugeo_mon = u_geo_m;
vgeo_mon = v_geo_m;
save example_07_SLTAC_monthly_mean_uv_off_Brazil lon lat time ugeo_mon vgeo_mon
save ...
    example_07_SLTAC_monthly_mean_uv_off_Brazil ...
    lon lat time_vec ugeo_mon vgeo_mon

% and plot
figure(1);
@@ -93,4 +95,4 @@ m_contourf( ...
    [-.5 : 1 / 63 : .5], 'edgecolor', 'none')
m_gshhs_h('patch', [.5 .5 .5]);
colorbar
savefig('example_07_SLTAC_monthly_mean_uv_off_Brazil.png')
saveas('example_07_SLTAC_monthly_mean_uv_off_Brazil.png', 'png')