Skip to content

Exposure data in CLIMADA #667

Closed
Closed

Description

@aleeciu

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
  • ...

Activity

  1. thomini commented on Mar 2, 2023

    @thomini

    I am happy to share some code, how I import exposure data as a CLIMADA-user.

    1. Exposure = Population Count from .shp

    import geopandas as gpd
    from climada.entity import Exposures
    
    data = gpd.read_file('../../population2020.shp')
    # change CRS - original is 3035 
    data.to_crs(epsg=4326, inplace=True)
    
    exp = Exposures(data) 
    exp.ref_year = 2020 
    exp.value_unit = 'Population Count'
    exp_pts = exp.copy() 
    # change geometry & set lat lon
    exp_pts.gdf['geometry'] = exp_pts.gdf['geometry'].centroid 
    exp_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)

    2. Exposure = Asset Values from polygons

    E.g. using a version of the BEAM dataset (https://emergency.copernicus.eu/mapping/list-of-components/EMSN123)

    import geopandas as gpd
    from climada.entity import Exposures
    import climada.util.lines_polys_handler as u_lp
    
    beam_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 polygon
    beam_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 = 2022 
    beam_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.

  2. aleeciu commented on Jul 31, 2023

    @aleeciu
    CollaboratorAuthor

    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 ?

  3. chahank commented on Jul 31, 2023

    @chahank
    Member

    I still do not really understand what you are thinking of, but sure, why not. Can you make a proposal?

  4. aleeciu commented on Jul 31, 2023

    @aleeciu
    CollaboratorAuthor

    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.

  5. chahank commented on Jul 31, 2023

    @chahank
    Member

    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!

  6. locked and limited conversation to collaborators on Jul 31, 2023
  7. converted this issue into a discussion #759 on Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions