Message Boards Message Boards

GROUPS:

Why is this UnitConvert not converting?

Posted 14 days ago
194 Views
|
5 Replies
|
6 Total Likes
|

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

returns: enter image description here

5 Replies
Posted 14 days ago

I get the same result. Looks like a bug.

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

Posted 14 days ago

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 13 days ago

Rohit:

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

Posted 13 days ago

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

Internal`ClearEntityValueCache["Country"];

but it will fail on subsequent evaluations.

@Luc Barthelet You should report this to WRI.

I filed a bug .[CASE:4563074]

Good luck team!

Thank you Luc

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

Group Abstract Group Abstract