Skip to content

Commit

Permalink
fixed bug in batch landsat code
Browse files Browse the repository at this point in the history
  • Loading branch information
elidwa committed Oct 16, 2024
1 parent 02d2349 commit f27dc6e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
24 changes: 17 additions & 7 deletions datasets/landsat/package/LandsatHlsRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down
25 changes: 16 additions & 9 deletions scripts/systests/parquet_sampler_landsat_perf_test.lua
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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
Expand Down

0 comments on commit f27dc6e

Please sign in to comment.