繁体   English   中英

将北极立体二进制重投影到 Lon/Lat 网格(python 中的光栅或 gdal)

[英]Reprojection of North Polar Stereographic binary to Lon/Lat grid (rasterio or gdal in python)

现在,我正在研究第四阶段数据集(CONUS 中的降水数据集)。
https://data.eol.ucar.edu/dataset/21.093

这是形成 (1121 x 881) 阵列和局部 4 公里极地立体网格的二进制数据。
header 文件包括: “极地立体声:Lat1 23.117000 Long1 -119.023000 Orient -105.000000”。

我想将此数据转换为 Lon/Lat 网格,以便在空间上与其他数据集匹配。
所以,我需要先将此二进制文件转换为 geoTif。
通常,我使用 rasterio 将二进制(数组)转换为 tif,如下所示;

def convert_np2tif(data, out_file,
                   width_of_pixel, height_of_pixel, lon_upper_left, lat_upper_left,
                   crs):
    affine = Affine(width_of_pixel, 0, lon_upper_left, 0, -1*height_of_pixel, lat_upper_left)
    with rasterio.open(out_file, 'w',
                        driver='GTiff',
                        height=data.shape[0],
                        width=data.shape[1],
                        count=1,
                        dtype=data.dtype,
                        crs=crs,
                        transform=affine
                        ) as dst:
        dst.write(data.reshape(1,data.shape[0],data.shape[1]))

但是,这种方式需要指定左上 lon/lat。 我不确定极地立体网格中的这个值。

有谁知道将此二进制文件转换为 GeoTif 并转换为 Lon/Lat 网格的好方法。
不仅 rasterio,而且 gdal 的方式都是受欢迎的。 预先感谢您的建议。

这个问题包含您需要的一切: https://gis.stackexchange.com/questions/278627/using-gdal-warp-and-gdal-warpoptions-of-gdal-python-api/341693

WarpOptions dstSRS你不需要其他任何东西

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM