api documentation¶
hysplit module¶
-
trace_source.hysplit.
plot_trajectories_ens
(traj, savepath, ls=None, config=None)[source]¶ plot multiple trajectories into one scene
- Parameters
traj (
trajectory
) – trajectory to plot instance to plotsavepath (str) – path to save
ls (
trace_source.land_sfc.land_sfc
, optional) – pre loaded land surface informationconfig (dict, optional) – the toml derived config dict
- Returns
None
-
class
trace_source.hysplit.
trajectory
(config)[source]¶ handle a single trajectory
- Parameters
config (dict) – content of the config file
-
load_file
(filename, silent=False)[source]¶ load a trajectory from the .tdump file
- Parameters
filename (str) – path and name of the file
silent (bool, optional) – verbose output or not
-
load_dict
(d)[source]¶ load the trajectory without the original data
Note
only the first member of a ensemble is saved
- Parameters
d (dict) –
-
load_netcdf
(ncf, dt, height)[source]¶ load the trajectory at a given datetime and height from the provided netcdf file
- Parameters
( (ncf) – obj:netCDF4.Dataset): netcdf4 Dataset to add
dt – datetime of trajectory to load
height – height of trajectory to load
- Returns
dict with data
Keys:
time
,age
,latitude
,longitude
,height
Optional
pressure
,air_tem
,rainfall
,relhumid
,terr_msl
-
add_land_sfc
(ls=None, silent=False)[source]¶ add the land surface information to a single trajectory
- Parameters
ls (
trace_source.land_sfc.land_sfc
, optional) – pre loaded land surface information (separate loading consumes lot of time)silent (bool, optional) – verbose output or not
-
add_ensemble_land_sfc
(ls=None)[source]¶ add the land surface information to an ensemble trajectory
- Parameters
ls (
trace_source.land_sfc.land_sfc
, optional) – pre loaded land surface information (separate loading consumes lot of time)
-
add_ensemble_geo_names
(ng=None)[source]¶ add the geographical names to a ensemble trajectory
- Parameters
ng (
trace_source.land_sfc.named_geography
, optional) – pre loaded named geography information (separate loading consumes lot of time)
-
add_ensemble_lat_thres
()[source]¶ add the latitude threshold to a ensemble trajectory
- Parameters
silent (bool, optional) – verbose output or not
-
add_area_land_sfc
(maxheight, ls=None, silent=False)[source]¶ land use inside an area around the trajectory
add the shape to
self.shapes['shp_below{:.1f}km']
and the statistics to
self.stat_ls['occ_shp_below{:.1f}km']
sizes of circle (in 24h steps):
[ 0.05 , 0.15 , 0.4 , 0.77666667, 1.25666667, 1.81666667, 2.43333333, 3.08333333, 3.74333333, 4.39 , 5.]
- Parameters
maxheight – maximum height in meters or md for MIXDEPTH
ls (
trace_source.land_sfc.land_sfc
, optional) – pre loaded land surface information (separate loading consumes lot of time)silent (bool, optional) – verbose output or not
Deprecated since version 0.1: use the ensemble trajectories instead
land surface module¶
-
trace_source.land_sfc.
nearest
(point, array, delta)[source]¶ calculate the index directly
- Parameters
point (float) – point to search for
array (np.array) – array to search in
delta – step size in array
- Returns
(i, array[i])
-
class
trace_source.land_sfc.
land_sfc
[source]¶ load the data from the geotiff
data/resampledLCType.tif
and concatenate to the simplified schemeMODIS Category
simplified
0
0 water
1,2,3,4,5,6
1 forest
7,8,9
2 savanna, shrubland
10, 11, 12, 14
3 grass, cropland
13
4 urban
15
5 snow
16
6 barren
trace module¶
-
trace_source.
time_list
(begin, end, delta)[source]¶ generate a time list from begin to <= end with delta
- Parameters
begin (datetime) – start time
end (datetime) – end time (included)
- Returns
List of generated datetime objects
- Return type
list
-
trace_source.
save_item
(dataset, item_data)[source]¶ Save an item to the dataset with the data given as a dict
- Parameters
( (dataset) – obj:netCDF4.Dataset): netcdf4 Dataset to add
item_data (dict) – with the data to add, for example:
Key
Example
var_name
Z
dimension
(‘time’, ‘height’)
arr
self.corr_refl_reg[:].filled()
long_name
“Reflectivity factor”
optional
comment
“Wind profiler reflectivity factor corrected by cloud radar”
units
“dBz”
missing_value
-200.
plot_range
[-50., 20.]
plot_scale
“linear”
vartype
np.float32
-
class
trace_source.
assemble_pattern
(config_file='../config.toml')[source]¶ assemble a time height period by putting multiple hysplit trajectories togehter, calculate the statistics and save to a netcdf file
- Parameters
config_file (str, optional) – path to the config file
-
dump2netcdf
(model_str='hysplit')[source]¶ dump the assembled data to a netcdf file repeatatly call
save_item()
configuration (directories, names, etc) is given by the config file