Now, I am working on Stage IV dataset (Precipitation dataset in CONUS).
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.
The header files includes;
"polar stereo: 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.
So, I need to convert this binary to geoTif first.
Normally, I use rasterio to convert binary(array) to tif as follows;
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. 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.
The way with not just rasterio, but gdal is all welcome. Thank you in advance for your adivice.