Commit 5549e58a authored by Paulo V C Medeiros's avatar Paulo V C Medeiros
Browse files

Use data from all countries, not just SE

parent cb80ab6a
#!/bin/ksh
#
set -x
#set -x
echo 'Running Fix_obsfiles_FI.ksh'
work_dir=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
outdir="${work_dir}/outputs"
......@@ -17,17 +18,37 @@ while (( $DTG<=$DTG2 ))
do
FILE_OUT="$TXTPATH/obs_${DTG}.txt"
rm -f $FILE_OUT
((BB = ${DTG} / 100))
((YY = $BB / 10000))
((MM = ( $BB - $YY*10000) / 100))
DD=$(echo $DTG | cut -c7-8)
HH=$(echo $DTG | cut -c9-10)
IY=$YY
IM=`perl -e "printf('%2.2i', '$MM')"`
INFILE1="${work_dir}/inputs/input_to_fix_obsfiles_scripts/FI/${IY}/synopCARRA_FMI_$IY$IM.txt"
# Account for the fact that, prior to Oct 2019, DTGs for FI obs used to range 01-23
# instead of 00-24, which made obs for the first DTG in each month to be placed in the
# file corresponding to the last DTG of the previous month
YYYYMM=${IY}${IM}
if { (( YYYYMM < 201910 )) && (( DD == 01 )) && (( HH == 00 )) } ; then
dtg_one_h_before=$(/home/ms/se/smo/bin/mandtg.x $DTG -01)
YY=$(echo $dtg_one_h_before | cut -c1-4)
MM=$(echo $dtg_one_h_before | cut -c5-6)
INFILE0="${work_dir}/inputs/input_to_fix_obsfiles_scripts/FI/${YY}/synopCARRA_FMI_$YY$MM.txt"
n_misplaced_obs=$(grep -c $DTG $INFILE0 2> /dev/null)
#if [ "$n_misplaced_obs" -gt 0 ]; then
if (( n_misplaced_obs > 0 )) ; then
echo "Recovered $n_misplaced_obs FI obs for DTG=$DTG from loc obs file of DTG=$dtg_one_h_before"
grep $DTG $INFILE0 > $FILE_OUT 2> /dev/null | true
fi
fi
grep $DTG $INFILE1 > $FILE_OUT
INFILE1="${work_dir}/inputs/input_to_fix_obsfiles_scripts/FI/${IY}/synopCARRA_FMI_$IY$IM.txt"
grep $DTG $INFILE1 >> $FILE_OUT
DTG=$(/home/ms/se/smo/bin/mandtg.x $DTG + 01)
......
#!/bin/ksh
#
set -x
#set -x
echo 'Running Fix_obsfiles_IS.ksh'
work_dir=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
outdir="${work_dir}/outputs"
......@@ -9,7 +10,7 @@ DTG1=$1
DTG2=$2
DTG=$DTG1
TXTPATH="${outdir}/generated_obs_files/IC"
TXTPATH="${outdir}/generated_obs_files/IS"
rm -rf $TXTPATH
mkdir -p $TXTPATH
......@@ -17,6 +18,7 @@ while (( $DTG<=$DTG2 ))
do
FILE_OUT="$TXTPATH/obs_${DTG}.txt"
rm -f $FILE_OUT
((BB = ${DTG} / 100))
((YY = $BB / 10000))
......@@ -25,7 +27,7 @@ do
IY=$YY
IM=`perl -e "printf('%2.2i', '$MM')"`
INFILE1="${work_dir}/inputs/input_to_fix_obsfiles_scripts/IC/${IY}/carra_iceland_$IY_$IM.txt"
INFILE1="${work_dir}/inputs/input_to_fix_obsfiles_scripts/IS/${IY}/cerra_iceland_${IY}_${IM}.txt"
grep $DTG $INFILE1 > $FILE_OUT
......
#!/bin/ksh
#
set -x
#set -x
echo 'Running Fix_obsfiles_NO1.ksh'
work_dir=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
outdir="${work_dir}/outputs"
......@@ -17,6 +18,7 @@ while (( $DTG<=$DTG2 ))
do
FILE_OUT="$TXTPATH/carra_Norway_synop_$DTG.txt"
rm -f $FILE_OUT
((BB = ${DTG} / 100))
((YY = $BB / 10000))
......
#!/bin/ksh
#
set -x
#set -x
echo 'Running Fix_obsfiles_NO2.ksh'
work_dir=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
outdir="${work_dir}/outputs"
......@@ -16,6 +17,7 @@ while (( $DTG<=$DTG2 ))
do
FILE_OUT="$TXTPATH/carra_Norway_SA_RR24_$DTG.txt"
rm -f $FILE_OUT
((BB = ${DTG} / 100))
((YY = $BB / 10000))
......
#!/bin/ksh
#
set -x
#set -x
echo 'Running Fix_obsfiles_SE.ksh'
work_dir=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
outdir="${work_dir}/outputs"
......@@ -17,6 +18,7 @@ while (( $DTG<=$DTG2 ))
do
FILE_OUT="$TXTPATH/obs_${DTG}.txt"
rm -f $FILE_OUT
((BB = ${DTG} / 100))
((YY = $BB / 10000))
......
#!/bin/bash
#SBATCH --job-name=vobs
#SBATCH --workdir=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
#SBATCH --output=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts/gen_vobs.out
#SBATCH --error=/scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts/gen_vobs.err
#SBATCH --qos=normal
set -a
ulimit -c 0
cd /scratch/ms/se/snz/carra_vobs_2018_2019/carra_vobs_code/new_scripts
for YYYY in 2018 2019; do
for MM in 01 02 03 04 05 06 07 08 09 10 11 12; do
echo '================================================================================'
echo " Generating VOBS files for YYYY=$YYYY, MM=$MM"
echo '================================================================================'
./Fix_vobsfiles.ksh $YYYY $MM
echo ''
echo '-----------------------------'
echo "Done with YYYY=$YYYY, MM=$MM"
echo '-----------------------------'
echo ''
done
done
......@@ -23,14 +23,14 @@ PROGRAM carra2vobs
CHARACTER*40 name
CHARACTER*90 line
CHARACTER*7 indic, cstn(nmax)
CHARACTER*21 filename_ic/'IC/obs_yyyymmddhh.txt'/
CHARACTER*41 filename_is/'generated_obs_files/IS/obs_yyyymmddhh.txt'/
CHARACTER*41 filename_se/'generated_obs_files/SE/obs_yyyymmddhh.txt'/
CHARACTER*21 filename_fi/'FI/obs_yyyymmddhh.txt'/
CHARACTER*21 filename_dk/'DK/obs_yyyymmddhh.txt'/
CHARACTER*36 filename_no1/'NO/carra_Norway_synop_yyyymmddhh.txt'/
CHARACTER*38 filename_no2/'NO/carra_Norway_SA_RR24_yyyymmddhh.txt'/
CHARACTER*41 filename_fi/'generated_obs_files/FI/obs_yyyymmddhh.txt'/
CHARACTER*41 filename_dk/'generated_obs_files/DK/obs_yyyymmddhh.txt'/
CHARACTER*56 filename_no1/'generated_obs_files/NO/carra_Norway_synop_yyyymmddhh.txt'/
CHARACTER*58 filename_no2/'generated_obs_files/NO/carra_Norway_SA_RR24_yyyymmddhh.txt'/
CHARACTER*3 country(6)/'DK ','FI ','IC ','NO1','NO2','SE '/
CHARACTER*3 country(6)/'DK ','FI ','IS ','NO1','NO2','SE '/
LOGICAL found
......@@ -130,26 +130,26 @@ PROGRAM carra2vobs
CASE ('NO1')
WRITE(filename_no1(23:32),'(i4,3i2.2)')iy,im,id,ih
WRITE(filename_no1(43:52),'(i4,3i2.2)')iy,im,id,ih
CINP=TRIM(INPATH)//filename_no1
WRITE(*,*)TRIM(CINP)
CASE ('NO2')
WRITE(filename_no2(25:34),'(i4,3i2.2)')iy,im,id,ih
WRITE(filename_no2(45:54),'(i4,3i2.2)')iy,im,id,ih
CINP=TRIM(INPATH)//filename_no2
WRITE(*,*)TRIM(CINP)
CASE ('FI ')
WRITE(filename_fi(8:17),'(i4,3i2.2)')iy,im,id,ih
WRITE(filename_fi(28:37),'(i4,3i2.2)')iy,im,id,ih
CINP=TRIM(INPATH)//filename_fi
WRITE(*,*)TRIM(CINP)
CASE ('IC ')
CASE ('IS ')
WRITE(filename_ic(8:17),'(i4,3i2.2)')iy,im,id,ih
CINP=TRIM(INPATH)//filename_ic
WRITE(filename_is(28:37),'(i4,3i2.2)')iy,im,id,ih
CINP=TRIM(INPATH)//filename_is
WRITE(*,*)TRIM(CINP)
CASE ('SE ')
......@@ -160,7 +160,7 @@ PROGRAM carra2vobs
CASE ('DK ')
WRITE(filename_dk(8:17),'(i4,3i2.2)')iy,im,id,ih
WRITE(filename_dk(28:37),'(i4,3i2.2)')iy,im,id,ih
CINP=TRIM(INPATH)//filename_dk
WRITE(*,*)TRIM(CINP)
......@@ -238,7 +238,7 @@ PROGRAM carra2vobs
ENDIF
CASE('IC ')
CASE('IS ')
READ(37,*, IOSTAT=IEOF) cval_date, rval_block, rval_station, rval_lon, rval_lat, &
rval_hei, rval_baro, rval_t2m, rval_rh, rval_td2m, rval_snow, rval_ps, &
......@@ -365,7 +365,7 @@ PROGRAM carra2vobs
ENDIF
CASE ('IC ')
CASE ('IS ')
DO i = 1,nice
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment