Data Processing

Binning

profiler.binning.bin_profilerdata(pdata: ProfilerData, pmin: float = 10, pstep: float = 10, pmax: float = 200.0, pd: str = 'd', exclude='bad')[source]

Bins oceanographic data in pressure or depth on the grid [pmin:pstep:pmax].

Parameters:

pdataprofilerdata.ProfilerData

Object containing oceanographic data with fields like time, lat, lon, etc.

pminfloat

Minimum pressure/depth value

pstepfloat

Step size for pressure/depth bins

pmaxfloat

Maximum pressure/depth value

pdstr

‘p’ for pressure or ‘d’ for depth binning

excludestr, optional

‘none’, ‘bad’, or ‘questionable’ to specify which points to exclude

Returns:

bData : ProfilerData object

Key Functions

profiler.binning.bin_profilerdata(pdata: ProfilerData, pmin: float = 10, pstep: float = 10, pmax: float = 200.0, pd: str = 'd', exclude='bad')[source]

Bins oceanographic data in pressure or depth on the grid [pmin:pstep:pmax].

Parameters:

pdataprofilerdata.ProfilerData

Object containing oceanographic data with fields like time, lat, lon, etc.

pminfloat

Minimum pressure/depth value

pstepfloat

Step size for pressure/depth bins

pmaxfloat

Maximum pressure/depth value

pdstr

‘p’ for pressure or ‘d’ for depth binning

excludestr, optional

‘none’, ‘bad’, or ‘questionable’ to specify which points to exclude

Returns:

bData : ProfilerData object

GSW Processing

profiler.processing.gsw.process_dict(ifloat: dict)[source]

Process the data in the dictionary using gsw

The fields in the dictionary are:

lat, lon, time, s, t, p

The following fields are added:

depth, SA, theta, CT, sigma, rho

Parameters:

ifloat (dict) – The dictionary of data to process.

Geographic Calculations

Python functions for calculating offsets and distances from a line

profiler.utils.offsets.calc_dist_offset(lons: ndarray, lats: ndarray, endpoints: tuple, debug: bool = False)[source]
Calculate the distnace from shore and offset from a line

for a given line

Parameters:
  • lons (np.ndarray) – longitudes

  • lats (np.ndarray) – latitudes

  • endpoints (tuple, optional) – endpoints of the “line”. Defaults to None. lonendpts latendpts

  • debug (bool, optional) – If True, print debug information. Defaults to False.

Returns:

dist, offset

dist = distance from the start of the line offset = offset from the line (normal)

Return type:

tuple

profiler.utils.offsets.jsonify(obj, debug=False)[source]

Recursively process an object so it can be serialised in json format. Taken from linetools.

WARNING - the input object may be modified if it’s a dictionary or list!

Parameters:
  • obj (any object)

  • debug (bool, optional)

Returns:

  • obj - the same obj is json_friendly format (arrays turned to

  • lists, np.int64 converted to int, np.float64 to float, and so on).

profiler.utils.offsets.savejson(filename: str, obj: dict, overwrite=False, indent=None, easy_to_read=False, **kwargs)[source]

Save a python object to filename using the JSON encoder.

Parameters:
  • filename (str)

  • obj (object) – Frequently a dict

  • overwrite (bool, optional)

  • indent (int, optional) – Input to json.dump

  • easy_to_read (bool, optional) – Another approach and obj must be a dict

  • kwargs (optional) – Passed to json.dump

profiler.utils.offsets.loadjson(filename)[source]

Load a python object saved with savejson.

Parameters:

filename (str) – The path to the JSON file.

Returns:

The loaded Python object.

Return type:

obj

profiler.utils.offsets.merge_dicts(dict_list: list)[source]
profiler.utils.offsets.match_ids(IDs, match_IDs, require_in_match=True)[source]

Match input IDs to another array of IDs (usually in a table) Return the rows aligned with input IDs

Parameters:
  • IDs (ndarray) – IDs that are to be found in match_IDs

  • match_IDs (ndarray) – IDs to be searched

  • require_in_match (bool, optional) – Require that each of the input IDs occurs within the match_IDs

Returns:

rows – Rows in match_IDs that match to IDs, aligned -1 if there is no match

Return type:

ndarray

profiler.utils.offsets.round_to_day(dt)[source]

Key Functions

profiler.utils.offsets.calc_dist_offset(lons: ndarray, lats: ndarray, endpoints: tuple, debug: bool = False)[source]
Calculate the distnace from shore and offset from a line

for a given line

Parameters:
  • lons (np.ndarray) – longitudes

  • lats (np.ndarray) – latitudes

  • endpoints (tuple, optional) – endpoints of the “line”. Defaults to None. lonendpts latendpts

  • debug (bool, optional) – If True, print debug information. Defaults to False.

Returns:

dist, offset

dist = distance from the start of the line offset = offset from the line (normal)

Return type:

tuple

Profile Pairing