TransWikia.com

Is it possible to round decimal places for float data in Google Earth Engine?

Geographic Information Systems Asked by rachell on July 15, 2021

I am exporting a large amount of NDVI raster data in Google Earth Engine and was wondering if it was possible to round (my NDVI) float values to 2 decimal places as a way to decrease the size of my exported files (and possibly speed up export time).

I know it is also possible to multiple my data by 100 and convert to integer with round() or int(), then divide by 100 later on if I need the exact NDVI values, but I still wanted to see if I could keep my NDVI values as floats with 2 decimal places to avoid that hassle later on. Thanks!

2 Answers

A float in Earth Engine is 32-bit, independent on how many decimal places you happen to use. So this wouldn't decrease the size if you image. Your only option in reducing the size is to turn it into int8, int16, or one of their unsigned variants. int16 is probably the way to go.

Correct answer by Daniel Wiell on July 15, 2021

This is a client-side approach: var number = ((5.478 / 7.4578).toFixed(2));. This is equal to 0.73. The function .toFixed(n) will allow you to return a number of n decimal digits.

Answered by Luis Lizcano on July 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP