GridSource
io.GridSource(self, file, chunk=None, subset=None, var_as_band=False, mode='r')
A source object for geospatial gridded data.
Essentially a gdal Dataset wrapper.
Parameters
Name | Type | Description | Default |
---|---|---|---|
file |
str | The path to a file. | required |
chunk |
tuple | Chunking size of the data. | None |
subset |
str | The wanted subset of data. This is applicable to netCDF files containing multiple variables. | None |
var_as_band |
bool | Whether to interpret the variables as bands. This is applicable to netCDF files containing multiple variables. | False |
mode |
str | The I/O mode. Either r for reading or w for writing. |
'r' |
Examples
Can be indexed directly to get a Grid
object.
# Open a file
= open_grid(< path-to-file >)
gs
# Index it (take the first band)
= gs[1] grid
Attributes
Name | Description |
---|---|
bounds | Return the bounds of the GridSource. |
chunk | Return the chunking size. |
dtype | Return the data types of the field data. |
shape | Return the shape of the grid. |
shape_xy | Return the shape of the grid. |
size | Return the number of bands. |
Methods
Name | Description |
---|---|
close | Close the GridSource. |
create | Create a new data source. |
create_band | Create a new band. |
deter_band_names | Determine the names of the bands. |
flush | Flush the data. |
get_band_name | Get the name of a specific band. |
get_band_names | Get the names of all bands. |
get_geotransform | Return the geo transform of the grid. |
get_srs | Return the srs (Spatial Reference System) of the grid. |
reopen | Reopen a closed GridSource. |
set_chunk_size | Set the chunking size of the grid. |
set_geotransform | Set the geo transform of the grid. |
set_srs | Set the srs of the gird. |