From 1a31301916cb2f04851b470e3a19c9bb50033e4c Mon Sep 17 00:00:00 2001 From: JP Swinski Date: Tue, 12 Nov 2024 15:08:16 +0000 Subject: [PATCH] added geoid filter --- datasets/bathy/endpoints/atl24g.lua | 4 +++- datasets/bathy/package/BathyDataFrame.cpp | 7 +++++++ datasets/bathy/package/BathyFields.cpp | 2 ++ datasets/bathy/package/BathyFields.h | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/datasets/bathy/endpoints/atl24g.lua b/datasets/bathy/endpoints/atl24g.lua index e7874e4e..029cc048 100644 --- a/datasets/bathy/endpoints/atl24g.lua +++ b/datasets/bathy/endpoints/atl24g.lua @@ -363,10 +363,12 @@ arrow.send2user(crenv.host_sandbox_directory.."/"..tmp_filename, parms, rspq) -- send ISO XML file to user ------------------------------------------------------- if parms["output"]["format"] == "h5" then + local xml_filename = rqst["parms"]["output"]["path"] + xml_filename = xml_filename:sub(0, xml_filename:find(".h5")).."iso.xml" local xml_parms = core.parms({ output = { asset=rqst["parms"]["output"]["asset"], -- use original request asset - path=rqst["parms"]["output"]["path"]..".iso.xml" -- modify the original requested path + path=xml_filename -- modify the original requested path } }) arrow.send2user(crenv.host_sandbox_directory.."/"..tmp_filename..".iso.xml", xml_parms, rspq) diff --git a/datasets/bathy/package/BathyDataFrame.cpp b/datasets/bathy/package/BathyDataFrame.cpp index 680313a8..f8b3d71d 100644 --- a/datasets/bathy/package/BathyDataFrame.cpp +++ b/datasets/bathy/package/BathyDataFrame.cpp @@ -636,6 +636,13 @@ void* BathyDataFrame::subsettingThread (void* parm) break; } + /* Calculate Geoid Corrected Height and Check Delta */ + const float geoid_corr_h = atl03.h_ph[current_photon] - atl03.geoid[current_segment]; + if(geoid_corr_h > parms.maxGeoidDelta.value || geoid_corr_h < parms.minGeoidDelta.value) + { + break; + } + /* Calculate UTM Coordinates */ const double latitude = atl03.lat_ph[current_photon]; const double longitude = atl03.lon_ph[current_photon]; diff --git a/datasets/bathy/package/BathyFields.cpp b/datasets/bathy/package/BathyFields.cpp index 6ec6f6d3..e3235355 100644 --- a/datasets/bathy/package/BathyFields.cpp +++ b/datasets/bathy/package/BathyFields.cpp @@ -112,6 +112,8 @@ BathyFields::BathyFields(lua_State* L, uint64_t key_space, const char* default_a { {"asset09", &atl09AssetName}, {"max_dem_delta", &maxDemDelta}, {"min_dem_delta", &minDemDelta}, + {"max_geoid_delta", &maxGeoidDelta}, + {"min_geoid_delta", &minGeoidDelta}, {"ph_in_extent", &phInExtent}, {"generate_ndwi", &generateNdwi}, {"use_bathy_mask", &useBathyMask}, diff --git a/datasets/bathy/package/BathyFields.h b/datasets/bathy/package/BathyFields.h index 2e9a32ae..2df6c6b1 100644 --- a/datasets/bathy/package/BathyFields.h +++ b/datasets/bathy/package/BathyFields.h @@ -258,6 +258,8 @@ class BathyFields: public Icesat2Fields FieldElement atl09AssetName {"icesat2"}; // name of the asset in the asset directory for the ATL09 granules FieldElement maxDemDelta {50.0}; // initial filter of heights against DEM (For removing things like clouds) FieldElement minDemDelta {-100.0}; // initial filter of heights against DEM (For removing things like clouds) + FieldElement maxGeoidDelta {50.0}; // initial filter of heights against geoid (For removing things like clouds) + FieldElement minGeoidDelta {-100.0}; // initial filter of heights against geoid (For removing things like clouds) FieldElement phInExtent {8192}; // number of photons in each extent FieldElement generateNdwi {false}; // use HLS data to generate NDWI for each segment lat,lon FieldElement useBathyMask {true}; // global bathymetry mask downloaded in atl24 init lua routine