Unit Conversion


I use some metrics which make conversions: litre -> cubic_meter, watt_hour -> kilowatt_hour, but sometimes I have this error when I call my metric:
Cannot convert unit kilowatt_hour to unit watt_hour

To fix this problem I tried some actions:

  • Delete the chrome cache
  • Reload tags, on my environment
  • Provision my code again
  • Upsert a new PointMeasurement

Something strange: when my colleague tries to call the same metric (on the same tag) he doesn’t have the error and the metric is ok. He did all the same actions above but that did not change anything.



Those are base metrics, they should be defined and convertible.
You may have to provision again when you see those errors, please check Cannot convert unit mvarh to unit mvar


  • Provision my code again (I already did it)
    That doesn’t fix the problem.


Unit.isConvertable({id: ‘watt_hour’}, {id: ‘kilowatt_hour’}) -> true
Unit.isConvertable({id: ‘kilowatt_hour’}, {id: ‘watt_hour’}) -> false ??

Unit.isConvertable({id: ‘litre’}, {id: ‘cubic_meter’}) -> true
Unit.isConvertable({id: ‘cubic_meter’}, {id: ‘litre’}) -> true

But the original problem persists in both cases.
The server version is v7.6.1



For more precision:

  • First test : I insert a PointMeasurement with 12 m3 (cubic_meter) when I display my metric I get the picture GGAZ_Volume_Measurement

  • Second test : I insert a PointMeasurement with 11996 l (litre) one day ago and I get my error

In the simple metric I add

"unit": {
    "id": "cubic_meter"

To convert all my PointMeasurement in cubic_meter

Unit.isConvertable({id: ‘cubic_meter’}, {id: ‘litre’}) > true

Unit.isConvertable({id: ‘litre’}, {id: ‘cubic_meter’}) > false :face_with_raised_eyebrow:

Yesterday both were true, why does it change now ?

I just don’t understand why my PointMeasurement in litre is not converted in cubic_meter ??



Forcing the normalization after the new PointMeasurement insertion can help:

var job = PointPhysicalMeasurementSeries.refreshNormalization()
c3Grid(RefreshNormalizationBatchJob.fetch({filter: Filter.eq('id', job.id)}))
1 Like