From b4300a50e74b3cf3fa0be0f2719939ada187f230 Mon Sep 17 00:00:00 2001 From: novarizark Date: Thu, 12 Mar 2020 03:21:07 +0800 Subject: [PATCH] 200312 --- .../ncl/200226-plot-d01-slp-vu10-gba.ncl | 6 +-- .../ncl/200304-plot-roms-SST-mangkhut.ncl | 5 +- 1911-COAWST/ncl/200305-plot-droms-Hwave.ncl | 4 +- ...200305-plot-roms-SST-area-dep-mangkhut.ncl | 4 +- .../ncl/200305-plot-roms-SST-dep-mangkhut.ncl | 4 +- 1911-COAWST/script/form_gif.sh | 19 +++++++ .../ncl/200310-plot-d01-droms-sst.ncl | 2 +- .../ncl/200311-replace-wrf-sst-ts.ncl | 54 +++++++++++++++++++ 8 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 1911-COAWST/script/form_gif.sh create mode 100644 1911-yeq-HALOGEN/ncl/200311-replace-wrf-sst-ts.ncl diff --git a/1911-COAWST/ncl/200226-plot-d01-slp-vu10-gba.ncl b/1911-COAWST/ncl/200226-plot-d01-slp-vu10-gba.ncl index 8b022f67..cf15cd9a 100644 --- a/1911-COAWST/ncl/200226-plot-d01-slp-vu10-gba.ncl +++ b/1911-COAWST/ncl/200226-plot-d01-slp-vu10-gba.ncl @@ -10,7 +10,7 @@ begin ;************************************************ ; open file and read in data ;************************************************ - casename="mangkhut-wrfonly" + casename="mangkhut" wrfout_path="../data/1911-COAWST/"+casename+"/wrfout_d01" g_font=0.02 @@ -34,9 +34,7 @@ begin dim_y=dims(1) dim_x=dims(2) - ; get in wrf only tc data - wrf_tc = asciiread("../data/1911-COAWST/sandy/sandy.wrf.trck",(/dim_t,3/),"float"); (0)--lat, (1)--lon, (2)--slp - + ;ctrl_var2 = wrf_user_getvar(ctrl_in,"U10", -1) ;ctrl_var3 = wrf_user_getvar(ctrl_in,"V10", -1) diff --git a/1911-COAWST/ncl/200304-plot-roms-SST-mangkhut.ncl b/1911-COAWST/ncl/200304-plot-roms-SST-mangkhut.ncl index 90263764..ddb9c748 100644 --- a/1911-COAWST/ncl/200304-plot-roms-SST-mangkhut.ncl +++ b/1911-COAWST/ncl/200304-plot-roms-SST-mangkhut.ncl @@ -18,7 +18,8 @@ begin "Oct","Nov","Dec"/) casename="mangkhut" - + fig_prefix="droms_sst_" + wrfout_path="../data/1911-COAWST/"+casename+"/wrfout_d01" ocean_path="../data/1911-COAWST/"+casename+"/gba_ocean_his.nc" obv_tck_file="../data/1911-COAWST/"+casename+"/trck.cma.simple" @@ -174,7 +175,7 @@ do while(time_frame .lt. dim_t) wks_type="png" wks_type@wkWidth=800 wks_type@wkHeight=800 - wks = gsn_open_wks(wks_type,"../fig/"+casename+"/droms_sst_"+sprinti("%0.3iFrm", ampf*time_frame)) ; send graphics to PNG file + wks = gsn_open_wks(wks_type,"../fig/"+casename+"/"+fig_prefix+sprinti("%0.3iFrm", ampf*time_frame)) ; send graphics to PNG file res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = 25. ; set min contour level diff --git a/1911-COAWST/ncl/200305-plot-droms-Hwave.ncl b/1911-COAWST/ncl/200305-plot-droms-Hwave.ncl index c8e8cab9..3cf750ac 100644 --- a/1911-COAWST/ncl/200305-plot-droms-Hwave.ncl +++ b/1911-COAWST/ncl/200305-plot-droms-Hwave.ncl @@ -18,7 +18,7 @@ begin "Oct","Nov","Dec"/) casename="mangkhut" - + fig_prefix="droms_HWave_" wrfout_path="../data/1911-COAWST/"+casename+"/wrfout_d01" ocean_path="../data/1911-COAWST/"+casename+"/gba_ocean_his.nc" obv_tck_file="../data/1911-COAWST/"+casename+"/trck.cma.simple" @@ -175,7 +175,7 @@ do while(time_frame .lt. dim_t) wks_type="png" wks_type@wkWidth=800 wks_type@wkHeight=800 - wks = gsn_open_wks(wks_type,"../fig/"+casename+"/droms_HWave_"+sprinti("%0.3iFrm", time_frame)) ; send graphics to PNG file + wks = gsn_open_wks(wks_type,"../fig/"+casename+"/"+fig_prefix+sprinti("%0.3iFrm", time_frame)) ; send graphics to PNG file res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = 2.0 ; set min contour level res@cnMaxLevelValF = 15 ; set max contour level diff --git a/1911-COAWST/ncl/200305-plot-roms-SST-area-dep-mangkhut.ncl b/1911-COAWST/ncl/200305-plot-roms-SST-area-dep-mangkhut.ncl index 4bd82f21..455ef3eb 100644 --- a/1911-COAWST/ncl/200305-plot-roms-SST-area-dep-mangkhut.ncl +++ b/1911-COAWST/ncl/200305-plot-roms-SST-area-dep-mangkhut.ncl @@ -18,7 +18,7 @@ begin "Oct","Nov","Dec"/) casename="mangkhut" - + fig_prefix="droms_ssta_area_" wrfout_path="../data/1911-COAWST/"+casename+"/wrfout_d01" ocean_path="../data/1911-COAWST/"+casename+"/gba_ocean_his.nc" obv_tck_file="../data/1911-COAWST/"+casename+"/trck.cma.simple" @@ -179,7 +179,7 @@ do while(time_frame .lt. dim_t) wks_type="png" wks_type@wkWidth=800 wks_type@wkHeight=800 - wks = gsn_open_wks(wks_type,"../fig/"+casename+"/droms_dsst_"+sprinti("%0.3iFrm", ampf*time_frame)) ; send graphics to PNG file + wks = gsn_open_wks(wks_type,"../fig/"+casename+"/"+fig_prefix+sprinti("%0.3iFrm", ampf*time_frame)) ; send graphics to PNG file res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = -1.5 ; set min contour level diff --git a/1911-COAWST/ncl/200305-plot-roms-SST-dep-mangkhut.ncl b/1911-COAWST/ncl/200305-plot-roms-SST-dep-mangkhut.ncl index 3fb93330..057a1685 100644 --- a/1911-COAWST/ncl/200305-plot-roms-SST-dep-mangkhut.ncl +++ b/1911-COAWST/ncl/200305-plot-roms-SST-dep-mangkhut.ncl @@ -18,7 +18,7 @@ begin "Oct","Nov","Dec"/) casename="mangkhut" - + fig_prefix="droms_ssta_" wrfout_path="../data/1911-COAWST/"+casename+"/wrfout_d01" ocean_path="../data/1911-COAWST/"+casename+"/gba_ocean_his.nc" obv_tck_file="../data/1911-COAWST/"+casename+"/trck.cma.simple" @@ -176,7 +176,7 @@ do while(time_frame .lt. dim_t) wks_type="png" wks_type@wkWidth=800 wks_type@wkHeight=800 - wks = gsn_open_wks(wks_type,"../fig/"+casename+"/droms_dsst_"+sprinti("%0.3iFrm", ampf*time_frame)) ; send graphics to PNG file + wks = gsn_open_wks(wks_type,"../fig/"+casename+"/"+fig_prefix+sprinti("%0.3iFrm", ampf*time_frame)) ; send graphics to PNG file res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = -1. ; set min contour level diff --git a/1911-COAWST/script/form_gif.sh b/1911-COAWST/script/form_gif.sh new file mode 100644 index 00000000..39c62224 --- /dev/null +++ b/1911-COAWST/script/form_gif.sh @@ -0,0 +1,19 @@ + +PREFIX=droms_zeta_ +TOTAL_STEP=145 +STRT_F=0 +FRAME_DT=15 # n/100 second + +rm -f *noborder* + +for((I=$STRT_F;I<=${TOTAL_STEP};I++)) +do + TFSTMP=`printf "%.3d" $I` + echo $TFSTMP + #convert -trim +repage -bordercolor white -background white -flatten ${PREFIX}${TFSTMP}H.png ${PREFIX}noborder_${TFSTMP}H.png + convert -trim +repage -bordercolor white -background white -flatten ${PREFIX}${TFSTMP}Frm.png ${PREFIX}noborder_${TFSTMP}Frm.png +done + +convert -delay ${FRAME_DT} ${PREFIX}noborder_* ${PREFIX}result.gif +convert ${PREFIX}result.gif -layers Optimize ${PREFIX}result.gif +#convert result.gif -fuzz 5% -layers Optimize result.gif diff --git a/1911-yeq-HALOGEN/ncl/200310-plot-d01-droms-sst.ncl b/1911-yeq-HALOGEN/ncl/200310-plot-d01-droms-sst.ncl index 902a13ff..adf8ff9b 100644 --- a/1911-yeq-HALOGEN/ncl/200310-plot-d01-droms-sst.ncl +++ b/1911-yeq-HALOGEN/ncl/200310-plot-d01-droms-sst.ncl @@ -10,7 +10,7 @@ begin ;************************************************ ; open file and read in data ;************************************************ - casename="wrfonly" + casename="cpl" multi_in=True wrfout_path="/disk/v092.yhuangci/coawst/"+casename roms_path="/disk/v092.yhuangci/coawst/cpl/gba_ocean_avg.nc" diff --git a/1911-yeq-HALOGEN/ncl/200311-replace-wrf-sst-ts.ncl b/1911-yeq-HALOGEN/ncl/200311-replace-wrf-sst-ts.ncl new file mode 100644 index 00000000..0b87eace --- /dev/null +++ b/1911-yeq-HALOGEN/ncl/200311-replace-wrf-sst-ts.ncl @@ -0,0 +1,54 @@ +;******************************************************* +; lcnative_2.ncl +;******************************************************* +; +; These files are loaded by default in NCL V6.2.0 and newer +; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" +; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" +load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" +begin +;************************************************ +; open file and read in data +;************************************************ + source_path="/disk/v092.yhuangci/coawst/cpl" + out_path="/disk/v092.yhuangci/coawst/wrf-with-hfsst" + multi_in=True + + casename="cpl" + wrfout_path="/disk/v092.yhuangci/coawst/"+casename + g_font=0.02 + + mask_in = addfile (out_path+"/wrfout_d01_2016-10-16_12:00:00", "r") ; note the "s" of addfile + lsmask = wrf_user_getvar(mask_in,"LANDMASK", -1) + if multi_in then + all_files=systemfunc("ls "+source_path+"/wrfout_d01*") + len_file=dimsizes(all_files) + do ii = 0, len_file-1 + fn_array=str_split(all_files(ii),"/") + fn_array=fn_array(::-1) + print(all_files(ii)+" "+fn_array(0)) + tgt_file=systemfunc("ls "+out_path+"/"+fn_array(0)) + if strlen(tgt_file) .gt. 0 then + ctrl_in = addfile (all_files(ii), "r") ; note the "s" of addfile + ctrl_var1 = wrf_user_getvar(ctrl_in,"SST", -1) + ctrl_var2 = wrf_user_getvar(ctrl_in,"TMN", -1) + ctrl_var3 = wrf_user_getvar(ctrl_in,"TSK", -1) + + out_in = addfile(tgt_file, "w") + out_var1 = wrf_user_getvar(out_in,"SST", -1) + out_var2 = wrf_user_getvar(out_in,"TMN", -1) + out_var3 = wrf_user_getvar(out_in,"TSK", -1) + out_var1=where(lsmask .eq. 0, ctrl_var1, out_var1) + out_var2=where(lsmask .eq. 0, ctrl_var2, out_var2) + out_var3=where(lsmask .eq. 0, ctrl_var3, out_var3) + out_in->SST=out_var1 + out_in->TMN=out_var2 + out_in->TSK=out_var3 + end if + + end do + else + ctrl_in = addfile (wrfout_path, "r") ; note the "s" of addfile + end if + +end