Commit 4bfc1cf0 authored by Paulo V C Medeiros's avatar Paulo V C Medeiros
Browse files

Initial commit with Esbjorns files

Copied from /home/ms/se/smo/carra
parents
#!/bin/ksh
#
set -x
ECFSPATH=ec:/smo/harmonie/PRECISE/RCO
for YYYY in {1980..1999}
do
for IM in {1..12}
do
MM=`perl -e "printf('%2.2i', '$IM')"`
echmod 755 $ECFSPATH/$YYYY/$MM/*
echgrp hirald $ECFSPATH/$YYYY/$MM/*
done
done
exit
#!/bin/ksh
#
set -x
cd /scratch/ms/se/smo/carra/conv/FR
DTG1=$1
DTG2=$2
DTG=$DTG1
YYYY=${DTG:0:4}
TXTPATH=/scratch/ms/se/smo/carra/conv/FR
OUTDIR=/scratch/ms/se/smo/carra/conv/FR/$YYYY
mkdir -p $OUTDIR
while (( $DTG<=$DTG2 ))
do
((DATE = ${DTG} / 100))
((YY = $DATE / 10000))
((MM = ( $DATE - $YY*10000) / 100))
((DD = ( $DATE - $YY*10000 - $MM*100) ))
((HH = (${DTG} - $DATE*100) ))
IY=$YY
IM=`perl -e "printf('%2.2i', '$MM')"`
ID=`perl -e "printf('%2.2i', '$DD')"`
IH=`perl -e "printf('%2.2i', '$HH')"`
INFILE1=$TXTPATH"/BDCLIM_TYPE01_H_"$DATE
FILE_OUT1=$OUTDIR"/obs_"$DTG".txt"
grep $DTG $INFILE1 > $FILE_OUT1
if (( $IH == 06 ))
then
INFILE2=$TXTPATH"/BDCLIM_TYPE01_Q_"$DATE
FILE_OUT2=$OUTDIR"/clim_"$DTG".txt"
grep $DATE $INFILE2 > $FILE_OUT2
fi
DTG=$(/home/ms/se/smo/bin/mandtg.x $DTG + 03)
done
exit
#!/bin/ksh
#
set -x
cd /scratch/ms/se/smo/carra/conv/FI
DTG1=$1
DTG2=$2
DTG=$DTG1
((BB = ${DTG} / 100))
((YY = $BB / 10000))
((MM = ( $BB - $YY*10000) / 100))
IY=$YY
IM=`perl -e "printf('%2.2i', '$MM')"`
TXTPATH=/scratch/ms/se/smo/carra/conv/FI/
INFILE1="/scratch/ms/se/smo/carra/conv/FI/"$IY"/synopCARRA_FMI_"$IY$IM".txt"
while (( $DTG<=$DTG2 ))
do
FILE_OUT=$TXTPATH"obs_"$DTG".txt"
grep $DTG $INFILE1 > $FILE_OUT
DTG=$(/home/ms/se/smo/bin/mandtg.x $DTG + 01)
done
exit
#!/bin/ksh
#
set -x
cd /scratch/ms/se/smo/carra/
DTG1=$1
DTG2=$2
DTG=$DTG1
((BB = ${DTG} / 100))
((YY = $BB / 10000))
((MM = ( $BB - $YY*10000) / 100))
IY=$YY
IM=`perl -e "printf('%2.2i', '$MM')"`
TXTPATH=/scratch/ms/se/smo/carra/conv/FI
INFILE1=/data/proj/hiroper/uerra/data/ath.csv
INFILE2=/data/proj/hiroper/uerra/data/sj_klst.csv
while (( $DTG<=$DTG2 ))
do
FILE_OUT=$TXTPATH"obs_"$DTG".txt"
grep $DTG $INFILE1 > $FILE_OUT
grep $DTG $INFILE2 >> $FILE_OUT
DTG=$(/home/ms/se/smo/bin/mandtg.x $DTG + 01)
done
exit
#!/bin/ksh
#
set -x
cd /scratch/ms/se/smo/carra/
DTG1=$1
DTG2=$2
DTG=$DTG1
YYYY=${DTG:0:4}
FRPATH=/scratch/ms/se/smo/carra/conv/FR/$YYYY
SEPATH=/scratch/ms/se/smo/carra/conv/SE/$YYYY
OUTDIR=/scratch/ms/se/smo/carra/obsoul/$YYYY
mkdir -p $OUTDIR
while (( $DTG<=$DTG2 ))
do
((BB = ${DTG} / 100))
((YY = $BB / 10000))
((MM = ( $BB - $YY*10000) / 100))
((DD = ( $BB - $YY*10000 - $MM*100) ))
((HH = (${DTG} - $BB*100) ))
((IYY = $YY-2000))
IY=`perl -e "printf('%2.2i', '$IYY')"`
IM=`perl -e "printf('%2.2i', '$MM')"`
ID=`perl -e "printf('%2.2i', '$DD')"`
IH=`perl -e "printf('%2.2i', '$HH')"`
cat > obsoul_header << EOF
$YY$IM$ID $HH
EOF
OBSOULFILE=$OUTDIR"/obsoul"$DTG
cat obsoul_header > $OBSOULFILE
/bin/rm obsoul.txt
# France
FRFILE=$FRPATH"/obs_"$YY$IM$ID$IH".txt"
if [[ -f $FRFILE && -s $FRFILE ]]
then
/home/ms/se/smo/carra/carra2obsoul.x $FRFILE FR ALL
if [[ -f obsoul.txt && -s obsoul.txt ]];then
cat obsoul.txt >> $OBSOULFILE
/bin/rm obsoul.txt
fi
fi
# France precip at 06
if (( $IH == 06 ))
then
FRFILE=$FRPATH"/clim_"$YY$IM$ID$IH".txt"
if [[ -f $FRFILE && -s $FRFILE ]]
then
/home/ms/se/smo/carra/carra2obsoul.x $FRFILE FR CLIM
if [[ -f obsoul.txt && -s obsoul.txt ]];then
cat obsoul.txt >> $OBSOULFILE
/bin/rm obsoul.txt
fi
fi
fi
# Sweden
SEFILE=$SEPATH"/obs_"$YY$IM$ID$IH".txt"
if [[ -f $SEFILE && -s $SEFILE ]]
then
/home/ms/se/smo/carra/carra2obsoul.x $SEFILE SE ALL
if [[ -f obsoul.txt && -s obsoul.txt ]];then
cat obsoul.txt >> $OBSOULFILE
/bin/rm obsoul.txt
fi
fi
DTG=$(/home/ms/se/smo/bin/mandtg.x $DTG + 03)
done
exit
#!/bin/bash
#SBATCH --job-name=vobs
#SBATCH --workdir=/scratch/ms/se/smo/carra/conv
#SBATCH --qos=normal
#SBATCH --time=02:00:00
#
set -x
cd /scratch/ms/se/smo/carra/conv
YYYY=$1
MM=$2
IMM=`perl -e "printf('%2.2i', '$MM')"`
D1=01
case $MM in
02) ND=28
if [ $YYYY = 1984 -o $YYYY = 1988 -o $YYYY = 1992 -o $YYYY = 1980 \
-o $YYYY = 1976 -o $YYYY = 1972 -o $YYYY = 1968 -o $YYYY = 1964 \
-o $YYYY = 1960 -o $YYYY = 1956 -o $YYYY = 1996 -o $YYYY = 2000 \
-o $YYYY = 2004 -o $YYYY = 2008 -o $YYYY = 2012 -o $YYYY = 2016 ]
then
ND=29
fi;;
04) ND=30;;
06) ND=30;;
09) ND=30;;
11) ND=30;;
*) ND=31;;
esac
DTG1=$YYYY$MM$D1"00"
DTG2=$YYYY$MM$ND"23"
DTGNO1=$YYYY$MM$D1"06"
DTGNO2=$YYYY$MM$ND"06"
DTG=$DTG1
export INPATH=/scratch/ms/se/smo/carra/conv/
./Fix_obsfiles_DK.ksh $DTG1 $DTG2
DTGF=$(/home/ms/se/smo/bin/mandtg.x $DTG1 + -24)
((BB = ${DTGF} / 100))
((YYF = $BB / 10000))
((MMF = ( $BB - $YYF*10000) / 100))
IMF=`perl -e "printf('%2.2i', '$MMF')"`
cd $INPATH/FI/$YYYY
gunzip "synopCARRA_FMI_"$YYYY$MM".txt.gz"
cd $INPATH
./Fix_obsfiles_FI.ksh $DTG1 $DTG2
cd $INPATH/FI/$YYYY
gzip "synopCARRA_FMI_"$YYYY$MM".txt"
cd $INPATH/FI/$YYF
gunzip "synopCARRA_FMI_"$YYF$IMF".txt.gz"
grep $DTG1 "synopCARRA_FMI_"$YYF$IMF".txt" > "../obs_"$DTG1".txt"
gzip "synopCARRA_FMI_"$YYF$IMF".txt"
cd $INPATH
./Fix_obsfiles_IC.ksh $DTG1 $DTG2
./Fix_obsfiles_NO1.ksh $DTG1 $DTG2
./Fix_obsfiles_NO2.ksh $DTGNO1 $DTGNO2
./Fix_obsfiles_SE.ksh $DTG1 $DTG2
while (( $DTG<=$DTG2 ))
do
((BB = ${DTG} / 100))
((YY = $BB / 10000))
((MM = ( $BB - $YY*10000) / 100))
((DD = ( $BB - $YY*10000 - $MM*100) ))
((HH = (${DTG} - $BB*100) ))
((IYY = $YY-2000))
IY=`perl -e "printf('%2.2i', '$IYY')"`
IM=`perl -e "printf('%2.2i', '$MM')"`
ID=`perl -e "printf('%2.2i', '$DD')"`
IH=`perl -e "printf('%2.2i', '$HH')"`
/bin/rm vobs.txt
VOBSFILE=vobs/vobs$DTG
./carra2vobs.x $DTG
if [[ -f vobs.txt && -s vobs.txt ]];then
cat vobs.txt >> $VOBSFILE
/bin/rm vobs.txt
fi
DTG=$(/home/ms/se/smo/bin/mandtg.x $DTG + 01)
done
cd $INPATH/vobs
TAR_FILE="vobs_"$YYYY$IMM".tar"
tar cvf $TAR_FILE vobs*
gzip $TAR_FILE
GZIP_FILE="vobs_"$YYYY$IMM".tar.gz"
ecp $GZIP_FILE ec:/smo/harmonie/CARRA/vobs/$YYYY/
echmod 755 ec:/smo/harmonie/CARRA/vobs/$YYYY/*
echgrp hirald ec:/smo/harmonie/CARRA/vobs/$YYYY/*
/bin/rm $GZIP_FILE vobs*
cd $INPATH
/bin/rm $INPATH/DK/obs_*.txt
/bin/rm $INPATH/FI/obs_*.txt
/bin/rm $INPATH/IC/obs_*.txt
/bin/rm $INPATH/NO/carra_Norway*.txt
/bin/rm $INPATH/SE/obs_*.txt
exit
#!/bin/ksh
#
set -x
cd /nobackup/smhid12/sm_esbol/CARRA
DTG1=$1
DTG2=$2
DTG=$DTG1
export INPATH=/nobackup/smhid12/sm_esbol/CARRA/data/
while (( $DTG<=$DTG2 ))
do
((BB = ${DTG} / 100))
((YY = $BB / 10000))
((MM = ( $BB - $YY*10000) / 100))
((DD = ( $BB - $YY*10000 - $MM*100) ))
((HH = (${DTG} - $BB*100) ))
((IYY = $YY-2000))
IY=`perl -e "printf('%2.2i', '$IYY')"`
IM=`perl -e "printf('%2.2i', '$MM')"`
ID=`perl -e "printf('%2.2i', '$DD')"`
IH=`perl -e "printf('%2.2i', '$HH')"`
/bin/rm vobs.txt
VOBSFILE=data/vobs/vobs$DTG
./carra2vobs.x $DTG
if [[ -f vobs.txt && -s vobs.txt ]];then
cat vobs.txt >> $VOBSFILE
/bin/rm vobs.txt
fi
DTG=$(/home/sm_esbol/metgraf/scr/mandtg.x $DTG + 01)
done
exit
This diff is collapsed.
PROGRAM carra2obsoul
REAL rval_lat, rval_lon, rval_hei, rval_snow, rval_prec24
REAL rval_t2m, rval_ff, rval_pmsl, rval_td2m, rval_dd
REAL rval_baro, rval_ps, rval_rh
REAL rval_year, rval_month, rval_day
REAL rval_hour, rval_minute
REAL rval_block, rval_station, rval_clim
REAL qsat,pp
CHARACTER*10 cval_date
CHARACTER*90 line
CHARACTER*8 indic,cval_day
PARAMETER (rmissval=999999.)
CHARACTER*256 CINP,COUT,CARG(4)
rvind = -9.
NARG=IARGC()
DO J=1,NARG
CALL GETARG(J,CARG(J))
ENDDO
IF(NARG<3) THEN
PRINT*,'USAGE: exe file country mode'
STOP
END IF
CINP = CARG(1)
COUT = 'obsoul.txt'
OPEN(38,FILE=COUT,ACTION='write', STATUS='unknown',IOSTAT=IEOF)
OPEN(37,FILE=CINP,ACTION='read', STATUS='OLD',IOSTAT=IEOF)
SELECT CASE (TRIM(carg(2)))
CASE ('NO')
READ(37,'(a)')line
CASE default
WRITE(*,*)'no first line'
END SELECT
IF (IEOF /= 0) STOP 'OPEN FAILED ON INPUT FILE'
icount = 0
DO WHILE (IEOF == 0)
SELECT CASE (TRIM(carg(2)))
CASE ('DK','SE','FI')
rval_ps = -9.
rval_rh = -9.
rval_baro = -9.
READ(37,*, IOSTAT=IEOF) cval_date, rval_block, rval_station, rval_lat, rval_lon, &
rval_hei, rval_t2m, rval_snow, rval_dd, rval_ff, rval_pmsl, rval_td2m, rval_prec24
IF(TRIM(carg(2)) == 'FI')THEN
IF(rval_pmsl > 0. .AND. rval_lat > 0.)THEN
rval_pmsl = rval_pmsl*100.
ENDIF
IF(rval_ps > 0. .AND. rval_lat > 0.)THEN
rval_ps = rval_ps*100.
ENDIF
ENDIF
CASE('NO')
IF(carg(3) == 'CLIM')THEN
rval_baro = -9.
rval_block = -9.
rval_t2m = -9.
rval_td2m = -9.
rval_rh = -9.
rval_pmsl = -9.
rval_ps = -9.
rval_ff = -9.
rval_dd = -9.
READ(37,*, IOSTAT=IEOF) cval_date, rval_station, rval_lat, rval_lon, &
rval_hei, rval_snow, rval_prec24
IF(rval_station > 0.)THEN
iiIII = NINT(rval_station)
ii = iiIII/1000
rval_block = float(ii)
iii = iiIII - ii*1000
rval_station = float(iii)
ENDIF
ELSE
rval_baro = -9.
rval_block = -9.
rval_td2m = -9.
rval_prec24 = -9.
rval_snow = -9.
READ(37,*, IOSTAT=IEOF) cval_date, rval_station, rval_lat, rval_lon, &
rval_hei, rval_t2m, rval_rh, rval_pmsl, rval_ps, rval_ff, rval_dd
IF(rval_station > 0.)THEN
iiIII = NINT(rval_station)
ii = iiIII/1000
rval_block = float(ii)
iii = iiIII - ii*1000
rval_station = float(iii)
ENDIF
IF(rval_t2m < -100.)THEN
rval_t2m = -9.
ELSE
rval_t2m = rval_t2m + 273.15
ENDIF
IF(rval_rh < -100.)rval_rh = -9.
IF(rval_pmsl < -100.)THEN
rval_pmsl = -9.
ELSE
rval_pmsl = rval_pmsl*100.
ENDIF
IF(rval_ps < -100.)THEN
rval_ps = -9.
ELSE
rval_ps = rval_ps *100.
ENDIF
IF(rval_ff < -100.)rval_ff = -9.
IF(rval_dd < -100.)rval_dd = -9.
ENDIF
CASE('FR')
IF(carg(3) == 'CLIM')THEN
rval_baro = -9.
rval_block = -9.
rval_t2m = -9.
rval_td2m = -9.
rval_rh = -9.
rval_pmsl = -9.
rval_ps = -9.
rval_ff = -9.
rval_dd = -9.
rval_snow = -9.
READ(37,*, IOSTAT=IEOF) cval_day, rval_station, rval_lat, rval_lon, &
rval_hei, rval_prec24
cval_date = cval_day//'06'
IF(rval_prec24 == 999999.)THEN
rval_prec24 = -9.
rval_lat = -9.
ENDIF
ELSE
rval_baro = -9.
rval_block = -9.
rval_pmsl = -9.
rval_prec24 = -9.
rval_snow = -9.
rval_dd = -9.
READ(37,*, IOSTAT=IEOF) cval_date, rval_station, rval_lat, rval_lon, &
rval_hei, rval_t2m, rval_td2m, rval_rh, rval_ps, rval_ff
IF(rval_t2m == 999999.)THEN
rval_t2m = -9.
ELSE
rval_t2m = rval_t2m + 273.15
ENDIF
IF(rval_td2m == 999999.)THEN
rval_td2m = -9.
ELSE
rval_td2m = rval_td2m + 273.15
ENDIF