pepys_import.utils package¶
Submodules¶
pepys_import.utils.branding_util module¶
pepys_import.utils.config_utils module¶
pepys_import.utils.data_store_utils module¶
- pepys_import.utils.data_store_utils.chunked_list(lst, size)[source]¶
Split a list into multiple chunks of length size. Returns a list containing sublists of length size.
If the list doesn’t divide by size exactly, then the last sublist will have a length < size.
- pepys_import.utils.data_store_utils.create_spatial_tables_for_postgres(engine)[source]¶
Create schema pepys and extension for PostGIS
- pepys_import.utils.data_store_utils.create_spatial_tables_for_sqlite(engine)[source]¶
Create geometry_columns and spatial_ref_sys metadata table
pepys_import.utils.datafile_utils module¶
pepys_import.utils.geoalchemy_utils module¶
pepys_import.utils.import_utils module¶
- pepys_import.utils.import_utils.import_module_(file)[source]¶
Import modules using file object’s full path and name.
- Parameters
file (File) – File object, which has name and full path attributes
pepys_import.utils.unit_utils module¶
- pepys_import.utils.unit_utils.acceptable_bearing_error(bearing1, bearing2, delta)[source]¶
Determines if the two bearings are more than a set angle apart, allowing for angles that span zero (North)
- Parameters
bearing1 (number (degrees)) – The first bearing
bearing2 (number (degrees)) – The second bearing
delta (number (degrees)) – The acceptable separation
- pepys_import.utils.unit_utils.bearing_between_two_points(first_location, second_location)[source]¶
Calculate the bearing(angle) between two points on the earth (specified in decimal degrees).
- Parameters
first_location – First location point
second_location – Second location point
- Returns
angle between two points in degrees
- pepys_import.utils.unit_utils.convert_absolute_angle(angle, line_number, errors, error_type)[source]¶
Converts given absolute angle value to degree and does sanity checks
- Parameters
angle (String) – Angle value in string format
line_number (String) – Line number
errors (List) – Error List to save value error if it raises
error_type (String) – Type of error
- Returns
Returns a tuple of a boolean is_valid flag and the converted angle value
- pepys_import.utils.unit_utils.convert_distance(distance, units, line_number, errors, error_type)[source]¶
Converts the given distance string to a Quantity consisting of a float value and the given units.
- Parameters
distance (String) – distance value in string format
units (String) – units of distance for supplied measurement
line_number (String) – Line number
errors (List) – Error List to save value error if it raises
error_type (String) – Type of error
- Returns
Returns a tuple of a boolean is_valid flag, and the converted distance value
- pepys_import.utils.unit_utils.convert_frequency(frequency, units, line_number, errors, error_type)[source]¶
Converts the given frequency string to a Quantity containing a float value and the given units
- Parameters
frequency (String) – frequency value in string format
units (String) – units of frequency for supplied measurement
line_number (String) – Line number
errors (List) – Error List to save value error if it raises
error_type (String) – Type of error
- Returns
Returns a tuple of a boolean is_valid flag, and the converted frequency value
- pepys_import.utils.unit_utils.convert_speed(speed, units, line_number, errors, error_type)[source]¶
Parses the given speed value into a float and assigns the given units
- Parameters
speed (String) – Speed value in string format
units (pint unit) – Units of the speed (as a pint unit instance)
line_number (String) – Line number
errors (List) – Error List to save value error if it raises
error_type (String) – Type of error
- Returns
Returns a tuple of a boolean is_valid flag, and the converted speed value
- pepys_import.utils.unit_utils.distance_between_two_points_haversine(first_location, second_location)[source]¶
Calculate the great circle distance between two points on the earth (specified in decimal degrees).
- Parameters
first_location – First location point
second_location – Second location point
- Returns
distance in kilometers
pepys_import.utils.value_transforming_utils module¶
- pepys_import.utils.value_transforming_utils.format_datetime(datetime)[source]¶
- Converts datetime to an appropriate format. The format is as follows:
YYMMDD HHMMSS.SSS (Date, either 2 of 4 figure date, followed by month then date, and Time)
- Parameters
datetime (Datetime.Datetime) – Datetime of the object
- Returns
Converted datetime
- Return type
str