Skip to content

Commit 21dfb38

Browse files
pirminkleuty
andauthored
Adapt test-fp script for ICON (#12)
* Use recent forecast working directory of operational ICON runs as data source for FLEXPART-COSMO. * Format file heads to match ICON version. * Allow specification of const.-fields file, add --member and --debug options, imporove defaults for forecast range. * Adapt test-fp script for use with Fieldextra output files with interpolated ICON data. Enable plotting of wet and dry deposition separately. * Remove support of old systems at CSCS. Set operational environment in the settings section. Update README.md in test_meteoswiss. * Allow instant release (default IFS Global scenario). * Unset OPR_VERSION to determine current operatonal version to find data. Do not set default for resolution (no unique relation to directory names). * Update test_meteoswiss/README.md Co-authored-by: David Leutwyler <14977216+leuty@users.noreply.github.com> * Follow up on review comments of @leuty. --------- Co-authored-by: David Leutwyler <14977216+leuty@users.noreply.github.com>
1 parent 5cb23c8 commit 21dfb38

File tree

7 files changed

+350
-228
lines changed

7 files changed

+350
-228
lines changed

options.meteoswiss/COMMAND

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
***************************************************************************************************************
2-
* *
3-
* Input file for the Lagrangian particle dispersion model FLEXPART *
4-
* Please select your options *
5-
* *
6-
***************************************************************************************************************
1+
!******************************************************************************
2+
!* *
3+
!* Input file for the Lagrangian particle dispersion model FLEXPART *
4+
!* Please select your options *
5+
!* *
6+
!******************************************************************************
77
&COMMAND
88
LDIRECT= 1, ! Simulation direction in time ; 1 (forward) or -1 (backward)
99
IBDATE= 20120101, ! Start date of the simulation ; YYYYMMDD: YYYY=year, MM=month, DD=day
1010
IBTIME= 060000, ! Start time of the simulation ; HHMISS: HH=hours, MI=min, SS=sec; UTC
1111
IEDATE= 20120101, ! End date of the simulation ; same format as IBDATE
1212
IETIME= 120000, ! End time of the simulation ; same format as IBTIME
13-
LOUTSTEP= 3600, ! Interval of model output; average concentrations calculated every LOUTSTEP (s)
14-
LOUTAVER= 3600, ! Interval of output averaging (s)
13+
LOUTSTEP= 10800, ! Interval of model output; average concentrations calculated every LOUTSTEP (s)
14+
LOUTAVER= 10800, ! Interval of output averaging (s)
1515
LOUTSAMPLE= 900, ! Interval of output sampling (s), higher stat. accuracy with shorter intervals
16-
ITSPLIT= 99999999, ! Interval of particle splitting (s)
16+
ITSPLIT= 999999999, ! Interval of particle splitting (s)
1717
LSYNCTIME= 900, ! All processes are synchronized to this time interval (s)
18-
CTL= -5.0000000, ! CTL>1, ABL time step = (Lagrangian timescale (TL))/CTL, uses LSYNCTIME if CTL<0
19-
IFINE= 4, ! Reduction for time step in vertical transport, used only if CTL>1
20-
IOUT= 9, ! Output type: [1]mass 2]pptv 3]1&2 4]plume 5]1&4, +8 for NetCDF output
18+
CTL= -5.0, ! CTL>1, ABL time step = (Lagrangian timescale (TL))/CTL, uses LSYNCTIME if CTL<0
19+
IFINE= 4, ! Reduction for time step in vertical transport, used only if CTL>1
20+
IOUT= 9, ! Output type: [1]mass 2]pptv 3]1&2 4]plume 5]1&4, +8 for NetCDF output
2121
IPOUT= 0, ! Particle position output: 0]no 1]every output 2]only at end 3]time averaged
2222
LSUBGRID= 0, ! Increase of ABL heights due to sub-grid scale orographic variations;[0]off 1]on
2323
LCONVECTION= 1, ! Switch for convection parameterization;0]off [1]on
@@ -29,9 +29,9 @@
2929
IND_SOURCE= 1, ! Unit to be used at the source ; [1]mass 2]mass mixing ratio
3030
IND_RECEPTOR= 1, ! Unit to be used at the receptor; [1]mass 2]mass mixing ratio 3]wet depo. 4]dry depo.
3131
MQUASILAG= 0, ! Quasi-Lagrangian mode to track individual numbered particles
32-
NESTED_OUTPUT= 0, ! Output also for a nested domain
33-
LINIT_COND= 0, ! Output sensitivity to initial conditions (bkw mode only) [0]off 1]conc 2]mmr
32+
NESTED_OUTPUT= 0, ! Output also for a nested domain
33+
LINIT_COND= 0, ! Output sensitivity to initial conditions (bkw mode only) [0]off 1]conc 2]mmr
3434
SURF_ONLY= 0, ! Output only for the lowest model layer, used w/ LINIT_COND=1 or 2
3535
CBLFLAG= 0, ! Skewed, not Gaussian turbulence in the convective ABL, need large CTL and IFINE
3636
OHFIELDS_PATH= "../../flexin/", ! Default path for OH file
37-
/
37+
/

