April 2018
Beginner to intermediate
440 pages
11h 36m
English
In the previous section, you learned how to load a raster, perform basic queries, modify it, and save it out as a new file. In this section, you will learn how to create a raster.
A raster is an array of values. So to create one, you start by creating an array, as shown in the following code:
a_raster=np.array([ [10,10,1,10,10,10,10], [1,1,1,50,10,10,50], [10,1,1,51,10,10,50], [1,1,1,1,50,10,50]])
The previous code creates a numpy array with four rows of seven columns. Now that you have the array of data, you will need to set some basic properties. The following code will assign the values to variables and then you will pass them to the raster in the following example:
coord=(-106.629773,35.105389)w=10h=10name="BigI.tif" ...