WeatherRoutingTool.utils package
Submodules
WeatherRoutingTool.utils.formatting module
Utility functions.
- class WeatherRoutingTool.utils.formatting.NumpyArrayEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
Bases:
JSONEncoder
- default(obj)[source]
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o)
WeatherRoutingTool.utils.graphics module
- WeatherRoutingTool.utils.graphics.create_map(lat1, lon1, lat2, lon2, dpi)[source]
Return map figure.
- WeatherRoutingTool.utils.graphics.create_maps(lat1, lon1, lat2, lon2, dpi, winds, n_maps)[source]
Return map figure.
- WeatherRoutingTool.utils.graphics.generate_basemap(fig, depth, start=None, finish=None, title='', show_depth=True, show_gcr=False)[source]
- WeatherRoutingTool.utils.graphics.get_gcr_points(lat1, lon1, lat2, lon2, n_points=10)[source]
Discretize gcr between two scalar coordinate points.
- WeatherRoutingTool.utils.graphics.get_hist_values_from_boundaries(bin_boundaries, contend_unnormalised)[source]
- WeatherRoutingTool.utils.graphics.get_hist_values_from_widths(bin_widths, contend_unnormalised, power_type)[source]
- WeatherRoutingTool.utils.graphics.plot_gcr(fig, lat1, lon1, lat2, lon2)[source]
Add gcrs between provided points to the map figure.
WeatherRoutingTool.utils.maps module
WeatherRoutingTool.utils.unit_conversion module
Utility functions.
- WeatherRoutingTool.utils.unit_conversion.check_dataset_spacetime_consistency(ds1, ds2, coord, ds1_name, ds2_name)[source]
- WeatherRoutingTool.utils.unit_conversion.knots_to_mps(vals)[source]
Convert the Meters/second to knots. Knot is a unit of speed equal to one nautical mile per hour, exactly 1.852 km/h.
- WeatherRoutingTool.utils.unit_conversion.mps_to_knots(vals)[source]
Convert the meters/second to knots. Knot is a unit of speed equal to one nautical mile per hour, exactly 1.852 km/h.
- WeatherRoutingTool.utils.unit_conversion.round_time(dt=None, round_to=60)[source]
Round a datetime object to any time lapse in seconds. ref: /questions/3463930/how-to-round-the-minute-of-a-datetime-object :param dt: datetime.datetime object, default now. :type dt: datetime.datetime :param round_to: closest number of seconds to round to, defaults to 60 :type round_to: int :return: :rtype: datetime.datetime