options.meteoswiss/OUTGRID.f

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
!*******************************************************************************
2-
! *
3-
! Input file for the Lagrangian particle dispersion model FLEXPART *
4-
! Please specify your output grid *
5-
! *
6-
! OUTLON0 = GEOGRAPHYICAL LONGITUDE OF LOWER LEFT CORNER OF OUTPUT GRID *
7-
! OUTLAT0 = GEOGRAPHYICAL LATITUDE OF LOWER LEFT CORNER OF OUTPUT GRID *
8-
! NUMXGRID = NUMBER OF GRID POINTS IN X DIRECTION (= No. of cells + 1) *
9-
! NUMYGRID = NUMBER OF GRID POINTS IN Y DIRECTION (= No. of cells + 1) *
10-
! DXOUT = GRID DISTANCE IN X DIRECTION *
11-
! DYOUN = GRID DISTANCE IN Y DIRECTION *
12-
! OUTHEIGHTS = HEIGHT OF LEVELS (UPPER BOUNDARY) *
13-
!*******************************************************************************
1+
!******************************************************************************
2+
!* *
3+
!* Input file for the Lagrangian particle dispersion model FLEXPART *
4+
!* Please specify your output grid *
5+
!* *
6+
!******************************************************************************
147
&OUTGRID
15-
OUTLON0= -10.000, ! GEOGRAPHYICAL LONGITUDE OF LOWER LEFT CORNER OF OUTPUT GRID
16-
OUTLAT0= 35.000, ! GEOGRAPHYICAL LATITUDE OF LOWER LEFT CORNER OF OUTPUT GRID
17-
NUMXGRID= 570, ! NUMBER OF GRID POINTS IN X DIRECTION (= No. of cells + 1)
18-
NUMYGRID= 300, ! NUMBER OF GRID POINTS IN Y DIRECTION (= No. of cells + 1)
19-
DXOUT= 0.10, ! GRID DISTANCE IN X DIRECTION
20-
DYOUT= 0.10, ! GRID DISTANCE IN Y DIRECTION
21-
OUTHEIGHTS= 500.0, 2000, 10000 ! HEIGHT OF LEVELS (UPPER BOUNDARY)
22-
/
8+
OUTLON0= -10.000, ! Geographical longitude of lower left corner of output grid
9+
OUTLAT0= 35.000, ! Geographical latitude of lower left corner of output grid
10+
NUMXGRID= 570, ! Number of grid points in x direction (= No. of cells + 1)
11+
NUMYGRID= 300, ! Number of grid points in y direction (= No. of cells + 1)
12+
DXOUT= 0.10, ! Grid distance in x direction
13+
DYOUT= 0.10, ! Grid distance in y direction
14+
OUTHEIGHTS=500.,2000.,10000. ! Height of levels (upper boundary)
15+
/

