- Extract surface current data on HPC
for i in {1..30}
do
printf -v nn "%04d" ${i}
xtmp="ncks -C -v lonc,latc,u,v,Times -F -d siglay,1 superior_${nn}.nc current/cur_${nn}.nc"
echo ${xtmp}
eval ${xtmp}
done
#
- Download current data.
- Use Matlab plot quiver figures of every moment.
clc; clear all;close all;
%% save google map as background
figure(1);clf;hold on;box on;
set(gca,'tickdir','out');
target_axis=[-90 -87 46.7 48.2];
axis(target_axis);
plot_google_map('maptype','satellite','scale',2,...
'FigureResizeUpdate',0,'AutoAxis',1,'Refresh',1);
gmapfile=['fig_google_map_png_superior.fig']
saveas(gcf,[gmapfile],'fig');
%% load current data
day_start=200;
day_end=200;
for i=day_start:day_end
i
ncfile=['cur_',num2str(i,'%.4i'),'.nc'];
ncload([ncfile]);
xlon1=lonc-360;
xlat1=latc;
u1=u;
v1=v;
Times1=Times;
clear ind1 ind2
ind1=find(xlon1>target_axis(1) & xlon1<target_axis(2) & xlat1>target_axis(3) & xlat1<target_axis(4));
xlon0=xlon1(ind1);
xlat0=xlat1(ind1);
uu1=squeeze(u1(:,:,ind1));
vv1=squeeze(v1(:,:,ind1));
%
ind2=readselect(xlon0,xlat0,xlon0,0.0004);
% set a maximum/minimum threshold value
thd=0.2;
uu1=max(min(uu1,thd),-thd);
vv1=max(min(vv1,thd),-thd);
% plot
sf1=1e-1*5;
fts=12;
start_hour=24;
end_hour=24;
for t=start_hour:end_hour
t
close all;
openfig([gmapfile]);hold on;
figure(1);hold on;
quiver(xlon0(ind2),xlat0(ind2),uu1(t,ind2)'.*sf1,vv1(t,ind2)'.*sf1,0,'m');
axis(target_axis);
text(-89.95,48.13,['arrowsizesizesiz'],...
'color','w','background','w','edgecolor','k','fontsize',fts,'fontweight','bold');
quiver(-89.9,48.13,0.4.*sf1,0.*sf1,0,'color','m','linewidth',1.5,'maxheadsize',2);
text(-89.6,48.13,['0.4 m/s '],'color','k','fontsize',fts,'fontweight','bold');
text(-87.87,48.13,[Times1(t,1:19)],...
'color','k','background','w','edgecolor','k','fontsize',fts,'fontweight','bold')
saveas(gcf,['figure/surface_cur_day',num2str(i,'%.3i'),'_hour',num2str(t,'%.2i'),'.png'],'png');
end
end
- Generate daily movie.
for t in {213..243}
do
printf -v m "%03d" $t
echo ${m}
xdate=$(date -d "2023-01-01 +$(( ${t} - 1 )) days" +%Y%m%d)
echo ${xdate}
# generate forecast moives
ff=$(date -d "${xdate} +$(( 0 )) days" "+%Y-%m-%d")
xdir="fig_uv_5m_avg_zoomIn_daily"
outdir="${xdir}/${ff}"
tmp="convert -thumbnail x80 ${xdir}/logo_GLRC_NML_XUE_new.png ${xdir}/logo_tmp.png"
echo ${tmp}
#eval ${tmp}
mkdir -p ${outdir}/ori_nologo
for i in {1..24}
do
printf -v j "%02d" $i
echo ${j}
mv figure_tobacco/surface_cur_day${m}_hour${j}.png ${outdir}/ori_nologo/tt_${j}.png
tmp="composite -blend 100 -geometry +152+698 ${xdir}/logo_tmp.png ${outdir}/ori_nologo/tt_${j}.png ${outdir}/labeled_${j}.png"
echo ${tmp}
eval ${tmp}
done
ffmpeg -framerate 3 -start_number 1 -i ${outdir}/labeled_%02d.png -b:v 1000k -s:v 1980x1980 -c:v libx264 -profile:v high -crf 23 -pix_fmt yuv420p -r 30 ${outdir}/mov_glopng_top_5m_avg_c
mv ${outdir}/mov_glopng_top_5m_avg_current_${ff}.mov ${xdir}/movies_nowcast/.
done
- Merge target daily movies into one movie.
(1) Generate a txt file contain the name of target daily movies.
for t in {213..214}
do
printf -v m "%03d" $t
echo ${m}
xdate=$(date -d "2023-01-01 +$(( ${t} - 1 )) days" +%Y%m%d)
ff=$(date -d "${xdate} +$(( 0 )) days" "+%Y-%m-%d")
echo "file mov_glopng_top_5m_avg_current_${ff}.mov">> join_video.txt
done
file mov_glopng_top_5m_avg_current_2023-08-01.mov
file mov_glopng_top_5m_avg_current_2023-08-02.mov
file mov_glopng_top_5m_avg_current_2023-08-03.mov
file mov_glopng_top_5m_avg_current_2023-08-04.mov
file mov_glopng_top_5m_avg_current_2023-08-05.mov
file mov_glopng_top_5m_avg_current_2023-08-06.mov
file mov_glopng_top_5m_avg_current_2023-08-07.mov
file mov_glopng_top_5m_avg_current_2023-08-08.mov
file mov_glopng_top_5m_avg_current_2023-08-09.mov
file mov_glopng_top_5m_avg_current_2023-08-10.mov
file mov_glopng_top_5m_avg_current_2023-08-11.mov
file mov_glopng_top_5m_avg_current_2023-08-12.mov
file mov_glopng_top_5m_avg_current_2023-08-13.mov
(2) Merge the videos
ffmpeg -f concat -safe 0 -i join_video.txt -c copy output_demuxer.mp4
or if you have got all the figures for the movie, you can simply use the following command
ffmpeg -framerate 3 -start_number 1 -i fig_LL_chl_day%03d.png -b:v 1000k -s:v 1980x1980 -c:v libx264 -profile:v high -crf 23 -pix_fmt yuv420p -r 30 mov_ll_chl.mov
# fig_LL_chl_day%03d.png is the figure names
# mov_ll_chl.mov is the ouput movie name