Import Local Climate Zone¶
Import LCZ from CEREMA.
Command ¶
Bases: BaseCommand
Source code in back/iarbre_data/management/commands/import_lcz.py
handle(*args, **options) ¶
Load LCZ from CEREMA and then save all LCZ data in the DB.
Source code in back/iarbre_data/management/commands/import_lcz.py
download_data() ¶
Downloads the Local Climate Zone data from the specified URL and extracts it to the 'file_data/' directory.
Raises:
| Type | Description |
|---|---|
ValueError | If the URL for Local Climate Zone does not exist. |
Source code in back/iarbre_data/management/commands/import_lcz.py
load_data() ¶
Open the shapefile for LCZ.
Returns:
| Type | Description |
|---|---|
GeoDataFrame | geopandas.GeoDataFrame: The loaded shapefile as a GeoDataFrame. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If no folder with "lcz" in the name is found or no .shp file is found in the folder. |
Source code in back/iarbre_data/management/commands/import_lcz.py
save_geometries(lcz_datas) ¶
Save LCZ to the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lcz_datas | GeoDataFrame | GeoDataFrame to save to the database. | required |
Returns:
| Type | Description |
|---|---|
None | None |