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

point selection function #10

Open
rogerkuou opened this issue Sep 12, 2024 · 0 comments
Open

point selection function #10

rogerkuou opened this issue Sep 12, 2024 · 0 comments
Assignees

Comments

@rogerkuou
Copy link
Member

rogerkuou commented Sep 12, 2024

In classification.py implement the ps_selection function with two flavors: NAD and NMAD.

  • Move NAD function from sarxarray implementation to here.
  • Add NMAD implementation by Wiestke, which is attached below.
  • Add deprection warning to point_selection function in sarxarray
def _nmad(self, chunk_azimuth=500, chunk_range=500):
        """
        Estimate the NMAD for a xarray dataset. 
        """
        # Time dimension order
        t_order = list(self._obj.dims.keys()).index("time")
        
        # Rechunk to make temporal operation more efficient
        amplitude = self._obj.amplitude.chunk(
            {"azimuth": chunk_azimuth, "range": chunk_range, "time": -1}
        )

        median_amplitude = amplitude.median(axis=t_order)
        mad = (np.abs(amplitude - median_amplitude)).median(dim="time")
        nmad = mad / (median_amplitude + np.finfo(amplitude.dtype).eps)

        return nmad
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

1 participant