Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: BurstNoise fails during from_noise_annotation #122

Closed
scottstanie opened this issue Jun 26, 2023 · 3 comments
Closed

[Bug]: BurstNoise fails during from_noise_annotation #122

scottstanie opened this issue Jun 26, 2023 · 3 comments
Assignees

Comments

@scottstanie
Copy link
Contributor

I got this error

...
  File "/u/aurora-r0/staniewi/repos/sweets/src/sweets/_geocode_slcs.py", line 47, in run_geocode
    cfg = GeoRunConfig.load_from_yaml(str(run_config_path), "s1_cslc_geo")
  File "/u/aurora-r0/staniewi/repos/COMPASS/src/compass/utils/geo_runconfig.py", line 96, in load_from_yaml
    bursts = runconfig_to_bursts(sns)
  File "/u/aurora-r0/staniewi/repos/COMPASS/src/compass/utils/runconfig.py", line 225, in runconfig_to_bursts
    for burst in load_bursts(safe_file, orbit_path, i_subswath, pol):
  File "/u/aurora-r0/staniewi/repos/s1-reader/src/s1reader/s1_reader.py", line 881, in load_bursts
    bursts = _burst_from_zip(path, id_str, orbit_path,
  File "/u/aurora-r0/staniewi/repos/s1-reader/src/s1reader/s1_reader.py", line 948, in _burst_from_zip
    bursts = burst_from_xml(f_annotation, orbit_path, f_tiff, iw2_f_annotation, z_file.open,
  File "/u/aurora-r0/staniewi/repos/s1-reader/src/s1reader/s1_reader.py", line 758, in burst_from_xml
    burst_noise = BurstNoise.from_noise_annotation(noise_annotation,
  File "/u/aurora-r0/staniewi/repos/s1-reader/src/s1reader/s1_annotation.py", line 840, in from_noise_annotation
    id_top = np.argmin(np.abs(noise_annotation.az_line-line_from))
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

Note that id_top = np.argmin(np.abs(noise_annotation.az_line-line_from)) uses .az_line. This is not defined anywhere:
https://github.com/opera-adt/s1-reader/blob/ed16185338c879b59518ca26936751a1baffd621/src/s1reader/s1_annotation.py#L776-L789
it's probably a typo from copying this different class: https://github.com/opera-adt/s1-reader/blob/ed16185338c879b59518ca26936751a1baffd621/src/s1reader/s1_annotation.py#L274-L289

Let's add some unit test that runs to make a BurstNoise class, I think this would currently fail for any where ipf_version >= min_ipf_version_az_noise_vector

@scottstanie
Copy link
Contributor Author

Sorry I was wrong about the .az_line not being defined.

Currently trying to get a reproducible example, since the bug seems not appear when I try to find which file it errored on 😕

@scottstanie
Copy link
Contributor Author

Closing because I can't find any way to reproduce, and the logic for checking the IPF version seems to imply this bug shouldn't have happened... Sorry for the github noise (pun intended)

@seongsujeong
Copy link
Contributor

@scottstanie Interesting. Please re-open this issue when you are able to reproduce the error you reported here.

The member az_line is defined in the dataclass NoiseAnnotation, which will be assigned None when the IPF version of the data is older than the threshold min_ipf_version_az_noise_vector

What I can think about the error is that the reader failed to parse az_line for some reason, even when the IPF version says the information should exist in the noise annotation, and the following codes assumes that we have some data in az_line. But I will need to some example data to figure out what exactly happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants