reproject on numpy array

Guy Doulberg
 

Hi guys

I am trying to use a method `rasterio.warp.reproject`

I create a source numpy array full of zeros and dest numpy array full of ones, I reprojected using the nearset resmapling and src_nodata=0
The dest array became all zeros,

I expected it to be all ones, since the array didn't have any valid data

What am I missing?

I am running this code:


data =  np.zeros((1,1000, 1000))
dest = np.ones_like(data)
reproject(data, dest, src_transform=raster.affine,dst_transform=projected.affine, src_crs=raster.crs, dst_crs=projected.crs, resampling=Resampling.nearest, src_nodata=data[0][0][0])
print(src_transform,"\n",dst_transform,"\n", src_crs, "\n",dst_crs)
print(data)
print(dest)

and this is the output I am getting

| 10.00, 0.00, 640590.00|
| 0.00,-10.00, 5839580.00|
| 0.00, 0.00, 1.00| 
 | 0.00, 0.00,-73.41|
| 0.00,-0.00,-37.58|
| 0.00, 0.00, 1.00| 
 +init=epsg:32718 
 +init=epsg:4326
[[[0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]
  ...
  [0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]]]
[[[0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]
  ...
  [0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]
  [0. 0. 0. ... 0. 0. 0.]]]


What am I missing?

Join main@rasterio.groups.io to automatically receive all group messages.