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 plot

  • savepath (str) – path to save

  • ls (trace_source.land_sfc.land_sfc, optional) – pre loaded land surface information

  • config (dict, optional) – the toml derived config dict

Returns

None

class trace_source.hysplit.assemble_time_height(config_file='../config.toml')[source]
assemble(dt_range=None)[source]

assemble the statistics for a range of trajectories and save the statistics to dicts

Parameters

dt_range (list(datetime), optional) – timerange for that the statistics is assembled, default taken from config

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

evaluate(silent=False)[source]

adds some general statistic to a single trajectory

Keys: Tmin_whole, Precip_whole, RHmax_whole, Tmin_24h, Precip_24h, RHmax24h, min_height_ag, traj_distance_total, mean_bearing_from_endpoint

Parameters

silent (bool, optional) – verbose output or not

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])

trace_source.land_sfc.argnearest(value, array, delta)[source]
class trace_source.land_sfc.land_sfc[source]

load the data from the geotiff data/resampledLCType.tif and concatenate to the simplified scheme

MODIS 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

get_land_sfc(lat, lon)[source]

get the land use pixel for a given coordinate interpolation to the nearest pixel is done

Parameters
  • lat (float, array) – latitude

  • lon (float, array) – longitude

Returns

array or int with the land use category

get_land_sfc_shape(shp)[source]

get the land use inside a given shape

Parameters

shp – shapely Multipolygon

Deprecated since version 0.1: use the ensemble trajectories instead

class trace_source.land_sfc.named_geography(selected_type)[source]

handle a single trajectory

Parameters

selected_type (str) – name in the geonames_config.toml

get_geo_names(lat, lon)[source]

get the names defined in the shapefile for a given coordinate

Parameters
  • lat (float, array) – latitude

  • lon (float, array) – longitude

Returns

array or int with the geoname category

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

trace_source.get_git_hash()[source]
Returns

git describe string

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