You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As more and more socio-economic data are loaded into CLIMADA, the question arises on whether and how we want to make their access easier to the wider community. Some of these may require a bit of processing (e.g., current LitPop), some others may be almost plug-and-play but yet potentially require some ad hoc operation.
Options so far:
create something like an exposure_list class where all the implemented low hanging fruits exposures are present
create one class each (probably more suited for data that require more processing efforts)
create util functions that generalize across data (this does not exclude the two above)
just have them in the DATA API
simply create a folder under the climada project where we show what data where successfully loaded and how
I am happy to share some code, how I import exposure data as a CLIMADA-user.
1. Exposure = Population Count from .shp
importgeopandasasgpdfromclimada.entityimportExposuresdata=gpd.read_file('../../population2020.shp')
# change CRS - original is 3035 data.to_crs(epsg=4326, inplace=True)
exp=Exposures(data)
exp.ref_year=2020exp.value_unit='Population Count'exp_pts=exp.copy()
# change geometry & set lat lonexp_pts.gdf['geometry'] =exp_pts.gdf['geometry'].centroidexp_pts.set_lat_lon()
exp_pts.gdf['value'] =exp_pts.gdf['count']
exp_pts.check()
This is of course the most easy way, when I was working with pure population count. I had also a case where e.g., based on some variables of the gdf, I split the exposure in age-classes. In general I always would do that prior to creating an Exposures instance. (e.g. Heat impacts)
importgeopandasasgpdfromclimada.entityimportExposuresimportclimada.util.lines_polys_handlerasu_lpbeam_df=gpd.read_file('../../country.shp')
# needed because otherwise the lat lon calculation in the next steps is not working properly beam_df.to_crs(epsg=4326, inplace=True)
# transforming from polygones to points # each point gets average value within polygonbeam_pts=u_lp.exp_geom_to_pnt(
Exposures(beam_df),
res=100,
to_meters=False,
# note: res is always the unit of the coordinate system used in exposure (in this case it is meters) disagg_met=u_lp.DisaggMethod.DIV,
disagg_val=None )
# setting the reference year and the value of the unit: beam_pts.ref_year=2022beam_pts.value_unit='EUR'exp_pts.check()
Hope that this is of help!
If you see anything which can be done more professional, I am happy for feedback.
A late follow-up on this. I am quite aligned with @thomini : not too fancy things should be needed to load most of exposure data out there. Yet, sometimes some handling is needed. Here are a collected few examples:
so the question remains, does it make sense to have a place (stand alone file, ad hoc class) in CLIMADA to easien access to all these various exposures ?
mmh, actually there are several options/proposals listed above... I think this issue is about finding what is desired way forward.. or we simply close it.
Yes, indeed! Sorry for not being clear. What I meant is an actual simple example of how you would think of implementing you favorite options from the ones above.
I do not really see at the moment how something more general than having all the methods from GeoPandas, direct imports from all OpenStreetMap, as well as functions to handle all polygons an lines, which are all currently available, would look like. Thus, an example from your side would help tremendously.
The only example I can see from the attached notebook that might benefit from extra methods are the handling of netcdf files. This can be easily solved by writing a from_netcdf method for the exposures class. Would you like to implement this?
Also, concerning the API, we already have exposures data on it, so please feel free to add more.
Finally, maybe someone else sees a more general implementation, so we can well expand the discussion!
Activity
thomini commentedon Mar 2, 2023
I am happy to share some code, how I import exposure data as a CLIMADA-user.
1. Exposure = Population Count from
.shpThis is of course the most easy way, when I was working with pure population count. I had also a case where e.g., based on some variables of the
gdf, I split the exposure in age-classes. In general I always would do that prior to creating anExposuresinstance. (e.g. Heat impacts)2. Exposure = Asset Values from polygons
E.g. using a version of the BEAM dataset (https://emergency.copernicus.eu/mapping/list-of-components/EMSN123)
Hope that this is of help!
If you see anything which can be done more professional, I am happy for feedback.
aleeciu commentedon Jul 31, 2023
A late follow-up on this. I am quite aligned with @thomini : not too fancy things should be needed to load most of exposure data out there. Yet, sometimes some handling is needed. Here are a collected few examples:
https://github.com/ChrisFairless/nccs-supply-chain/blob/main/docs/exposures.ipynb
so the question remains, does it make sense to have a place (stand alone file, ad hoc class) in CLIMADA to easien access to all these various exposures ?
chahank commentedon Jul 31, 2023
I still do not really understand what you are thinking of, but sure, why not. Can you make a proposal?
aleeciu commentedon Jul 31, 2023
mmh, actually there are several options/proposals listed above... I think this issue is about finding what is desired way forward.. or we simply close it.
chahank commentedon Jul 31, 2023
Yes, indeed! Sorry for not being clear. What I meant is an actual simple example of how you would think of implementing you favorite options from the ones above.
I do not really see at the moment how something more general than having all the methods from GeoPandas, direct imports from all OpenStreetMap, as well as functions to handle all polygons an lines, which are all currently available, would look like. Thus, an example from your side would help tremendously.
The only example I can see from the attached notebook that might benefit from extra methods are the handling of netcdf files. This can be easily solved by writing a
from_netcdfmethod for the exposures class. Would you like to implement this?Also, concerning the API, we already have exposures data on it, so please feel free to add more.
Finally, maybe someone else sees a more general implementation, so we can well expand the discussion!