foxes.utils

Utilities and helper functions that are not foxes specific.

foxes.utils.wd2uv(wd, ws=1.0, axis=-1)[source]

Calculate wind vectors from wind directions in degrees.

foxes.utils.wd2wdvec(wd, ws=1.0, axis=-1)[source]

Calculate wind direction vectors from wind directions in degrees.

foxes.utils.wdvec2wd(wdvec, axis=-1)[source]

Calculate wind direction from wind direction vectors.

foxes.utils.uv2wd(uv, axis=-1)[source]

Calculate wind direction from wind vectors.

foxes.utils.delta_wd(wd_a, wd_b)[source]

Calculates wd_b - wd_a.

foxes.utils.all_subclasses(cls)[source]

Searches all classes derived from some base class.

foxes.utils.cubic_roots(a0, a1, a2, a3=None)[source]

Calculate real roots of polynomials of degree 3.

foxes.utils.read_shp(fname, **kwargs)[source]

Read a shape file

foxes.utils.shp2csv(ifile, ofile, in_kwargs={}, out_kwargs={}, ...)[source]

Read shape file, write csv file

foxes.utils.read_shp_polygons(fname, names=None, name_col, ...)[source]

Reads the polygon points from a shp file.

foxes.utils.shp2geom2d(*args, ret_utm_zone=False, **kwargs)[source]

Read shapefile into geom2d geometry

foxes.utils.import_module(name, package=None, hint=None)[source]

Imports a module dynamically.

foxes.utils.load_module(name, path)[source]

Imports a module from file path

foxes.utils.exec_python(s, indicator='%', newline=';', ...)[source]

Executes strings that start with the indicator as python commands, returns one value

foxes.utils.sqrt_reg(x, x0=0.01)[source]

A regularized sqrt function, producing non-zero values also for smallish negative x.

foxes.utils.read_tab_file(fname, normalize=True)[source]

Reads a tab file into a Dataset

foxes.utils.random_xy_square(n, min_dist=500, xmax_ini=None, ...)[source]

Creates random xy positions within a square, with mean (0, 0)

class foxes.utils.PandasFileHelper[source]

This class helps reading and writing data to files via pandas.

class foxes.utils.Dict(dict)[source]

A slightly enhanced dictionary.

class foxes.utils.Factory[source]

Constructs objects from a choice of allowed constructor parameters

class foxes.utils.FDict(foxes.utils.Dict)[source]

A dictionary with factory support

class foxes.utils.DataBook[source]

Container class for file paths, either directly given or as static data within a package.

class foxes.utils.TabWindroseAxes(windrose.windrose.WindroseAxes)[source]

A derivate of the wind rose axes that runs on stochastic data (bins with weights) instead of time series data

foxes.utils.abl

foxes.utils.geom2d

class foxes.utils.geom2d.AreaGeometry[source]

Abstract base class for closed 2D geometries.

class foxes.utils.geom2d.InvertedAreaGeometry(foxes.utils.geom2d.AreaGeometry)[source]

Base class for inverted geometries.

class foxes.utils.geom2d.AreaUnion(foxes.utils.geom2d.AreaGeometry)[source]

The union of area geometries.

class foxes.utils.geom2d.AreaIntersection(foxes.utils.geom2d.AreaGeometry)[source]

The intersection of area geometries.

class foxes.utils.geom2d.ClosedPolygon(foxes.utils.geom2d.AreaGeometry)[source]

This class represents a closed 2D polygon.

class foxes.utils.geom2d.Circle(foxes.utils.geom2d.AreaGeometry)[source]

This class represents the area of a circle.

class foxes.utils.geom2d.HalfPlane(foxes.utils.geom2d.AreaGeometry)[source]

This class represents a half plane in 2d.

foxes.utils.runners

class foxes.utils.runners.Runner[source]

Abstract base class for runners.

class foxes.utils.runners.DefaultRunner(foxes.utils.runners.Runner)[source]

Class for default function execution.

class foxes.utils.runners.DaskRunner(foxes.utils.runners.Runner)[source]

Class for function execution via dask

foxes.utils.two_circles

foxes.utils.two_circles.area(r1, r2, d)[source]

Calculates the intersection of two circles with radii r1, r2 and a centre point distance d.

foxes.utils.two_circles.calc_area(r1, r2, d)[source]

Calculates the intersection of two circles.