简体   繁体   English

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

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

Now, I am working on Stage IV dataset (Precipitation dataset in CONUS).现在,我正在研究第四阶段数据集(CONUS 中的降水数据集)。
https://data.eol.ucar.edu/dataset/21.093 https://data.eol.ucar.edu/dataset/21.093

This is a binary data that shapes (1121 x 881) array and local 4km polar-stereographic grid.这是形成 (1121 x 881) 阵列和局部 4 公里极地立体网格的二进制数据。
The header files includes; header 文件包括: "polar stereo: Lat1 23.117000 Long1 -119.023000 Orient -105.000000". “极地立体声:Lat1 23.117000 Long1 -119.023000 Orient -105.000000”。

I would like to convert this data to Lon/Lat grid for spatially matching to other dataset.我想将此数据转换为 Lon/Lat 网格,以便在空间上与其他数据集匹配。
So, I need to convert this binary to geoTif first.所以,我需要先将此二进制文件转换为 geoTif。
Normally, I use rasterio to convert binary(array) to tif as follows;通常,我使用 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]))

However, this way need to specify the upper left lon/lat.但是,这种方式需要指定左上 lon/lat。 I am not sure this value in polar-stereographic grid.我不确定极地立体网格中的这个值。

Does anyone know good way to convert this binary file to GeoTif and convert to Lon/Lat grid.有谁知道将此二进制文件转换为 GeoTif 并转换为 Lon/Lat 网格的好方法。
The way with not just rasterio, but gdal is all welcome.不仅 rasterio,而且 gdal 的方式都是受欢迎的。 Thank you in advance for your adivice.预先感谢您的建议。

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

Pass dstSRS in WarpOptions , you won't need anything elseWarpOptions dstSRS你不需要其他任何东西

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

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