Message Boards Message Boards


Why is this UnitConvert not converting?

Posted 1 year ago
5 Replies
6 Total Likes

EntityValue[Entity["Country", "UnitedStates"], EntityProperty["Country", "FreshwaterWithdrawals"]]

returns: enter image description here

5 Replies

I filed a bug .[CASE:4563074]

Good luck team!

Thank you Luc

Hi Mike,

I tried the code I posted on 12.1.1 and now it fails. I tried 12.0 and 12.1 and sometimes the first evaluation works but subsequent evaluations fail. Seems like a caching bug in the entity framework. To get it to reliably work on the first evaluation


but it will fail on subsequent evaluations.

@Luc Barthelet You should report this to WRI.

Posted 1 year ago


That is good news. But why would an entity return an invalid unevaluated UnitConvert?

The second argument to UnitConvert has to be just a unit specification. This works

w = EntityValue[Entity["Country", "UnitedStates"], EntityProperty["Country", "FreshwaterWithdrawals"]];

UnitConvert[w, "Giga" "Feet"^3/"Years"]
Posted 1 year ago

I get the same result. Looks like a bug.

Very interested in hearing the resolution. Thank you for bringing this up.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract