Closed ejguenther closed 5 months ago
@ejguenther Can you send me the full set of parameters you are using for your request, along with the polygon you are processing (or the granule name, if that is what you are using)?
I am not able to recreate this issue with the tests that I have, so I want to use what you are using to recreate the problem.
Here are the parameters I am using:
parms = {
"poly": poly_out,
"t0": '2021-01-01T00:00:00Z',
"t1": '2021-03-01T00:00:00Z',
"srt": icesat2.SRT_LAND,
"len": 30,
"res": 30,
"pass_invalid": True,
"atl08_class": ["atl08_ground", "atl08_canopy", "atl08_top_of_canopy"],
"atl08_fields": ["canopy/h_canopy_uncertainty","h_dif_ref","msw_flag","sigma_topo","segment_landcover","canopy/segment_cover","segment_snowcover","terrain/h_te_uncertainty"], #'segment_cover' and 'h_canopy_uncertainty' need to be added
#"atl08_fields": ["h_dif_ref","msw_flag","sigma_topo","segment_landcover"],
"phoreal": {"binsize": 1.0, "geoloc": "center", "above_classifier": False, "use_abs_h": False, "send_waveform": True}
}
Where poly_out
is this KML which can be downloaded here: https://utexas.box.com/s/k7nxfgbt0envla82elcg0dv2bw2y7pqs
@ejguenther I think I found the bug (at least I definitely found a bug, hopefully it is this bug) - see the commit above 14a8ffb for the exact change.
When I calculated the index into the land_segments group variables for each photon (which I need in order to grab the correct ancillary data value), I wasn't accounting for the case where there was a gap at the end of the set of segments. (i.e. the fact that not all ATL03 segments are present in the ATL08 data; sometimes a segment is not used).
When that happened, my ATL08 segment index was set to one element past the end of the array. The code that later pulls the ancillary data out and associates it with each photon does an array bounds check, and because the index is out of bounds, it never reads or writes any value - leaving the value in the ancillary fields array to be left uninitialized.
We are then seeing those uninitialized values (somewhat random in that it is whatever was left over before in that memory space) in our data.
Tested this on a few queries on my end and there does not appear to be any more out of range values, in addition the fields such as segment_landcover
and landcover
and segment_snowcover
and snowcover
are now in agreement. I'd consider this issue resolved.
In the ATL08 PhoREAL Sliderule functionality, it appears that certain flag interpolations are incorrect. When the function
icesat2.atl08p(parms, keep_id=True)
is called in the Sliderule-Python Client, when usingatl08_fields
that use ints, it appears that the interpolation results in erroneous values. For example, calling themsw_flag
orsegment_landcover
results in this.Here is an example for segment_snowcover, the flags should only be 0,1,2,3,4 but we have a range outside of that:![image (3)](https://github.com/ICESat2-SlideRule/sliderule/assets/155488932/940a3b4e-1d5a-4851-b34b-d5f967960546)
Other examples here impact the MSW Flag:![image (1)](https://github.com/ICESat2-SlideRule/sliderule/assets/155488932/4aa6b7dd-a8a9-4c00-818c-8f90b60860cb)
This also appears with the Landcover Flag. Other int fields that are not related to field interpolation seem to be OK, here is an example of the Spot Number, which appear nominal:![image (2)](https://github.com/ICESat2-SlideRule/sliderule/assets/155488932/ebecc703-e4e7-4e8d-a4c6-4a352378fd31)
Another note:
segment_landcover
results in the incorrect values, though thelandcover
field that is default in the ATL08 output appears normal. However,segment_snowcover
also results in incorrect values as well assnowcover
.