luhipi / sarvey

Open-source research software for InSAR time series analysis
https://luhipi.github.io/sarvey/docs
Other
25 stars 1 forks source link

Transverse Mercator instead of UTM #7

Closed mahmud1 closed 1 month ago

mahmud1 commented 3 months ago

I encountered an error in step 0 with a dataset that covers two UTM zones.

Traceback (most recent call last):

  File ".../miniforge3/envs/sarvey/bin/sarvey", line 33, in <module>

    sys.exit(load_entry_point('sarvey', 'console_scripts', 'sarvey')())

  File ".../sarvey/sarvey/sarvey_mti.py", line 309, in main

    run(config=config, args=args, logger=logger)

  File ".../sarvey/sarvey/sarvey_mti.py", line 106, in run

    proc_obj.runPreparation()

  File ".../sarvey/sarvey/processing.py", line 190, in runPreparation

    coord_utm_obj.prepare(input_path=join(self.config.general.input_path, "geometryRadar.h5"))

  File ".../sarvey/sarvey/objects.py", line 189, in prepare

    utm_crs = CRS.from_epsg(utm_crs_list[0].code)

IndexError: list index out of range

The cause of the error is using the query_utm_crs_info function with the contain=True parameter returns UTM zones "whose area of use entirely contains the specified bounding box." So when the data covers more than one UTM zone, it returns an empty list. Link to pyproj.database.query_utm_crs_info()

utm_crs_list = query_utm_crs_info(
     datum_name="WGS 84",
     area_of_interest=AreaOfInterest(
         west_lon_degree=np.nanmin(lon.ravel()),
         south_lat_degree=np.nanmin(lat.ravel()),
         east_lon_degree=np.nanmax(lon.ravel()),
         north_lat_degree=np.nanmax(lat.ravel())),
     contains=True)

It seems that using contains=False solves the problem, but it might be even better to replace UTM with Transverse Mercator to also minimize the distortions.

mahmud1 commented 3 months ago