Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halo housekeeping data processing #99

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/housekeeping/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,22 @@ vars.window_condition = "window_condition"
vars.laser_power_percent = "laser_power"
vars.background_radiance = "background_radiance"
vars.internal_temperature = "internal_temperature"
vars.internal_humidity = "internal_humidity"
vars.internal_humidity = "internal_relative_humidity"
vars.internal_pressure = "internal_pressure"
vars.laser_temperature = "laser_temperature"
vars.window_blower = "window_blower_status"
vars.internal_heater = "internal_heater_status"
vars.window_blower_heater = "window_blower_heater_status"
vars.transmitter_enclosure_temperature = "transmitter_enclosure_temperature"

[format.halo-doppler-lidar_doppy]
vars.internal_temperature = "internal_temperature"
vars.internal_relative_humidity = "internal_relative_humidity"
nikoleskinen marked this conversation as resolved.
Show resolved Hide resolved
vars.supply_voltage = "supply_voltage"
vars.acquisition_card_temperature = "acquisition_card_temperature"
vars.platform_pitch_angle = "platform_pitch_angle"
vars.platform_roll_angle = "platform_roll_angle"

[format.hatpro_hkd]
vars.Alarm = "alarm_status"
vars.T0 = "ambient_target_sensor1_temperature"
Expand Down Expand Up @@ -225,9 +233,9 @@ vars.windows_contaminated_warning.description = "1 = Windows contaminated, 0 = o
[metadata.cl61]
vars.background_radiance = {}
vars.internal_heater_status.description = "on/off (1/0)"
vars.internal_humidity.description = "relative humidity"
vars.internal_humidity.unit = "percent"
vars.internal_pressure.unit = "Pa"
vars.internal_relative_humidity.description = "relative humidity"
vars.internal_relative_humidity.unit = "percent"
vars.internal_temperature.unit = "K"
vars.laser_power.unit = "percent"
vars.laser_temperature.unit = "K"
Expand All @@ -237,6 +245,20 @@ vars.window_blower_status.description = "on/off (1/0)"
vars.window_condition.description = "100 for a clean, 0 for a totally dirty window"
vars.window_condition.unit = "percent"

[metadata.halo-doppler-lidar]
vars.acquisition_card_temperature.description = "Acquisition card temperature"
vars.acquisition_card_temperature.unit = "K"
vars.internal_relative_humidity.description = "Internal relative humidity"
vars.internal_relative_humidity.unit = "percent"
vars.internal_temperature.description = "Internal temperature"
vars.internal_temperature.unit = "K"
vars.platform_pitch_angle.description = "Platform pitch angle"
vars.platform_pitch_angle.unit = "degree"
vars.platform_roll_angle.description = "Platform roll angle"
vars.platform_roll_angle.unit = "degree"
vars.supply_voltage.description = "Supply voltage"
vars.supply_voltage.unit = "V"

[metadata.hatpro]
vars."*_profiler_channel*_status".description = "When a bit is set ‘1’, the corresponding channel is ok, otherwise the channel has a malfunction."
vars."*_profiler_stability_status".description = "‘0’ = unknown, not enough data samples recorded yet, ‘1’ = stability ok, ‘2’ = not sufficiently stable"
Expand Down
16 changes: 16 additions & 0 deletions src/housekeeping/halo_doppler_lidar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import doppy

C_TO_K = 273.15


def read_halo_doppler_lidar(src: bytes) -> dict:
sp = doppy.raw.HaloSysParams.from_src(src)
return {
"time": sp.time.astype("datetime64[s]"),
"internal_temperature": sp.internal_temperature + C_TO_K,
"internal_relative_humidity": sp.internal_relative_humidity,
"supply_voltage": sp.supply_voltage,
"acquisition_card_temperature": sp.acquisition_card_temperature + C_TO_K,
"platform_pitch_angle": sp.platform_pitch_angle,
"platform_roll_angle": sp.platform_roll_angle,
}
16 changes: 16 additions & 0 deletions src/housekeeping/housekeeping.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from .chm15k import read_chm15k
from .exceptions import HousekeepingException, UnsupportedFile
from .halo_doppler_lidar import read_halo_doppler_lidar
from .hatpro import HatproHkd, HatproHkdNc


Expand Down Expand Up @@ -88,6 +89,16 @@ def _handle_cl61_nc(src: bytes, metadata: dict) -> list[Point]:
)


def _handle_halo_doppler_lidar(src: bytes, metadata: dict) -> list[Point]:
measurements = read_halo_doppler_lidar(src)
return _make_points(
measurements["time"],
measurements,
get_config("halo-doppler-lidar_doppy"),
metadata,
)
nikoleskinen marked this conversation as resolved.
Show resolved Hide resolved


def get_reader(metadata: dict) -> Callable[[bytes, dict], list[Point]] | None:
instrument_id = metadata["instrumentId"]
filename = metadata["filename"].lower()
Expand All @@ -109,6 +120,11 @@ def get_reader(metadata: dict) -> Callable[[bytes, dict], list[Point]] | None:
if instrument_id == "cl61d" and filename.endswith(".nc"):
return _handle_cl61_nc

if instrument_id == "halo-doppler-lidar" and filename.startswith(
"system_parameters"
):
return _handle_halo_doppler_lidar

return None


Expand Down
Loading
Loading