options.meteoswiss/OUTGRID.g

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
!*******************************************************************************
2-
! *
3-
! Input file for the Lagrangian particle dispersion model FLEXPART *
4-
! Please specify your output grid *
5-
! *
6-
! OUTLON0 = GEOGRAPHYICAL LONGITUDE OF LOWER LEFT CORNER OF OUTPUT GRID *
7-
! OUTLAT0 = GEOGRAPHYICAL LATITUDE OF LOWER LEFT CORNER OF OUTPUT GRID *
8-
! NUMXGRID = NUMBER OF GRID POINTS IN X DIRECTION (= No. of cells + 1) *
9-
! NUMYGRID = NUMBER OF GRID POINTS IN Y DIRECTION (= No. of cells + 1) *
10-
! DXOUT = GRID DISTANCE IN X DIRECTION *
11-
! DYOUN = GRID DISTANCE IN Y DIRECTION *
12-
! OUTHEIGHTS = HEIGHT OF LEVELS (UPPER BOUNDARY) *
2+
!* *
3+
!* Input file for the Lagrangian particle dispersion model FLEXPART *
4+
!* Please specify your output grid *
5+
!* *
136
!*******************************************************************************
147
&OUTGRID
15-
OUTLON0= -179.50, ! GEOGRAPHYICAL LONGITUDE OF LOWER LEFT CORNER OF OUTPUT GRID
16-
OUTLAT0= -90.00, ! GEOGRAPHYICAL LATITUDE OF LOWER LEFT CORNER OF OUTPUT GRID
17-
NUMXGRID= 1440, ! NUMBER OF GRID POINTS IN X DIRECTION (= No. of cells + 1)
18-
NUMYGRID= 720, ! NUMBER OF GRID POINTS IN Y DIRECTION (= No. of cells + 1)
19-
DXOUT= 0.25, ! GRID DISTANCE IN X DIRECTION
20-
DYOUT= 0.25, ! GRID DISTANCE IN Y DIRECTION
21-
OUTHEIGHTS= 500.0, 2000, 10000 ! HEIGHT OF LEVELS (UPPER BOUNDARY)
22-
/
8+
OUTLON0= -179.50, ! Geographical longitude of lower left corner of output grid
9+
OUTLAT0= -90.00, ! Geographical latitude of lower left corner of output grid
10+
NUMXGRID= 1440, ! Number of grid points in x direction (= No. of cells + 1)
11+
NUMYGRID= 720, ! Number of grid points in y direction (= No. of cells + 1)
12+
DXOUT= 0.25, ! Grid distance in x direction
13+
DYOUT= 0.25, ! Grid distance in y direction
14+
OUTHEIGHTS=500.,2000.,10000. ! Height of levels (upper boundary)
15+
/

options.meteoswiss/RELEASES

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
***************************************************************************************************************
2-
* *
3-
* *
4-
* *
5-
* Input file for the Lagrangian particle dispersion model FLEXPART *
6-
* Please select your options *
7-
* *
8-
* *
9-
* *
10-
***************************************************************************************************************
1+
!******************************************************************************
2+
!* *
3+
!* Input file for the Lagrangian particle dispersion model FLEXPART *
4+
!* Please select your options *
5+
!* *
6+
!******************************************************************************
117
&RELEASES_CTRL
12-
NSPEC = 1, ! Total number of species
13-
SPECNUM_REL= 24, ! Species numbers in directory SPECIES
14-
/
15-
&RELEASE ! For each release
8+
NSPEC = 1, ! Total number of species
9+
SPECNUM_REL = 16, ! Species numbers in directory SPECIES
10+
/
11+
&RELEASE ! For each release
1612
IDATE1 = 20120101, ! Release start date, YYYYMMDD: YYYY=year, MM=month, DD=day
1713
ITIME1 = 090000, ! Release start time in UTC HHMISS: HH hours, MI=minutes, SS=seconds
1814
IDATE2 = 20120101, ! Release end date, same as IDATE1
@@ -21,10 +17,10 @@
2117
LON2 = 0.000, ! Right longitude of release box, same as LON1
2218
LAT1 = 20.000, ! Lower latitude of release box, -90 < LAT1 < 90
2319
LAT2 = 20.000, ! Upper latitude of release box same format as LAT1
24-
Z1 = 50.000, ! Lower height of release box meters/hPa above reference level
25-
Z2 = 50.000, ! Upper height of release box meters/hPa above reference level
20+
Z1 = 100.000, ! Lower height of release box meters/hPa above reference level
21+
Z2 = 100.000, ! Upper height of release box meters/hPa above reference level
2622
ZKIND = 1, ! Reference level 1=above ground, 2=above sea level, 3 for pressure in hPa
2723
MASS = 1.0000E0, ! Total mass emitted, only relevant for fwd simulations
28-
PARTS = 10000, ! Total number of particles to be released
24+
PARTS = 200000, ! Total number of particles to be released
2925
COMMENT = "RELEASE 1", ! Comment, written in the outputfile
30-
/
26+
/

