r2r_ctd.checks

The basic check functions that are done on files or paths.

The original intent was that all the functions that produce the 4 element stoplight report would live here and be 1-1 with each check in that report. It became clear that this was not going to work well pretty early as most of those report elements are from an aggregate over all the stations. Additionally, some checks serve as a sieve, for example, stations where is_deck_test() returns true aren’t checked or considered in the report at all.

The first check in the qa report is just checking that the breakout itself is valid before anything else happens. That check is over in r2r_ctd.breakout.Breakout.manifest_ok.

Attributes

Functions

is_deck_test(→ bool)

Check if the given path "looks like" a deck test

check_three_files(→ bool)

Check that each hex file has both an xmlcon and hdr files associated with it.

check_lon_lat_valid(→ bool)

Checks if a valid lat/lon can even be extracted from the hex/header

check_time_valid(→ bool)

Checks if a valid time can even be extracted from the hex/header

check_lon_lat(→ bool)

Checks that the lon lat of the cast are within the cruise bounding box

check_dt(→ bool)

Checks that the time of the cast are within the cruise interval

Module Contents

r2r_ctd.checks.logger
r2r_ctd.checks.is_deck_test(path: pathlib.Path) bool

Check if the given path “looks like” a deck test

This method matches the pathname against a list of strings that are common to desk tests.

r2r_ctd.checks.check_three_files(ds: xarray.Dataset) bool

Check that each hex file has both an xmlcon and hdr files associated with it.

Stations are, at a minimum, expected to have a .hex, .xmlcon, and .hdr file all next to each other. For example, a 00101.hex should have a 00101.hdr and 00101.xmlcon file also present. In practice, this files need to be found in a case insensitive way, for example, the associated .xmlcon for a rr1608_01.hex file might be named RR1608_01.XMLCON. The underlying odf.sbe library takes care of these details for us.

The input dataset is expected conform output of odf.sbe.read_hex. This dataset is then checked to see if it has all the correct keys.

r2r_ctd.checks.check_lon_lat_valid(ds: xarray.Dataset) bool

Checks if a valid lat/lon can even be extracted from the hex/header

r2r_ctd.checks.check_time_valid(ds: xarray.Dataset) bool

Checks if a valid time can even be extracted from the hex/header

r2r_ctd.checks.check_lon_lat(ds: xarray.Dataset, bbox: BBox | None) bool

Checks that the lon lat of the cast are within the cruise bounding box

r2r_ctd.checks.check_dt(ds: xarray.Dataset, dtrange: Interval | None) bool

Checks that the time of the cast are within the cruise interval