diff --git a/doc/tutorial/1_main_climada.ipynb b/doc/tutorial/1_main_climada.ipynb index 730d5e5ed..9729a2c3a 100644 --- a/doc/tutorial/1_main_climada.ipynb +++ b/doc/tutorial/1_main_climada.ipynb @@ -554,7 +554,6 @@ "from climada.entity.exposures import LitPop\n", "\n", "exp_litpop = LitPop.from_countries('Puerto Rico', res_arcsec = 120) # We'll go lower resolution than default to keep it simple\n", - "exp_litpop.set_geometry_points() # Set geodataframe geometries from lat lon data\n", "\n", "exp_litpop.plot_hexbin(pop_name=True, linewidth=4, buffer=0.1);" ] diff --git a/doc/tutorial/climada_entity_Exposures.ipynb b/doc/tutorial/climada_entity_Exposures.ipynb index b5db1520e..7572797c4 100644 --- a/doc/tutorial/climada_entity_Exposures.ipynb +++ b/doc/tutorial/climada_entity_Exposures.ipynb @@ -51,7 +51,7 @@ "| Optional columns | Data Type | Description |\n", "| :-------------------- | :------------ | :------------------------------------------------------------------------------------- |\n", "| `impf_*` | int | impact functions ids for hazard types.
important attribute, since it relates the exposures to the hazard by specifying the impf_act functions.
Ideally it should be set to the specific hazard (e.g. `impf_TC`) so that different hazards can be set
in the same Exposures (e.g. `impf_TC` and `impf_FL`).
If not provided, set to default `impf_` with ids 1 in check(). |\n", - "| `geometry` | Point | geometry of type Point
Main feature of geopandas DataFrame extension
Computed in method `set_geometry_points()` |\n", + "| `geometry` | Point | geometry of type Point
Main feature of geopandas DataFrame extension |\n", "| `deductible` | float | deductible value for each exposure.
Used for insurance |\n", "| `cover` | float | cover value for each exposure.
Used for insurance |\n", "| `category_id` | int | category id (e.g. building code) for each exposure |\n", @@ -198,11 +198,7 @@ "print('exp has the type:', str(type(exp)))\n", "print('and contains a GeoDataFrame exp.gdf:', str(type(exp.gdf)))\n", "\n", - "# set geometry attribute (shapely Points) from GeoDataFrame from latitude and longitude\n", - "exp.set_geometry_points()\n", - "print('\\n' + 'check method logs:')\n", - "\n", - "# always apply the check() method in the end. It puts metadata that has not been assigned,\n", + "# Apply the check() method in the end. It puts metadata that has not been assigned,\n", "# and points out missing mandatory data\n", "exp.check()" ] @@ -1147,11 +1143,7 @@ "exp_templ = Exposures(exp_templ)\n", "print('\\n' + 'exp_templ is now an Exposures:', str(type(exp_templ)))\n", "\n", - "# set geometry attribute (shapely Points) from GeoDataFrame from latitude and longitude\n", - "print('\\n' + 'set_geometry logs:')\n", - "exp_templ.set_geometry_points()\n", - "# as always, run check method to include metadata and check for missing mandatory parameters\n", - "\n", + "# run check method to include metadata and check for missing mandatory parameters\n", "print('\\n' + 'check exp_templ:')\n", "exp_templ.check()" ] @@ -1760,7 +1752,8 @@ "id": "5d078d09", "metadata": {}, "source": [ - "Finally, as with any Python object, use climada's save option to save it in pickle format. Note however, that pickle has a transient format and should be avoided when possible." + "Optionally use climada's save option to save it in pickle format. This allows fast to quickly restore the object in its current state and take up your work right were you left it the next time.\n", + "Note however, that pickle has a transient format and is not suitable for storing data persistently." ] }, { @@ -1774,51 +1767,6 @@ "# this generates a results folder in the current path and stores the output there\n", "save('exp_templ.pkl.p', exp_templ) # creates results folder and stores there" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n", - "## Dask - improving performance for big exposure\n", - "\n", - "Dask is used in some methods of CLIMADA and can be activated easily by proving the scheduler." - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " value latitude longitude impf_TC\n", - "0 0 15.0 20.000000 1\n", - "1 1 15.0 20.202020 1\n", - "2 2 15.0 20.404040 1\n", - "3 3 15.0 20.606061 1\n", - "4 4 15.0 20.808081 1\n", - "CPU times: user 243 ms, sys: 116 ms, total: 359 ms\n", - "Wall time: 2.52 s\n", - " value latitude longitude impf_TC geometry\n", - "0 0 15.0 20.000000 1 POINT (20.00000 15.00000)\n", - "1 1 15.0 20.202020 1 POINT (20.20202 15.00000)\n", - "2 2 15.0 20.404040 1 POINT (20.40404 15.00000)\n", - "3 3 15.0 20.606061 1 POINT (20.60606 15.00000)\n", - "4 4 15.0 20.808081 1 POINT (20.80808 15.00000)\n" - ] - } - ], - "source": [ - "# set_geometry_points is expensive for big exposures\n", - "# for small amount of data, the execution time might be even greater when using dask\n", - "exp.gdf.drop(columns=['geometry'], inplace=True)\n", - "print(exp.gdf.head())\n", - "%time exp.set_geometry_points(scheduler='processes')\n", - "print(exp.gdf.head())" - ] } ], "metadata": { diff --git a/doc/tutorial/climada_entity_LitPop.ipynb b/doc/tutorial/climada_entity_LitPop.ipynb index 8625fe394..9b6c64467 100644 --- a/doc/tutorial/climada_entity_LitPop.ipynb +++ b/doc/tutorial/climada_entity_LitPop.ipynb @@ -728,12 +728,11 @@ "# Initiate GDP-Entity for Switzerland, with and without admin1_calc:\n", "\n", "ent_adm0 = LitPop.from_countries('CHE', res_arcsec=120, fin_mode='gdp', admin1_calc=False)\n", - "ent_adm0.set_geometry_points()\n", + "ent_adm0.check()\n", "\n", "ent_adm1 = LitPop.from_countries('CHE', res_arcsec=120, fin_mode='gdp', admin1_calc=True)\n", - "\n", - "ent_adm0.check()\n", "ent_adm1.check()\n", + "\n", "print('Done.')" ] },