baltrad / rave

Radar product generation framework and toolbox. Injector using ODIM_H5 files.
Other
3 stars 3 forks source link

Check conversion of ODIM units #50

Open MilkaRadojevic opened 2 months ago

MilkaRadojevic commented 2 months ago

Hello,

I've noticed that rave converts units for a number of ODIM attributes. The situation is that it seems that such conversion has been put in place a long time ago when certain parameters had different units (for example: elangle is now given in degrees instead of radians; rstart is already in meters instead of km). Therefore I am wondering if a revision of unit conversion should be undertaken in rave.

Thanks, -- Milka

andershenja commented 2 months ago

When we added support for ODIM 2.4 (in rave-build-33) we also added a new way to handle attributes so that we can keep track of what attributes are supported in what ODIM version, including unit conversion.

Currently, the behavior when reading a ODIM H5-file is that we convert it to the latest odim version (currently ODIM 2.4) and use that as the internal representation. I.e. when read wavelength, we convert it to frequency, etc.. Then, when writing, it is currently possible to save the file in 2.2, 2.3 and 2.4.

Since the unit-conversion is a breaking change for the plugins we decided to modify how we handle attributes and are returning them according to the requested version. This is currently 2.3 to avoid the breaking change. The c-api has two different methods, for example PolarScan_getAttribute and PolarScan_getAttributeVersion. This support has not been added to the python code yet so when using python you will always get ODIM 2.3 values. You still can get hold of 2.4 attributes, for example getAttribute("how/frequency") but you will only get 2.3 version for any attribute with different units.

If you experience that you will get an erroneous unit (!= 2.3) back when working with the software, for example in a plugin, this should be reported as a bug.

There are some exceptions to this, for example rstart which still is kept as 2.3 to avoid problems. These will still be saved in the correct unit according to ODIM version.

MilkaRadojevic commented 2 months ago

Thank you Anders for your detailed explanation.

when reading a ODIM H5-file is that we convert it to the latest odim version (currently ODIM 2.4)

Not all OPERA files have ODIM 2.4.

when reading a ODIM H5-file is that we convert it to the latest odim version (currently ODIM 2.4)

OK.

If you experience that you will get an erroneous unit (!= 2.3) back when working with the software, for example in a plugin, this should be reported as a bug.

For now, no bug is found. It is more about how these attributes for different radars are then used within different modules.

There are some exceptions to this, for example rstart which still is kept as 2.3 to avoid problems. These will still be saved in the correct unit according to ODIM version.

According to my verfiications, almost all scans have rstart set to zero.