Skip to content

Commit

Permalink
added ensemble model to atl24 init; added retries to atl09 cmr query
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Sep 4, 2024
1 parent 32a200b commit ce0851a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
23 changes: 16 additions & 7 deletions datasets/bathy/endpoints/atl24g.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,22 @@ parms["asset"] = "icesat2-atl09"
parms["t0"] = t0
parms["t1"] = t1
parms["name_filter"] = '*_'..rgt..'????_*'
local rc2, rsps2 = earthdata.search(parms)
if rc2 == earthdata.SUCCESS and #rsps2 == 1 then
parms["resource09"] = rsps2[1]
else
userlog:alert(core.CRITICAL, core.RTE_ERROR, string.format("request <%s> failed to make ATL09 CMR request <%d>: %s", rspq, rc2, rsps2))
cleanup(crenv, transaction_id)
return
local atl09_max_retries = 3
local atl09_attempt = 1
while true do
local rc2, rsps2 = earthdata.search(parms)
if rc2 == earthdata.SUCCESS and #rsps2 == 1 then
parms["resource09"] = rsps2[1]
break -- success
else
userlog:alert(core.CRITICAL, core.RTE_ERROR, string.format("request <%s> failed attempt %d to make ATL09 CMR request <%d>: %s", rspq, atl09_attempt, rc2, rsps2))
atl09_attempt = atl09_attempt + 1
if atl09_attempt == atl09_max_retries then
userlog:alert(core.CRITICAL, core.RTE_ERROR, string.format("request <%s> failed to make ATL09 CMR request... aborting!", rspq))
cleanup(crenv, transaction_id)
return -- failure
end
end
end
parms["asset"] = original_asset
parms["t0"] = original_t0
Expand Down
17 changes: 13 additions & 4 deletions datasets/bathy/extensions/atl24_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ local uncertainty_lut_complete = true -- logic below needs it to be seeded to tr
local pointnet_model_complete = false
local qtrees_model_complete = false
local coastnet_model_complete = false
local ensemble_model_complete = false

while sys.alive() and ( (not bathy_mask_complete) or
(not water_ri_mask_complete) or
(not uncertainty_lut_complete) or
(not pointnet_model_complete) or
(not qtrees_model_complete) or
(not coastnet_model_complete)) do
(not coastnet_model_complete)
(not ensemble_model_complete)) do

sys.log(core.INFO, "Initializing ATL24 processing environment...")

Expand Down Expand Up @@ -47,29 +49,36 @@ while sys.alive() and ( (not bathy_mask_complete) or
pointnet_model_complete = sys.fileexists(pointnet_model_local) or aws.s3download("sliderule", pointnet_model_remote, aws.DEFAULT_REGION, aws.DEFAULT_IDENTITY, pointnet_model_local)

-- qtrees model
local qtrees_model_local = cre.HOST_DIRECTORY.."/model-20240607.json"
local qtrees_model_remote = "config/model-20240607.json"
local qtrees_model_local = cre.HOST_DIRECTORY.."/qtrees_model-20240607.json"
local qtrees_model_remote = "config/qtrees_model-20240607.json"
qtrees_model_complete = sys.fileexists(qtrees_model_local) or aws.s3download("sliderule", qtrees_model_remote, aws.DEFAULT_REGION, aws.DEFAULT_IDENTITY, qtrees_model_local)

-- coastnet model
local coastnet_model_local = cre.HOST_DIRECTORY.."/coastnet_model-20240628.json"
local coastnet_model_remote = "config/coastnet_model-20240628.json"
coastnet_model_complete = sys.fileexists(coastnet_model_local) or aws.s3download("sliderule", coastnet_model_remote, aws.DEFAULT_REGION, aws.DEFAULT_IDENTITY, coastnet_model_local)

-- ensemble model
local ensemble_model_local = cre.HOST_DIRECTORY.."/track_stacker_model.json"
local ensemble_model_remote = "config/track_stacker_model.json"
ensemble_model_complete = sys.fileexists(ensemble_model_local) or aws.s3download("sliderule", ensemble_model_remote, aws.DEFAULT_REGION, aws.DEFAULT_IDENTITY, ensemble_model_local)

-- check for completeness
if (not bathy_mask_complete) or
(not water_ri_mask_complete) or
(not uncertainty_lut_complete) or
(not pointnet_model_complete) or
(not qtrees_model_complete) or
(not coastnet_model_complete) then
(not coastnet_model_complete) or
(not ensemble_model_complete) then
sys.log(core.CRITICAL, string.format("Failed to initialize ATL24 processing environment"))
if not bathy_mask_complete then sys.log(core.CRITICAL, "bathy mask did not download") end
if not water_ri_mask_complete then sys.log(core.CRITICAL, "water refractive index mask did not download") end
if not uncertainty_lut_complete then sys.log(core.CRITICAL, "uncertainty look up tables did not download") end
if not pointnet_model_complete then sys.log(core.CRITICAL, "pointnet model did not download") end
if not qtrees_model_complete then sys.log(core.CRITICAL, "qtrees model did not download") end
if not coastnet_model_complete then sys.log(core.CRITICAL, "coastnet model did not download") end
if not ensemble_model_complete then sys.log(core.CRITICAL, "ensemble model did not download") end
sys.wait(30)
end

Expand Down

0 comments on commit ce0851a

Please sign in to comment.