r2r_ctd.derived =============== .. py:module:: r2r_ctd.derived .. autoapi-nested-parse:: Functions that take some existing data, and either extract from or transform it e.g. the :py:func:`get_longitude` function tries to extract the longitude information from the hdr file Attributes ---------- .. autoapisummary:: r2r_ctd.derived.logger Functions --------- .. autoapisummary:: r2r_ctd.derived._parse_coord r2r_ctd.derived.get_longitude r2r_ctd.derived.get_latitude r2r_ctd.derived._normalize_date_strings r2r_ctd.derived.get_time r2r_ctd.derived.make_con_report r2r_ctd.derived.get_model r2r_ctd.derived._con_report_extract_sensors r2r_ctd.derived.get_con_report_sn r2r_ctd.derived.get_hdr_sn r2r_ctd.derived.make_derive_psa r2r_ctd.derived.make_binavg_psa r2r_ctd.derived.make_datcnv_psa r2r_ctd.derived.make_cnvs Module Contents --------------- .. py:data:: logger .. py:function:: _parse_coord(coord: str) -> float | None Parses a spaced separated DDM coordinate with hemisphere to decimal degrees >>> _parse_coord("32 52.02 N") 32.867 >>> _parse_coord("117 15.435 W") -117.25725 .. py:function:: get_longitude(ds: xarray.Dataset) -> float | None Get the cast longitude from NMEA header .. admonition:: WHOI Divergence :class: warning The original code from WHOI tries to also get this from the ``** Longitude`` line but I think the ``**`` means it is a comment and can be *anything* the user puts in. .. py:function:: get_latitude(ds: xarray.Dataset) -> float | None Get the cast latitude from NMEA header .. admonition:: WHOI Divergence :class: warning The original code from WHOI tries to also get this from the ``** Latitude`` line but I think the ``**`` means it is a comment and can be *anything* the user puts in. .. py:function:: _normalize_date_strings(date: str) -> str Try to make the date strings in sbe hdr files have a consistent format There can be variable whitespace between time elements, this function tries to remove them so we can use the normal strptime method. >>> _normalize_date_strings("Oct 09 2019 17:05:53") 'Oct 09 2019 17:05:53' .. py:function:: get_time(ds: xarray.Dataset) -> datetime.datetime | None Gets the time from the hdr file In the following priority order: * NMEA UTC (Time) * System UTC * System Upload Time .. py:function:: make_con_report(ds: xarray.Dataset) Runs ConReport.exe on the xmlcon file in the dataset .. py:function:: get_model(con_report: str) -> str | None Given a configuration report, get the SBE model string Uses string matching and doesn't parse/transform the model lines in the config report. .. py:function:: _con_report_extract_sensors(con_report: str) -> list[str] Extract a list of sensors from a configuration report, adds some virtual sensors if NMEA information was added to the data This is looking for lines in the form of:: 1) channel type, sensor name eg:: 1) Frequency 0, Temperature Then extracting the "sensor name" part of that line. If "NMEA position data added" is "yes", virtual latitude and longitude sensors are added to the list. If "NMEA time added" is "yes", a virtual "ETime" sensor is added to the list. If the model of the instrument is an SBE911, a "pump" sensor is added to the list. .. py:function:: get_con_report_sn(con_report: str, instrument: str) -> set[str] Get the serial numbers for instruments from the configuration report (XMLCON). .. py:function:: get_hdr_sn(hdr: str, instrument: str) -> str | None Get an instruments serial number from the .hdr file. That this serial number intersects with the set generated by :py:func:`get_con_report_sn` is reported in the QA. .. py:function:: make_derive_psa(con_report: str) -> bytes Makes the derive psa config file for derive.exe based on the configuration report, will add second density calculation if dual channel .. py:function:: make_binavg_psa(con_report: str) -> bytes Get the binage psa config from :py:func:`r2r_ctd.sbe.binavg_template` and return it unmodified. .. py:function:: make_datcnv_psa(con_report: str) -> bytes Make the datcnv psa config based on the configuration report, populating the CalcArray element .. py:function:: make_cnvs(ds: xarray.Dataset) -> dict[str, xarray.Dataset] Makes the derived cnv files Creates all the various configuration files, then passes everything off to the companion container to actually be processed.