-1

I calculated NDVI value and saved single band images following this page; https://developers.planet.com/docs/planetschool/calculate-an-ndvi-in-python/. After that I wanted to load those images on python by rasterio or gdal, loading images were succeeded, but unfortunately all the value was Nan. Why all the value is loaded as Nan? And how to fixed this situation?

I googled but could not find solutions. I need your helps, Plz...

Mashiro
  • 1
  • 1
  • fixed by https://stackoverflow.com/questions/14652695/gdal-readasarray-returns-just-nan-values-when-trying-to-read-envi-file – Mashiro Aug 12 '22 at 06:08

1 Answers1

0

You can use masked array as suggested by this answer:

mar = np.ma.masked_array(ar, np.isnan(ar))
print(mar.min(), np.median(mar), mar.mean(), mar.std(), mar.max())

This masked array allows calculations to be taken on the array without taking into account the invalid values.

DialFrost
  • 1,610
  • 1
  • 8
  • 28