diff --git a/Jupyter_Notebooks/get_era5_forecasts.sh b/Jupyter_Notebooks/get_era5_forecasts.sh index 5c7b00c02cb957020fc5d236ba7ded684856de78..57ec979d003132aeadac9316ff2e9992f658ffd9 100755 --- a/Jupyter_Notebooks/get_era5_forecasts.sh +++ b/Jupyter_Notebooks/get_era5_forecasts.sh @@ -50,18 +50,21 @@ for hh in ${hh_list[@]}; do ncrename -O -d time,fcst_hour -v time,fcst_hour ${outfile} ${outfile} ncap2 -O -s 'fcst_hour=int(fcst_hour)' ${outfile} ${outfile} - # add ground truth data and persistence forecast from trained model - patt=${indir_ref}/vfp_date_${date1}${hh0}_sample_ind*.nc - if ls $patt 1>/dev/null 2<&1; then - file_src=`ls $patt` - ncks -d fcst_hour,5,11 -v 2t_ref,2t_persistence_fcst -A ${file_src} ${outfile} - else - echo "Could not find reference data for ${date2}..." - mv ${outfile} "${oufile/.nc/_ref_miss.nc}" - fi + # add ground truth data and persistence forecast from trained model + patt=${indir_ref}/vfp_date_${date1}${hh0}_sample_ind*.nc + if ls $patt 1>/dev/null 2<&1; then + file_src=`ls $patt` + ncks -d fcst_hour,5,11 -v 2t_ref,2t_persistence_fcst -A ${file_src} ${outfile} + else + echo "Could not find reference data for ${date2}..." + mv ${outfile} "${oufile/.nc/_ref_miss.nc}" + fi date1="$(date -u --date="$date1 tomorrow" '+%Y%m%d')" date2="$(date -u --date="$date2 tomorrow" '+%Y-%m-%d %H:%M:00')" done done + +# finally merge all data into a single file +cdo -v mergetime ${outdir}/*_allfc.nc ${outdir}/${yr}_era5_short_range_fcst