Open wildintellect opened 1 year ago
To be clear we can also remove lines 1052 and 1054 that are reclassifying -9999 to NA.
Looking at this more in depth, based on the question from ORNL DAAC.
Is nan
or -9999.0
the desired NA value?
Either way the stats in the file header are wrong (Mean and STDEV).
But we should agree on which value to use for NA before fixing the layer names and the stats (and figuring out what caused the bad stats to start, could be a bug in the WriteRaster).
# Here is what the code SHOULD look like before the writeRaster call
#
# remove some lines
#out_map <- subst(out_map, -9999, NA)
out_sd <- app(out_map_all, sd)
# out_sd <- subst(out_sd, -9999, NA)
out_map <- c(out_map, out_sd)
# To get our ndv recognized
NAflag(out_map) <- -9999
tifoptions <- c("COMPRESS=DEFLATE", "PREDICTOR=2", "ZLEVEL=6", "OVERVIEW_RESAMPLING=AVERAGE")
writeRaster(out_map, filename=out_cog_fn, filetype="COG", gdal=c("COMPRESS=LZW", overwrite=TRUE, gdal=c("COMPRESS=LZW", "OVERVIEW_RESAMPLING=AVERAGE")))
The Boreal Biomass tiles have Nodata set as
nan
but that should have been -9999, this makes the file metadata wrong, both for the Nodata, and the statistics. This was discovered by ORNL DAAC during submission.But this is an error where the
NAflag
was omitted from the writeRaster function in the code. https://github.com/lauraduncanson/icesat2_boreal/blob/b309d216af06d97be41469b1428b2fc984d16c84/lib/mapBoreal_simple.R#L1052-L1060Should be: