Skip to content

Commit

Permalink
added support for running without ATL09 when CMR fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Oct 15, 2024
1 parent e4f224b commit 4f47fc8
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 220 deletions.
422 changes: 211 additions & 211 deletions datasets/bathy/docker/oceaneyes/runner.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions datasets/bathy/endpoints/atl24g.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ while true do
break -- success
else
userlog:alert(core.CRITICAL, core.RTE_ERROR, string.format("request <%s> returned an invalid number of resources for ATL09 CMR request for %s: %d", rspq, resource, #rsps2))
return -- failure
break -- failure
end
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 for %s... aborting!", rspq, resource))
return -- failure
break -- failure
end
end
end
Expand Down Expand Up @@ -270,7 +270,7 @@ end
-- clean up objects to cut down on memory usage
-------------------------------------------------------
atl03h5:destroy()
atl09h5:destroy()
if atl09h5 then atl09h5:destroy() end
kd490:destroy()

-------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions datasets/bathy/package/BathyDataFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int BathyDataFrame::luaCreate (lua_State* L)
_parms = dynamic_cast<BathyFields*>(getLuaObject(L, 2, BathyFields::OBJECT_TYPE));
_mask = dynamic_cast<BathyMask*>(getLuaObject(L, 3, GeoLib::TIFFImage::OBJECT_TYPE, true, NULL));
_hdf03 = dynamic_cast<H5Object*>(getLuaObject(L, 4, H5Object::OBJECT_TYPE));
_hdf09 = dynamic_cast<H5Object*>(getLuaObject(L, 5, H5Object::OBJECT_TYPE));
_hdf09 = dynamic_cast<H5Object*>(getLuaObject(L, 5, H5Object::OBJECT_TYPE, true, NULL));
const char* rqstq_name = getLuaString(L, 6, true, NULL);

/* Check for Null Resource and Asset */
Expand Down Expand Up @@ -198,7 +198,7 @@ BathyDataFrame::~BathyDataFrame (void)
delete rqstQ;

hdf03->releaseLuaObject();
hdf09->releaseLuaObject();
if(hdf09) hdf09->releaseLuaObject();

parmsPtr->releaseLuaObject();
bathyMask->releaseLuaObject();
Expand Down Expand Up @@ -483,14 +483,15 @@ BathyDataFrame::Atl09Class::Atl09Class (const BathyDataFrame& dataframe):
{
try
{
if(!dataframe.hdf09) throw RunTimeException(CRITICAL, RTE_ERROR, "invalid HDF5 ATL09 object");
met_u10m.join(dataframe.readTimeoutMs, true);
met_v10m.join(dataframe.readTimeoutMs, true);
delta_time.join(dataframe.readTimeoutMs, true);
valid = true;
}
catch(const RunTimeException& e)
{
mlog(CRITICAL, "ATL09 data unavailable for <%s>", dataframe.parms.resource.value.c_str());
mlog(CRITICAL, "ATL09 data unavailable for <%s>: %s", dataframe.parms.resource.value.c_str(), e.what());
}
}

Expand Down Expand Up @@ -662,6 +663,7 @@ void* BathyDataFrame::subsettingThread (void* parm)
uint32_t processing_flags = BathyFields::FLAGS_CLEAR;
if(on_boundary) processing_flags |= BathyFields::ON_BOUNDARY;
if(atl03.solar_elevation[current_segment] < BathyFields::NIGHT_SOLAR_ELEVATION_THRESHOLD) processing_flags |= BathyFields::NIGHT_FLAG;
if(!atl09.valid) processing_flags |= BathyFields::INVALID_WIND_SPEED;

/* Add Photon to DataFrame */
dataframe.addRow(); // start new row in dataframe
Expand Down
3 changes: 2 additions & 1 deletion datasets/bathy/package/BathyFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class BathyFields: public Icesat2Fields
SENSOR_DEPTH_EXCEEDED = 0x02,
SEA_SURFACE_UNDETECTED = 0x04,
INVALID_KD = 0x08,
NIGHT_FLAG = 0x10,
INVALID_WIND_SPEED = 0x10,
NIGHT_FLAG = 0x20,
BATHY_QTREES = 0x01000000,
BATHY_COASTNET = 0x02000000,
BATHY_OPENOCEANSPP = 0x04000000,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/AssetField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const char* AssetField::getName (void) const
*----------------------------------------------------------------------------*/
string AssetField::toJson (void) const
{
return getName();
return FString("\"%s\"", getName()).c_str();
}

/*----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion scripts/extensions/earth_data_query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ local function cmr (parms, poly, with_meta)
end
-- add url to table of links with metadata
if not link_table[url] then
link_table[url] = metadata
link_table[url] = metadata
num_links = num_links + 1
total_links = total_links + 1
end
Expand Down

0 comments on commit 4f47fc8

Please sign in to comment.