r2r_ctd.accessors¶
Adds an .r2r accessor to the xarray.Dataset objects in use within this software.
Mostly these are wrappers around functions in r2r_ctd.derived
for nice syntax.
Instead of writing:
get_longitude(ds)
I could write:
ds.r2r.longitude
While that example isn’t very short, some of the more involved derived products benefit nicely from this e.g.:
get_or_write_derived_file(ds, "con_report", make_con_report)
Makes the configuration report, with the accessor pattern, this becomes as simple as getting the longitude:
d2.r2r.con_report
All that complexity is hidden from me. Does it need to be that complex? Probably, since that function checks the cache, and if missed, runs a while routing within the companion container to get the results.
Attributes¶
Classes¶
Module Contents¶
- r2r_ctd.accessors.logger¶
- class r2r_ctd.accessors.R2RAccessor(xarray_obj: xarray.Dataset)¶
- _obj¶
- property __geo_interface__¶
- property name¶
Get the “name” of this station, basically the hex file name with the .hex removed
- property latitude: float | None¶
Simple wrapper around
get_latitude()
- property longitude: float | None¶
Simple wrapper around
get_longitude()
- property lon_lat_valid: bool¶
Caching wrapper around
check_lon_lat_valid()
- property time: datetime.datetime | None¶
Simple wrapper around
get_time()
- property time_valid: bool¶
Caching wrapper around
check_time_valid()
- property all_three_files: bool¶
Caching wrapper around
check_three_files()
- time_in(dt_range: r2r_ctd.breakout.Interval) bool ¶
Caching wrapper around
check_dt()
- lon_lat_in(bbox: r2r_ctd.breakout.BBox) bool ¶
Caching wrapper around
check_lon_lat()
- property con_report: str | None¶
Caching wrapper around
make_con_report()
- property con_temp_sn: str | None¶
Finds the first temperature sensor serial number in the xmlcon
- property hdr_temp_sn: str | None¶
Finds the temperature sensor serial number in the hdr file
- property con_cond_sn: str | None¶
Finds the first conductivity sensor serial number in the xmlcon
- property hdr_cond_sn: str | None¶
Finds the conductivity sensor serial number in the hdr file
- property can_make_cnv: bool¶
Test if cnv conversion is likely to succeed
CNV conversion will be skipped if any of the following are true:
missing conreport
missing “all three files”
the hdr temperature serial number is not the same as the first temperature SN in the xmlcon
the hdr conductivity serial number is not the same as the first conductivity SN in the xmlcon
- property cnv_24hz: str | None¶
Caching wrapper around
make_cnvs()
Will generate the
cnv_1db()
as a side effect if not already done.
- property cnv_1db: str | None¶
Caching wrapper around
make_cnvs()
Will generate the
cnv_24hz()
as a side effect if not already done.
- property bottles_fired: bool¶
This cast has bottle trip records in its bl file.
A trip record has 5 components:
sequence (int)
carrousel position (int)
timestamp (time string)
scan start (int)
scan end (int)
This works by checking each line to see if any of the 4 “int” components parse as ints and returning true if any of them can.
The bl file records every attempt to close a bottle and does not necessarily reflect how many bottles actually closed
- write_con_report(breakout: r2r_ctd.breakout.Breakout) None ¶
Actually write the configuration report files to disk.
- write_cnv(breakout: r2r_ctd.breakout.Breakout, cnv: Literal['cnv_24hz', 'cnv_1db']) None ¶
Actually write the derived cnv files to disk.