0

我正在尝试运行一个脚本,其中包含多个 Python 脚本,这些脚本将通过多处理按顺序执行,包括将纬度/经度转换为等效的 UTM 坐标的脚本。该脚本在作为独立脚本运行时有效,但是在脚本组中执行相同的脚本时出现错误。这是转换代码和警告

def convert_wgs_to_utm(lon, lat):
   import warnings
   with warnings.catch_warnings():
    warnings.simplefilter(action = "default", category=FutureWarning)  
    warnings.simplefilter(action = "error", category=FutureWarning)
    warnings.simplefilter("ignore")
    utm_band = str((math.floor((lon + 180) / 6 ) % 60) + 1)
    if len(utm_band) == 1:
        utm_band = '0'+utm_band
    if lat >= 0:
        epsg_code = '326' + utm_band
    else:
        epsg_code = '327' + utm_band
   return epsg_code

def geodesic_transform(POLY):
       np.seterr(all='raise')
       with np.errstate(divide='raise'): 
        input_lon = POLY.centroid.x
        input_lat = POLY.centroid.y
        project = pyproj.Transformer.from_proj(
                    pyproj.Proj(init='epsg:4326'), 
                    pyproj.Proj(init='epsg:3763'), #{0}'.format(utm_code)),
                    always_xy=True) # destination coordinate system 3857 3763 26917
        POLY = transform(project.transform, POLY)  # apply projection 
       return POLY

有人可以向我解释这两个警告 53 和 294 到底是什么意思吗?以及如何抑制传出消息?

/home/jupyterweb/python_envs/pangeo/lib/python3.8/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  return _prepare_from_string(" ".join(pjargs))

/home/jupyterweb/python_envs/pangeo/lib/python3.8/site-packages/pyproj/crs/crs.py:294: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6

4

0 回答 0