Data Model Usage Examples¶
Imports¶
Initialze notebook display
Open Raster Files¶
Querying Raster Information¶
Create Raster¶
Understanding Formats and Drivers¶
When creating a new raster you have to choose a file format. Most HUB Datacube raster creation routines use the GDAL MEM format as default, which does not store the data to disc, but simply holds it in memory. This is often useful for intermediate results, testing or demonstation perpouses. Different formats are provided by so called drivers. A driver can be used to create a new raster of the corresponding format.
Some drivers are subclassed…
… and provide functionality to conviniently setup some creation options.
For example, use the GTiffDriver to setup the creation options for a LZW compressed and tiled GTiff with a block size of 256. Note that the GTiffDriver exposes some enumerates for selecting appropriate creation option values (e.g. GTiffDriver.COMPRESS.LZW).
Raster from Array¶
Raster files are always associated with a pixel grid, which is defined by an extent, a resolution and a projection.
E.g., define a raster in WGS 84 projection covering the whole world with a resolution of 1°.
Create a MEM raster with random noise.
Store the raster as an ENVI file.
Store the raster as a LZW compressed GTiff file.
Create empty Raster¶
Write Raster Data¶
Using the empty raster from above.
Write red color values to the whole grid.
Write blue color values to a raster subset.
THERE IS A BUG WITH THE Y ORIGIN!!!¶
Write to the second rasterband creating…
Managing Raster Metadata¶
Managing Raster Metadata Items¶
Set some metadata items.
Query some metadata.
Specify a data type if needed.
Managing Rasterband Metadata Items¶
Managing No Data Values¶
Set a single no data value to all raster bands.
Set different no data values to each band.
Set no data values by iterating over the raster bands.
Managing Acquisition Time¶
Special Considerations for ENVI Software¶
When a raster is written