diff --git a/datasets/landsat/package/LandsatHlsRaster.cpp b/datasets/landsat/package/LandsatHlsRaster.cpp index eda182e8..31d93f70 100644 --- a/datasets/landsat/package/LandsatHlsRaster.cpp +++ b/datasets/landsat/package/LandsatHlsRaster.cpp @@ -357,7 +357,7 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr assert(ur); /* Get the sample for this point from unique raster */ - for(const point_sample_t& ps : ur->pointSamples) + for(point_sample_t& ps : ur->pointSamples) { if(ps.pointIndex == pointIndx) { @@ -373,12 +373,22 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr const bool returnBandSample = it->second; if(returnBandSample) { - /* Create a copy of the sample and add it to the list */ - RasterSample* sample = new RasterSample(*ps.sample); - - /* Set flags for this sample */ - sample->flags = flags; - slist->add(sample); + RasterSample* s; + if(!ps.sampleReturned) + { + ps.sampleReturned = true; + s = ps.sample; + } + else + { + /* Sample has already been returned, must create a copy */ + s = new RasterSample(*ps.sample); + } + + /* Set flags for this sample, add it to the list */ + s->flags = flags; + slist->add(s); + errors |= ps.ssErrors; } } errors |= ps.ssErrors; diff --git a/scripts/systests/parquet_sampler_landsat_perf_test.lua b/scripts/systests/parquet_sampler_landsat_perf_test.lua index 7d43ff96..805ac4f6 100644 --- a/scripts/systests/parquet_sampler_landsat_perf_test.lua +++ b/scripts/systests/parquet_sampler_landsat_perf_test.lua @@ -1,12 +1,22 @@ local runner = require("test_executive") -console = require("console") -asset = require("asset") -local assets = asset.loaddir() -local td = runner.rootdir(arg[0]) +local console = require("console") +local asset = require("asset") +local csv = require("csv") +local json = require("json") +local _,td = runner.srcscript() -- Setup -- --- console.monitor:config(core.LOG, core.DEBUG) --- sys.setlvl(core.LOG, core.DEBUG) +local assets = asset.loaddir() + +console.monitor:config(core.LOG, core.DEBUG) +sys.setlvl(core.LOG, core.DEBUG) + +local script_parms = {earthdata="https://data.lpdaac.earthdatacloud.nasa.gov/s3credentials", identity="lpdaac-cloud"} +local earthdata_auth_script = core.script("earth_data_auth", json.encode(script_parms)) +while not aws.csget("lpdaac-cloud") do + print("Waiting to authenticate to LPDAAC...") + sys.wait(1) +end local outq_name = "outq-luatest" @@ -29,9 +39,6 @@ local contents = f:read("*all") f:close() --- console.monitor:config(core.LOG, core.DEBUG) --- sys.setlvl(core.LOG, core.DEBUG) - function getFileSize(filePath) local file = io.open(filePath, "rb") -- 'rb' mode opens the file in binary mode if not file then