test_meteoswiss/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ Testing with script `test-fp`
55
-----------------------------
66

77
Test script to prepare input data and run Flexpart. It
8-
- Retrieves GRIB file from the operational (or a personal) COSMO storage
9-
- Generates the 'pathnames' and the 'AVAILABLE' files
10-
- Adapts the FLEXPART control input files according to the arguments
11-
- Writes a batch job file
8+
- Retrieves GRIB file from the operational or from a personal ICON storage
9+
- Generates the `pathnames` and the `AVAILABLE` files
10+
- Adapts the FLEXPART control input files according to the provided arguments
11+
- Writes a batch-job file
1212
- Submits the job on a queue
1313

1414
See usage and a short help with command
1515

1616
./test-fp --help
1717

18-
For all settings see settings section of the script.
18+
For the full list of configuration options, refer to the Settings section within the script.
1919

20-
The mandatory input can be selected from command-line menus when
21-
starting the script
20+
When the script is called with no options or not all of the mandatory input,
21+
it will prompt the user to select from command-line menus.
2222

2323
./test-fp
2424

test_meteoswiss/plot_output

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ list_max=8
2323
ncpus=5
2424
# --------
2525

26-
# Function
27-
# --------
26+
# Functions
27+
# ---------
2828
function display_help {
2929
# Show script usage
3030
cat >&2 << EOF
@@ -43,14 +43,33 @@ Mandatory arguments to long options are mandatory for short options too.
4343
-f, --force invoke pyflexplot even if plots already exist
4444
-h, --help display this help and exit
4545
-n, --dry-run print commands without executing them
46+
-W, --dry-wet additonally plot dry and wet deposition separately
4647
-N, --ncpus=NCPUS use NCPUS parallel threads for pyflexplot
4748
-O, --operational use operational pyflexplot from osm
4849
-p, --preset=PRESET use pyflexplot with preset PRESET
49-
-w, --wait wait for batch job completion, allows to list results.
50+
-s, --steps plot step values rather than accumulated values
51+
-w, --wait wait for batch job completion, allows to list results
5052
5153
EOF
5254
} # function display_help
5355

