Readers geospatial
File reading support functions
read_offshore_province_shapes(shape_file, index_name='province')
Read the offshore province shape files (based on the eez)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shape_file
|
PathLike
|
the path to the .shp file & co |
required |
index_name
|
str
|
the name of the index column. Defaults to "province". |
'province'
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: the offshore province shapes as a GeoDataFrame |
Source code in workflow/scripts/readers_geospatial.py
read_pop_density(path, clip_shape=None, crs=CRS, chunks=25, var_name='pop_density')
Read raster data, clip it to a clip_shape and convert it to a GeoDataFrame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathLike
|
the target path for the raster data (tif) |
required |
clip_shape
|
GeoSeries
|
the shape to clip the data. Defaults to None. |
None
|
crs
|
int
|
the coordinate system. Defaults to 4326. |
CRS
|
var_name
|
str
|
the variable name. Defaults to "var". |
'pop_density'
|
chunks
|
int
|
the chunk size for the raster data. Defaults to 25. |
25
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: the raster data for the aoi |
Source code in workflow/scripts/readers_geospatial.py
read_province_shapes(shape_file)
Read the province shape files
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shape_file
|
PathLike
|
the path to the .shp file & co |
required |
Returns:
Type | Description |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: the province shapes as a GeoDataFrame |
Source code in workflow/scripts/readers_geospatial.py
read_raster(path, clip_shape=None, var_name='var', chunks=60, plot=False)
Read raster data and optionally clip it to a given shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathLike
|
The path to the raster file. |
required |
clip_shape
|
GeoSeries
|
The shape to clip the raster data. Defaults to None. |
None
|
var_name
|
str
|
The variable name to assign to the raster data. Defaults to "var". |
'var'
|
chunks
|
int
|
The chunk size for the raster data. Defaults to 60. |
60
|
plot
|
bool
|
Whether to plot the raster data. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
DataArray |
DataArray
|
The raster data as an xarray DataArray. |