Skip to content

UTM conversion raise OutOfRangeError in prep_hyp3.py #1098

@swdmike

Description

@swdmike

Description of the problem

Recently, I encountered a problem that I had not come across before while using the combination of Hyp3 and MintPy. MintPy threw an error: "OutOfRangeError('easting out of range (must be between 100,000 m and 999,999 m)')." when doing UTM-WGS84 convertsion.

Upon investigating the data produced by Hyp3, I discovered that the west was 88040. Therefore, if the default strict mode of utm2latlon is enabled, it does pose an issue. I am unsure if this is a problem with Hyp3, but after modifying the code in MintPy, the program was able to run smoothly. I am not certain if setting it to non-strict as default mode is feasible or if it would be possible for MintPy to provide an option.

Full script that generated the error

hyp3:

search_results = asf.geo_search(
        platform=asf.SENTINEL1,
        intersectsWith='POINT(120.0392 28.8976)',
        start='2022-01-01',
        end='2023-01-01',
        processingLevel=asf.SLC,
        beamMode=asf.IW,
        flightDirection=asf.ASCENDING,
    )

mintpy:

files = data_dir.glob('*/*_dem.tif')
overlap = get_common_overlap(files)
clip_hyp3_products_to_common_overlap(data_dir, overlap)
    
mintpy_config = work_dir / 'mintpy_config.txt'
mintpy_config.write_text(
f"""
mintpy.compute.cluster       = local
mintpy.load.processor        = hyp3
##---------interferogram datasets:
mintpy.load.unwFile          = {data_dir}/*/*_unw_phase_clipped.tif
mintpy.load.corFile          = {data_dir}/*/*_corr_clipped.tif
##---------geometry datasets:
mintpy.load.demFile          = {data_dir}/*/*_dem_clipped.tif
mintpy.load.incAngleFile     = {data_dir}/*/*_lv_theta_clipped.tif
mintpy.load.azAngleFile      = {data_dir}/*/*_lv_phi_clipped.tif
""")

Full error message

Traceback (most recent call last):
  File "/usr/local/bin/prep_hyp3.py", line 8, in <module>
    sys.exit(main())
  File "/root/tools/MintPy/src/mintpy/cli/prep_hyp3.py", line 94, in main
    prep_hyp3(inps)
  File "/root/tools/MintPy/src/mintpy/prep_hyp3.py", line 123, in prep_hyp3
    meta = add_hyp3_metadata(fname, meta, is_ifg=is_ifg)
  File "/root/tools/MintPy/src/mintpy/prep_hyp3.py", line 63, in add_hyp3_metadata
    N, W = ut.utm2latlon(meta, W, N)
  File "/root/tools/MintPy/src/mintpy/utils/utils0.py", line 322, in utm2latlon
    lat, lon = utm.to_latlon(easting, northing, zone_num, northern=northern)
  File "/usr/local/lib/python3.10/site-packages/utm/conversion.py", line 124, in to_latlon
    raise OutOfRangeError('easting out of range (must be between 100,000 m and 999,999 m)')
utm.error.OutOfRangeError: easting out of range (must be between 100,000 m and 999,999 m)

MintPy Code Modification

lat, lon = utm.to_latlon(easting, northing, zone_num, northern=northern, strict=False)

System information

  • Operating system: Ubuntu 18
  • Python environment: 3.10
  • MintPy version: 1.5.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions