Skip to content

Potential Region-Dependent Artifact: Vertical Striping Appears in RTP Results Under Specific Geomagnetic Parameters #624

@lazyn1997

Description

@lazyn1997

Problem Description

When using the harmonica to perform reduction to the pole (RTP) on magnetic data, noticeable vertical stripes (or smoothing artifacts) appear in the results. The occurrence of this artifact shows a strong correlation with the geomagnetic parameters (particularly magnetic inclination and declination) of the survey area.

Steps to Reproduce

  1. Prepare two gridded magnetic datasets from different regions.
  2. Region 1 (Problematic Case): Perform RTP using the following parameters:
    • Central coordinates: -66.2, -23.0
    • Magnetic declination: -4.3°
    • Magnetic inclination: -20°
  3. Region 2 (Comparison Case): Perform RTP using the following parameters:
    • Magnetic declination: 6.4°
    • Magnetic inclination: -40.3°
  4. Compare the RTP result maps for the two regions.
  5. Observation: The RTP result for Region 1 (-20° inclination) exhibits clear vertical striping/smoothing artifacts. This phenomenon is almost invisible in the result for Region 2 (-40.3° inclination).

Expected Behavior

The RTP processing should yield results free of obvious directional artifacts regardless of the geomagnetic parameters. Both regions should exhibit consistent data quality.

    def _reduce_to_pole_harmonica(self, data, grid_lon, grid_lat, inclination, declination, improve=False):
        """
        使用Harmonica进行化极处理 - 修正版
        """
        # 1. 验证坐标顺序和单调性
        x_coords = grid_lon[0, :]  # 经度坐标(东向)
        y_coords = grid_lat[:, 0]  # 纬度坐标(北向)

        # print(f"坐标范围: X({x_coords.min():.2f} - {x_coords.max():.2f}), "
        #       f"Y({y_coords.min():.2f} - {y_coords.max():.2f})")
        flipud = False
        fliplr = False
        # 检查坐标是否单调递增
        if not (np.all(np.diff(x_coords) > 0) and np.all(np.diff(y_coords) > 0)):
            if not np.all(np.diff(x_coords) > 0):
                print("警告: X坐标不是严格单调递增,可能需要调整")
                # 如果坐标递减,需要反转
                if np.all(np.diff(x_coords) < 0):
                    x_coords = x_coords[::-1]
                    data = data[:, ::-1]
                    fliplr = True
                    print("X坐标已反转")
                else:
                    raise ValueError("X坐标不是严格单调递增且不是严格单调递减,请检查数据")
            if not np.all(np.diff(y_coords) > 0):
                print("警告: Y坐标不是严格单调递增,可能需要调整")
                if np.all(np.diff(y_coords) < 0):
                    y_coords = y_coords[::-1]
                    data = data[::-1, :]
                    flipud = True
                    print("Y坐标已反转")
                else:
                    raise ValueError("Y坐标不是严格单调递减且不是严格单调递增,请检查数据")
        else:
            print("X坐标已验证为严格单调递增且Y坐标已验证为严格单调递增")

        # 2. 创建正确的DataArray
        # 关键修正:确保维度顺序正确
        grid = xr.DataArray(
            data=data,
            dims=("northing", "easting"),  # 使用更明确的维度名称
            coords={
                "northing": y_coords,  # 北向坐标(纬度)
                "easting": x_coords,  # 东向坐标(经度)
            },
            attrs={
                "inclination": inclination,
                "declination": declination
            }
        )

        # inclination 地磁场的倾角
        # declination 地磁场的偏角
        # magnetization_inclination 异常体的总磁化倾角,设为 None,harmonica 会默认等于 inclination
        # magnetization_declination 异常体的总磁化偏角,设为 None,harmonica 会默认等于 declination
        rtp_data = hm.reduction_to_pole(
            grid,
            inclination=inclination,
            declination=declination,
            magnetization_inclination=inclination,
            magnetization_declination=declination
        )
        rtp_values = rtp_data.values
        if flipud:
            rtp_values = np.flipud(rtp_values)
            print("对化极结果进行上下翻转")
        if fliplr:
            rtp_values = np.fliplr(rtp_values)
            print("对化极结果进行左右翻转")

        def stabilize_fft(rtp, level=4):
            fft_rtp = fft.fft2(rtp)
            ny, nx = rtp.shape

            kx = np.fft.fftfreq(nx)
            ky = np.fft.fftfreq(ny)
            kx, ky = np.meshgrid(kx, ky)
            k = np.sqrt(kx ** 2 + ky ** 2)

            LP = np.exp(-(k ** 2) * level)  # Gaussian low-pass

            return np.real(fft.ifft2(fft_rtp * LP))

        def rtp_regularize(rtp, alpha=0.15):
            return rtp / (1 + alpha)

        def edge_taper(rtp, w=0.1):
            ny, nx = rtp.shape
            wx = np.hanning(int(nx * w))
            wy = np.hanning(int(ny * w))

            wx = np.concatenate([wx[:len(wx) // 2], np.ones(nx - len(wx)), wx[len(wx) // 2:]])
            wy = np.concatenate([wy[:len(wy) // 2], np.ones(ny - len(wy)), wy[len(wy) // 2:]])

            taper = wy[:, None] * wx[None, :]
            return rtp * taper

        def improve_harmonica_rtp(rtp):
            rtp1 = stabilize_fft(rtp, level=6)  # 关键滤波稳定方向
            rtp2 = rtp_regularize(rtp1, alpha=0.12)  # 抑制异常区域爆炸
            rtp3 = edge_taper(rtp2, w=0.08)  # 去除边界振铃
            return rtp3

        if improve:
            rtp_values = improve_harmonica_rtp(rtp_values)

        return rtp_values

harmonica result.docx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions