Flexpart.jl is a Julia interface to the FLEXPART Lagrangian transport and dispersion model. It provides the following:
- It makes the FLEXPART executable available in the Julia environment.
- It maps the FLEXPART syntax to common Julia data structures to facilitate the settings of simulations in Julia
The package is not yet on the official registry, and must be installed this way:
using Pkg; Pkg.add(url="https://github.com/tcarion/Flexpart.jl")
The first thing to do for running FLEXPART is to create a directory with a pathnames
file:
using Flexpart
# You can create a default Flexpart directory with:
fpsim = Flexpart.create("example")
# you can use an existing one with:
fpsim = FlexpartSim("existing")
# or you can create a temporary default directoy with:
fpsim = FlexpartSim()
Then let's define the location of the input files. The retrieval and pre-processing of the input meteorological data for Flexpart needs to be done with the FlexExtract.jl package.
fpsim[:input] = "path/to/inputs"
# This will write the changes to the pathnames file.
Flexpart.save(fpsim)
The FLEXPART options can be modified this way:
options = FlexpartOption(fpsim)
# Options can be accessed and modified as a Julia Dictionnary
options["COMMAND"][:COMMAND][:IOUT] = 9
# Some helper functions also exist to facilitate the modification of the options
set_point_release!(options, 4.4, 50.5)
# We write the changes to the files
Flexpart.save(options)
And finally Flexpart can be run:
Flexpart.run(fpsim)
The NetCDF output can be easily read and plotted with Rasters.jl and Plots.jl:
using Rasters, Plots
# loading of the output file
output_file = first(OutputFiles(fpsim))
# we read the output with Rasters.jl
output_stack = RasterStack(string(output_file))
conc = output_stack[:spec001_mr]
# and plot the result
plot(conc[Ti = 2, height = 1, pointspec = 1, nageclass = 1])
- This package is under heavy development and the API is subjected to change substantially.
- The FLEXPART binary has only been compiled for Linux systems for now, so this package won't work on Windows and macOS.