I have three 3x3 arrays that are downsampled data from NOAA's Global Hydro Estimator (smaller to make it quicker for testing). One array is lats, one is lons, and one is rainfall. Here's a sample

[[-180    0  180]
 [-180    0  180]
 [-180    0  180]]

[[  60   60   60]
 [   0    0    0]
 [ -60  -60 -600]]

[[10 50  0]
 [ 0 20 20]
 [10 90  0]]

I would like to convert this into a raster with EPSG:4326 CRS. In order to do that I've chosen xarray and created a DataArray and saved to a raster like so

ds = xr.DataArray(rainfall,

ds.rio.write_crs("epsg:4326", inplace=True)

However, when I look at the raster in qgis the lat/lon are on a scale from 0,3 instead of their respective values in the array above. I've tried messing around with the coords and dims and swapping them with no luck, does anyone have any idea of how to accomplish this?

1 Answer 1


Your latitude and longitude are 2D. They need to be converted to 1D. Here are some suggestions: https://github.com/corteva/rioxarray/issues/209

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.