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
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
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
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
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. |
Source code in workflow/scripts/readers_geospatial.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |