Skip to content

Commit

Permalink
code review updates for atl24
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Oct 15, 2024
1 parent 1dfd950 commit e4f224b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
2 changes: 2 additions & 0 deletions datasets/bathy/package/BathyCoastnetClassifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ bool BathyCoastnetClassifier::run (GeoDataFrame* dataframe)
const FieldColumn<double>& x_atc = *dynamic_cast<FieldColumn<double>*>(dataframe->getColumnData("x_atc"));
const FieldColumn<float>& geoid_corr_h = *dynamic_cast<FieldColumn<float>*>(dataframe->getColumnData("geoid_corr_h"));
FieldColumn<int8_t>& class_ph = *dynamic_cast<FieldColumn<int8_t>*>(dataframe->getColumnData("class_ph"));
FieldColumn<float>& surface_h = *dynamic_cast<FieldColumn<float>*>(dataframe->getColumnData("surface_h"));
FieldColumn<FieldArray<int8_t, BathyFields::NUM_CLASSIFIERS>>& predictions = *dynamic_cast<FieldColumn<FieldArray<int8_t, BathyFields::NUM_CLASSIFIERS>>*>(dataframe->getColumnData("predictions"));
FieldColumn<uint32_t>& processing_flags = *dynamic_cast<FieldColumn<uint32_t>*>(dataframe->getColumnData("processing_flags"));

Expand Down Expand Up @@ -152,6 +153,7 @@ bool BathyCoastnetClassifier::run (GeoDataFrame* dataframe)
// Update extents
for(size_t i = 0; i < number_of_samples; i++)
{
if(cparms.setSurface) surface_h[i] = results[i].surface_elevation;
if(cparms.setClass) class_ph[i] = results[i].prediction;
predictions[i][BathyFields::COASTNET] = results[i].prediction;
if(results[i].prediction == BathyFields::BATHYMETRY)
Expand Down
17 changes: 11 additions & 6 deletions datasets/bathy/package/BathyDataFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ BathyDataFrame::Atl03Data::Atl03Data (const BathyDataFrame& dataframe, const Reg
lat_ph (dataframe.hdf03, FString("%s/%s", dataframe.beam.value.c_str(), "heights/lat_ph").c_str(), 0, region.first_photon, region.num_photons),
lon_ph (dataframe.hdf03, FString("%s/%s", dataframe.beam.value.c_str(), "heights/lon_ph").c_str(), 0, region.first_photon, region.num_photons),
delta_time (dataframe.hdf03, FString("%s/%s", dataframe.beam.value.c_str(), "heights/delta_time").c_str(), 0, region.first_photon, region.num_photons),
bckgrd_delta_time (dataframe.hdf03, FString("%s/%s", dataframe.beam.value.c_str(), "bckgrd_atlas/delta_time").c_str()),
bckgrd_rate (dataframe.hdf03, FString("%s/%s", dataframe.beam.value.c_str(), "bckgrd_atlas/bckgrd_rate").c_str())
bckgrd_delta_time (dataframe.parms.findSeaSurface ? dataframe.hdf03 : NULL, FString("%s/%s", dataframe.beam.value.c_str(), "bckgrd_atlas/delta_time").c_str()),
bckgrd_rate (dataframe.parms.findSeaSurface ? dataframe.hdf03 : NULL, FString("%s/%s", dataframe.beam.value.c_str(), "bckgrd_atlas/bckgrd_rate").c_str())
{
sc_orient.join(dataframe.readTimeoutMs, true);
velocity_sc.join(dataframe.readTimeoutMs, true);
Expand All @@ -468,8 +468,8 @@ BathyDataFrame::Atl03Data::Atl03Data (const BathyDataFrame& dataframe, const Reg
lat_ph.join(dataframe.readTimeoutMs, true);
lon_ph.join(dataframe.readTimeoutMs, true);
delta_time.join(dataframe.readTimeoutMs, true);
bckgrd_delta_time.join(dataframe.readTimeoutMs, true);
bckgrd_rate.join(dataframe.readTimeoutMs, true);
if(dataframe.parms.findSeaSurface) bckgrd_delta_time.join(dataframe.readTimeoutMs, true);
if(dataframe.parms.findSeaSurface) bckgrd_rate.join(dataframe.readTimeoutMs, true);
}

/*----------------------------------------------------------------------------
Expand Down Expand Up @@ -658,6 +658,11 @@ void* BathyDataFrame::subsettingThread (void* parm)
}
}

/* Set Initial Processing Flags */
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;

/* Add Photon to DataFrame */
dataframe.addRow(); // start new row in dataframe
dataframe.time_ns.append(Icesat2Fields::deltatime2timestamp(current_delta_time));
Expand All @@ -669,15 +674,15 @@ void* BathyDataFrame::subsettingThread (void* parm)
dataframe.y_ph.append(coord.y);
dataframe.x_atc.append(atl03.segment_dist_x[current_segment] + atl03.dist_ph_along[current_photon]);
dataframe.y_atc.append(atl03.dist_ph_across[current_photon]);
dataframe.background_rate.append(calculateBackground(current_segment, bckgrd_index, atl03));
dataframe.ellipse_h.append(atl03.h_ph[current_photon]); // later corrected by refraction correction
dataframe.ortho_h.append(atl03.h_ph[current_photon] - atl03.geoid[current_segment]); // later corrected by refraction correction
dataframe.yapc_score.append(yapc_score);
dataframe.max_signal_conf.append(atl03_cnf);
dataframe.quality_ph.append(quality_ph);
dataframe.processing_flags.append(on_boundary ? BathyFields::ON_BOUNDARY : BathyFields::FLAGS_CLEAR);
dataframe.processing_flags.append(processing_flags);

/* Add Additional Photon Data to DataFrame */
dataframe.background_rate.append(parms.findSeaSurface ? calculateBackground(current_segment, bckgrd_index, atl03) : 0.0);
dataframe.geoid_corr_h.append(atl03.h_ph[current_photon] - atl03.geoid[current_segment]);
dataframe.wind_v.append(wind_v);
dataframe.ref_el.append(atl03.ref_elev[current_segment]);
Expand Down
8 changes: 8 additions & 0 deletions datasets/bathy/package/BathyFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
#include "OsApi.h"
#include "BathyFields.h"

/******************************************************************************
* STATIC DATA
******************************************************************************/

const double BathyFields::NIGHT_SOLAR_ELEVATION_THRESHOLD = 5.0; // degrees
const double BathyFields::MINIMUM_HORIZONTAL_SUBAQUEOUS_UNCERTAINTY = 0.0;
const double BathyFields::MINIMUM_VERTICAL_SUBAQUEOUS_UNCERTAINTY = 10.0;

/******************************************************************************
* METHODS
******************************************************************************/
Expand Down
9 changes: 8 additions & 1 deletion datasets/bathy/package/BathyFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ struct CoastnetFields: public FieldDictionary
{
FieldElement<string> model {COASTNET_MODEL};
FieldElement<bool> setClass {true};
FieldElement<bool> setSurface {true};
FieldElement<bool> usePredictions {false};
FieldElement<bool> verbose {true};

CoastnetFields(void):
FieldDictionary({ {"model", &model},
{"set_class", &setClass},
{"set_surface", &setSurface},
{"use_predictions", &usePredictions},
{"verbose", &verbose} }) {
};
Expand Down Expand Up @@ -199,7 +201,7 @@ struct QtreesFields: public FieldDictionary
{
FieldElement<string> model {QTREES_MODEL};
FieldElement<bool> setClass {false};
FieldElement<bool> setSurface {true};
FieldElement<bool> setSurface {false};
FieldElement<bool> verbose {true};

QtreesFields(void):
Expand Down Expand Up @@ -233,6 +235,10 @@ class BathyFields: public Icesat2Fields
inline static const char* OPENOCEANS_NAME = "openoceans";
inline static const char* ENSEMBLE_NAME = "ensemble";

static const double NIGHT_SOLAR_ELEVATION_THRESHOLD;
static const double MINIMUM_HORIZONTAL_SUBAQUEOUS_UNCERTAINTY;
static const double MINIMUM_VERTICAL_SUBAQUEOUS_UNCERTAINTY;

/*--------------------------------------------------------------------
* Typedefs
*--------------------------------------------------------------------*/
Expand Down Expand Up @@ -267,6 +273,7 @@ class BathyFields: public Icesat2Fields
SENSOR_DEPTH_EXCEEDED = 0x02,
SEA_SURFACE_UNDETECTED = 0x04,
INVALID_KD = 0x08,
NIGHT_FLAG = 0x10,
BATHY_QTREES = 0x01000000,
BATHY_COASTNET = 0x02000000,
BATHY_OPENOCEANSPP = 0x04000000,
Expand Down
8 changes: 4 additions & 4 deletions datasets/bathy/package/BathyUncertaintyCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ bool BathyUncertaintyCalculator::run (GeoDataFrame* dataframe)
df.processing_flags[i] = df.processing_flags[i] | processing_flags;

/* calculate subaqueous uncertainty */
double subaqueous_horizontal_uncertainty = 0.0;
double subaqueous_vertical_uncertainty = 0.0;
double subaqueous_horizontal_uncertainty = BathyFields::MINIMUM_HORIZONTAL_SUBAQUEOUS_UNCERTAINTY;
double subaqueous_vertical_uncertainty = BathyFields::MINIMUM_VERTICAL_SUBAQUEOUS_UNCERTAINTY;
const double depth = df.surface_h[i] - df.ortho_h[i];
if(depth > 0.0)
{
Expand All @@ -307,8 +307,8 @@ bool BathyUncertaintyCalculator::run (GeoDataFrame* dataframe)
const uncertainty_coeff_t vertical_coeff = UNCERTAINTY_COEFF_MAP[TVU][pointing_angle_index][wind_speed_index][kd_range_index];

/* subaqueous uncertainties */
subaqueous_horizontal_uncertainty = (horizontal_coeff.b * depth) + horizontal_coeff.c;
subaqueous_vertical_uncertainty = (vertical_coeff.b * depth) + vertical_coeff.c;
subaqueous_horizontal_uncertainty += (horizontal_coeff.b * depth) + horizontal_coeff.c;
subaqueous_vertical_uncertainty += (vertical_coeff.b * depth) + vertical_coeff.c;

/* set maximum sensor depth processing flag */
if(depth > max_sensor_depth)
Expand Down
2 changes: 2 additions & 0 deletions docs/rtd/source/release_notes/release-v4-7-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Version description of the v4.7.1 release of SlideRule Earth.

Bathy Version #4.

## ATL24 Changes

* Fixed default for parameter `thresh` in C-Shelph.
Expand Down
6 changes: 6 additions & 0 deletions docs/rtd/source/release_notes/release-v4-7-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Version description of the v4.7.2 release of SlideRule Earth.

Bathy Version #5.

## ATL24 Changes

* Fixed issue with ortho_h where it was being set to zero when the surface_h was less than or equal to zero.
Expand All @@ -27,6 +29,10 @@ Version description of the v4.7.2 release of SlideRule Earth.
- `surface_flag` changed to `surface_filter` and instead of having to know what the flag values were; the user now just needs to set to True to filter out anything that isn't a surface footprint.
- `beam` changed to `beams` to reflect that it is primarily a list of beams to process and not just a single beam (even though if the user only provides a single beam, the server side code will automatically promote it to a list of beams with only one element).

* Subsetting requests that use a rasterized geojson to perform the subsetting have been changed so that the geojson string is passed via a parameter named `region_mask` instead of `raster`. The original name was confusing with our increasing support for raster sampling. THe new name makes it clearer that the parameter is used as a mask for the region of interest.

* The `proj` field has changed to `projection` for clarity.

## Development Updates

## Getting This Release
Expand Down

0 comments on commit e4f224b

Please sign in to comment.