Geographic Information Systems Asked on April 2, 2021
There are too methods in gee to cast an image to float : toFloat()
and float()
.
They have the same documentation which is the following :
Casts the input value to a 32-bit float.
Is there any difference between the 2 functions?
This question can be extended to all casting method that usually exist in 2 versions (int()
, toInt()
…etc)
toFloat()
and float()
are exactly the same, and this is true for all the other band type cast operators like int()
and toInt()
. You can use either ones, but if you're looking for a recommendation, I'd say to always use the ones with to
, to be a little more specific about what they're doing.
(It happens that the versions without to
prefixes came first and the prefixed ones were added later, but the precise rationale for adding the second set of names has been forgotten. Of course, it'd be simpler to have only one set now, but since both are in use, removing either would break some scripts without much benefit.)
Correct answer by Kevin Reid on April 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP