ACTRIS-CCRES / raw2l1

GNU General Public License v3.0
1 stars 0 forks source link

[CL61] add reader compatibility with firmware 1.2.x #33

Open madrouin opened 1 year ago

madrouin commented 1 year ago

A new firmware 1.2.7 has been released for vaisala cl61. The netCDF format changed.

New version of the manual: CL61_Software_Release_Notesv1.2-_DOC250195-C.pdf

example for 1.2.7 netcdf: U5140726_20230301_145306.nc

madrouin commented 1 year ago

In GitLab by @zeeman on Jun 28, 2023, 17:54

There are a large number of changes in the CL61 1.2 firmware and its NetCDF4 structure, which, I see now, requires separate branches to study.

For the time being, we have stuck with a v3.14/v3.15b in production, with a quick fix for CL61-1.2.x:

diff vaisala_cl61.py
236c236,239
<     data["time_resol"] = nc_id.getncattr("time between consecutive profiles in seconds")
---
>     if data["float_fw_version"] >= 1.2:
>         data["time_resol"] = nc_id.getncattr("profile_interval_in_seconds")
>     else:
>         data["time_resol"] = nc_id.getncattr("time between consecutive profiles in seconds")
240,241c243,248
<     data["instrument_id"] = nc_id.title.split(",")[0]
<     data["software_id"] = nc_id.history
---
>     if data["float_fw_version"] >= 1.2:   
>         data["instrument_id"] = nc_id.getncattr("instrument_serial_number")
>         data["software_id"] = nc_id.getncattr("sw_version")
>     else:
>         data["instrument_id"] = nc_id.title.split(",")[0]
>         data["software_id"] = nc_id.history
318,320c325,333
<     # only available for firmware >= 1.1
<     if data["float_fw_version"] >= 1.1:
<         logger.debug("reading house keeping data")
---
>     # only available for firmware >= 1.2
>     if data["float_fw_version"] >= 1.2:
>         data["rh_int"][ind_b:ind_e] = nc_id["monitoring"].variables["internal_humidity"][0]
>         data["temp_int"][ind_b:ind_e] = nc_id["monitoring"].variables["internal_temperature"][0]
>         data["pres_int"][ind_b:ind_e] = nc_id["monitoring"].variables["internal_pressure"][0]
>         data["laser_temp"][ind_b:ind_e] = nc_id["monitoring"].variables["laser_temperature"][0]
>         data["laser_energy"][ind_b:ind_e] = nc_id["monitoring"].variables["laser_power_percent"][0]
>         data["window_transmission"][ind_b:ind_e] = nc_id["monitoring"].variables["window_condition"][0]     
>     elif data["float_fw_version"] >= 1.1:
326c339
<         data["window_transmission"][ind_b:ind_e] = nc_id["monitoring"].window_condition
---
>         data["window_transmission"][ind_b:ind_e] = nc_id["monitoring"].window_condition 

This does not expose any of the new CL61-1.2.x features, but seems to work as a step-in replacement. The CL61-1.2.x firmware files are effectively converted with the structure of the CL61-1.1.x firmware. It seems to work. Not at all ideal, but if full investigation of #33 continues in development branches, such a quick fix could relief the pressure for some users?

Just a thought.

madrouin commented 1 year ago

Hi,

I can merge the new CL61 reader on the develop branch. I based the code on what @alexander.geiss first developed for the new firmware.

It could be nice if you could test it and give us some feedbacks to see if you see something missing.