Lagranto¶
The goal of this section is show how to calculate trajectories, analyzed them and plot them using the lagranto package.
Calculation¶
The lagranto package provide a class, dypy.lagranto.LagrantoRun
, to wrap the Lagranto programs in python. It allow to calculate trajectories in parallel. You can take a look at the docstring to get familiar with the class.
Let’s say that we want to calculate Warm Conveyor Belt trajectories for a 5 day period in June 2013.
Using Era-Interim we can start trajectories every 6 hour and we will calculate them for 48 hours forward in time. Since dypy.lagranto.LagrantoRun
needs a list of (startdate, enddate), we can build the dates as follow:
from datetime import datetime, timedelta
from dypy.small_tools import interval
startdate = datetime(2013, 6, 1, 0)
enddate = startdate + timedelta(days=5)
dates = [(d, d + timedelta(hours=48))
for d in interval(startdate, enddate,
timedelta(hours=6))]
If the Era-interim data are in the erainterim folder and if the output files should be written in the output folder, then the dypy.lagranto.LagrantoRun
can be initialized as follow:
from dypy.lagranto import LagrantoRun
lrun = LagrantoRun(dates, workingdir='erainterim',
outputdir='output')
We want to start the trajectories every 20km in the box [5E, 40E, 30N, 60N], so let’s create a starting file:
specifier = "'box.eqd(5,40,30,60,20)@profile(1000,500,100) @hPa'"
lrun.create_startf(startdate, specifier)
We can now calculate the trajectories, but first starting for a single date to test our setup:
lrun.caltra(*dates[0])
Next steps to be done