Due to a shift in policy, from 0900 GMT on Wednesday 14th July 2021, we will be disabling ssh access to the server for external users. External users who wish to continue to access code repositories on the server will need to switch to using https. This can be accomplished in the following way: 1) On the repo on gitlab, use the clone dialogue and select ‘Clone with HTTPS’ to get the address of the repo; 2) From within the checkout of your repo run: $ git remote set-url origin HTTPS_ADDRESS. Here, replace HTTPS_ADDRESS with the address you have just copied from GitLab. Pulls and pushes will now require you to enter a username and password rather than using a ssh key. If you would prefer not to enter a password each time, you might consider caching your login credentials.

Commit dbeb97ae authored by Modellers Operational's avatar Modellers Operational

Update get wrf archive to cope with multiple day hindcasts

parent 4a4cf291
#!/bin/bash
START_DAY=$1
END_DAY=$2
WRF_ARCHIVE_DATEFMT=$3
WRF_ARCHIVE_DIR=$4
ROSE_DATAC=$5
echo 1
echo ${START_DAY}
echo 2
echo ${END_DAY}
echo 3
echo ${WRF_ARCHIVE_DATEFMT}
echo 4
echo ${WRF_ARCHIVE_DIR}
echo 5
echo ${ROSE_DATAC}
d=
n=0
until [ "$d_comp" = "$END_DAY" ]
do
((n++))
d=$(date -d "$START_DAY + $n days" +${WRF_ARCHIVE_DATEFMT})
d_comp=$(date -d "$START_DAY + $n days" +%Y-%m-%d)
cp /pml${WRF_ARCHIVE_DIR}/*${d}*/wrfout_d03_* ${ROSE_DATAC}/raw_wrf_file_${n}.nc
done
#!/bin/bash --login
# Script to merge the individual runs into month long chunks ready for
# conversion with wrf_to_fvcom.
module purge
module load nco
set -eu
# Make sure any symbolic links are resolved to absolute path.
PBS_O_WORKDIR=$(pwd)
export PBS_O_WORKDIR=$(readlink -f $PBS_O_WORKDIR)
# Change to the directory from which the job was submitted.
cd $PBS_O_WORKDIR
year=${year:-2017}
srcdir=$(readlink -f $PBS_O_WORKDIR/output/)
binary=$PBS_O_WORKDIR/bin/wrf_to_fvcom_ceto
start_hour=18 # hour at which the outputs are generated
wrfnest=${wrfnest:-d03}
for rawmonth in {1..12}; do
# Sort out our time bracket.
yearbefore=$year
yearafter=$year
before=$(printf %02d $((rawmonth - 1)))
month=$(printf %02d $rawmonth)
after=$(printf %02d $((rawmonth + 1)))
# If we're in January or December, reset the before and after month and
# year to the appropriate values.
if [ $rawmonth -eq 1 ]; then
yearbefore=$((year - 1))
before=12
elif [ $rawmonth -eq 12 ]; then
yearafter=$((year + 1))
after=01
fi
# We need all the files from the current month plus a couple of days either
# side for the FVCOM runs. We need to use an extra pattern of
# $year/wrfout_${wrfnest}_$yearbefore-$before* for the start of a given year as
# that may have actually been run as the last day of the previous year. In
# that instance, the output file will be in the $year directory but will
# actually be named $yearbefore. Limit that search to the last few days to
# not include the whole month in a non-year-boundary month (i.e. not
# January).
files=($(\ls -1 $srcdir/$yearbefore/wrfout_${wrfnest}_$yearbefore-$before-{26,27,28,29,30,31}_${start_hour}?00?00 \
$srcdir/$year/wrfout_${wrfnest}_$yearbefore-$before-{26,27,28,29,30,31}_${start_hour}?00?00 \
$srcdir/$year/wrfout_${wrfnest}_$year-$month-??_${start_hour}?00?00 \
$srcdir/$yearafter/wrfout_${wrfnest}_$year-$month-??_${start_hour}?00?00 \
$srcdir/$yearafter/wrfout_${wrfnest}_$yearafter-$after-{01,02,03}_${start_hour}?00?00 2> /dev/null | sort -u))
# Now convert to FVCOM forcing files. These files have all had their first
# time step removed as that's just the initial condition. So, you'd need to
# add a -dTime,1,, to the ncrcat command to drop the first time step if
# that's not been done. Once they're all converted, ncrcat them all
# together into a single file for this month.
parallel \(ln -s {} current_{/.}.nc \|\| true\) \&\& $binary -i current_{/.}.nc -o /var/tmp/out_{/.}.nc -latitude 50.0 -hindcast \> \/dev\/null ::: "${files[@]}"
parallel rm current_{/.}.nc ::: "${files[@]}"
parallel ncrcat -O -h /var/tmp/out_{/.}.nc /var/tmp/trim_{/.}.nc ::: "${files[@]}"
parallel rm /var/tmp/out_{/.}.nc ::: "${files[@]}"
rm $srcdir/$year/wrfout_${wrfnest}_${year}-${month}.nc || true
ncrcat -O -h $(\ls -1 /var/tmp/trim_wrfout_${wrfnest}_{${yearbefore},${year},${yearafter}}-{${before},${month},${after}}-??_*.nc | sort -u) $srcdir/$year/wrfout_${wrfnest}_${year}-${month}.nc
parallel rm /var/tmp/trim_{/.}.nc ::: "${files[@]}"
done
[command] [command]
default = cp /pml${WRF_ARCHIVE_DIR}/*${WRF_ARCHIVE_DATESTR}*/wrfout_d03_* ${ROSE_DATAC}/raw_wrf_file.nc default = bash ./get_wrf_files.sh ${START_DAY} ${END_DAY} ${WRF_ARCHIVE_DATEFMT} ${WRF_ARCHIVE_DIR} ${ROSE_DATAC}
...@@ -18,7 +18,6 @@ MAIL_TO='mbe@pml.ac.uk' ...@@ -18,7 +18,6 @@ MAIL_TO='mbe@pml.ac.uk'
GRID_NAME='tamar_v2' GRID_NAME='tamar_v2'
COMMON_FILES_PATH='/users/modellers/modop/Models/FVCOM_tamar_common/' COMMON_FILES_PATH='/users/modellers/modop/Models/FVCOM_tamar_common/'
ARCHIVE_DIR='data/sthenno1/scratch/modop/Model/FVCOM_tamar/output' ARCHIVE_DIR='data/sthenno1/scratch/modop/Model/FVCOM_tamar/output'
PLOT_DIR='data/sthenno1/scratch/modop/Model/FVCOM_tamar/plots'
TEMP_ACTIVE='T' TEMP_ACTIVE='T'
SALT_ACTIVE='T' SALT_ACTIVE='T'
...@@ -31,7 +30,7 @@ AIR_PRESSURE_ON='T' ...@@ -31,7 +30,7 @@ AIR_PRESSURE_ON='T'
## WRF suite settings if any of the above are on ## WRF suite settings if any of the above are on
WRF_RUN_SUITE='wrf' WRF_RUN_SUITE='wrf'
WRF_FORECAST_FILE_DIR='/gpfs1/users/modellers/modop/Models/WRF_transfer_dir/' WRF_FORECAST_FILE_DIR='/gpfs1/users/modellers/modop/Models/WRF_transfer_dir/'
WRF_ARCHIVE_DIR='/data/sthenno1/scratch/modop/Model/WRF/output' WRF_ARCHIVE_DIR='data/sthenno1/backup/pica/models/WRF/wrf-preprocess-gfs/output'
WRF_ARCHIVE_DATEFMT='%Y%m%d' WRF_ARCHIVE_DATEFMT='%Y%m%d'
......
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