How can I generate linear elevation raster?

With Python script (just paste it into the Python console in QGIS, or run as a .py file there):

import numpy as np
from osgeo import gdal, osr
gdal.UseExceptions()

x = np.arange(0,500,1)
y = np.arange(0,500,1)
xx,yy = np.meshgrid(x,y)
l = np.tril(xx)
u = np.triu(yy,k=1)
m1 = l+ u #lu
m2 = np.rot90(m1,1) #ll
m3 = np.rot90(m1,2) #rl
m4 = np.rot90(m1,3) #ru

h1=np.concatenate((m1,m4), axis=1)
h2=np.concatenate((m2,m3), axis=1)

result = np.concatenate((h1,h2))

driver = gdal.GetDriverByName('GTiff')
output_path = "D:\\raster.tif"
file = driver.Create(output_path, 1000 ,1000 , 1, gdal.GDT_Float32)
file.GetRasterBand(1).WriteArray(result)

# spatial reference goes here
proj = osr.SpatialReference()
proj.ImportFromEPSG(4326)   
file.SetProjection(proj)
file.SetGeoTransform((0.0, 0.005, 0.0, 0.0, 0.0, -0.005))

file.FlushCache()

Some mathematics should be done. I hope it works.