56+
function cleanup_plot_dir {
57+
# Check if plots exist
58+
if ls $1/*p[dn][fg] > /dev/null 2>&1 ; then
59+
echo -n $tag: "Plot files already exist in $1"
60+
if [[ -n $clean ]] ; then
61+
echo ", deleting."
62+
rm -rf $1/*{png,pdf}
63+
elif [[ -z $force ]] ; then
64+
echo ", use --force to overwrite."
65+
exe_cmd="echo -e $tag: SKIP: Plots already present, skipping:\n\e[07;32m \e[0m "
66+
wait_opt=skipped
67+
else
68+
echo ", overwriting."
69+
fi
70+
fi
71+
} # function cleanup_plot_dir
72+
5473
# Initialization
5574
# --------------
5675
tag=$(basename $0)
@@ -66,12 +85,15 @@ while (( $# > 0 )) ; do
6685
-d | --debug)
6786
debug=yes
6887
;;
69-
-e | --ensemble)
70-
ensemble=yes
71-
;;
7288
-n | --dry-run)
7389
dry_run=yes
7490
;;
91+
-D | --dry-wet)
92+
dry_wet=yes
93+
;;
94+
-e | --ensemble)
95+
ensemble=yes
96+
;;
7597
-f | --force)
7698
force=yes
7799
;;
@@ -98,6 +120,9 @@ while (( $# > 0 )) ; do
98120
(( $# > 1 )) && shift && preset="$1"
99121
fi
100122
;;
123+
-s | --steps)
124+
steps=yes
125+
;;
101126
-w | --wait)
102127
wait_opt=-w
103128
;;
@@ -158,21 +183,6 @@ infiles=( $jobout/*.nc )
158183
echo $tag: "Producing plots from: ${infiles[*]}"
159184
echo $tag: "Producing plots in: $plotdir"
160185

161-
# Check if plots exist
162-
if ls $plotdir/*p[dn][fg] > /dev/null 2>&1 ; then
163-
echo -n $tag: "Plot files already exist"
164-
if [[ -n $clean ]] ; then
165-
echo ", deleting."
166-
rm -rf $plotdir/*{png,pdf}
167-
elif [[ -z $force ]] ; then
168-
echo ", use --force to overwrite."
169-
exe_cmd="echo -e $tag: SKIP: Plots already present, skipping:\n\e[07;32m \e[0m "
170-
wait_opt=skipped
171-
else
172-
echo ", overwriting."
173-
fi
174-
fi
175-
176186
# Derive variables 'job' (job name or number) and 'resol' (resolution)
177187
# from test-fp.log
178188
if [[ ! -e test-fp.log ]] ; then
@@ -249,20 +259,43 @@ if [[ -n $operational || ! -x $pyflexplot ]] ; then
249259
fi
250260
echo $tag: "Found pyflexplot: $pyflexplot"
251261

252-
253262
# Report executable
254263
echo $tag: "Using pyflexplot executable:" \
255264
$(ls -l --time-style=long-iso $pyflexplot | cut -d\ -f6- )
256265

266+
# Steps option
267+
if [[ -n $steps ]] ; then
268+
plotdir=${plotdir}_steps
269+
echo $tag: "Steps option--steps set, new plot directory: $plotdir"
270+
integrate_opt="--setup integrate false"
271+
fi
272+
257273
# Submit job
258274
for infile in ${infiles[*]} ; do
259275
echo $tag: "Submitting job to plot: ${infile}"
276+
cleanup_plot_dir $plot_dir
260277
# Option -w: wait for job to complete
261278
[[ -n $wait_opt ]] && echo $tag: "Waiting for job completion."
262279
$exe_cmd batchPP -t 2 -T 5 -n pfp_$jobdir $wait_opt -- \
263-
$pyflexplot --preset=$preset --merge-pdfs \
280+
$pyflexplot --preset=$preset --merge-pdfs $integrate_opt \
264281
--setup infile $infile $base_time_opt \
265-
--dest=$plotdir --num-procs=\$SLURM_CPUS_PER_TASK
282+
--dest=$plotdir \
283+
--num-procs=\$SLURM_CPUS_PER_TASK
284+
# Separate deposition option
285+
if [[ -n $dry_wet ]] ; then
286+
for depotype in dry wet ; do
287+
echo $tag: "Dry/wet deposition option --dry-wet set," \
288+
"additional plot directory: ${plotdir}_${depotype}"
289+
cleanup_plot_dir ${plotdir}_${depotype}
290+
291+
$exe_cmd batchPP -t 2 -T 5 -n pfp_$jobdir${depotype} $wait_opt -- \
292+
$pyflexplot --preset=$preset --merge-pdfs $integrate_opt \
293+
--setup infile $infile $base_time_opt \
294+
--setup plot_variable ${depotype}_deposition \
295+
--dest=${plotdir}_${depotype} \
296+
--num-procs=\$SLURM_CPUS_PER_TASK
297+
done
298+
fi
266299
done
267300

268301
if [[ -n $jobdir ]] ; then

0 commit comments

Comments
 (0)