0

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

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.

0
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.