climada_petals.hazard package

climada_petals.hazard.drought module

class climada_petals.hazard.drought.Drought[source]

Bases: climada.hazard.base.Hazard

Contains drought events.

SPEI

Standardize Precipitation Evapotraspiration Index

Type

float

vars_opt = {'spei'}

Name of the variables that aren’t need to compute the impact.

__init__()[source]

Empty constructor.

set_area(latmin, lonmin, latmax, lonmax)[source]

Set the area to analyse

set_file_path(path)[source]

Set path of the SPEI data

set_threshold(threshold)[source]

Set threshold

set_intensity_def(intensity_definition)[source]

Set intensity definition

setup()[source]

Set up the hazard drought

hazard_def(intensity_matrix)[source]

return hazard set

Parameters

see intensity_from_spei

Returns

  • Drought, full hazard set

  • check using new_haz.check()

plot_intensity_drought(event=None)[source]

plot drought intensity

post_processing(date)[source]

Date in format ‘2003-08-01’ Sets intensity of events starting after that date to zero

plot_start_end_date(event=None)[source]

plot start and end date of the chosen event

climada_petals.hazard.landslide module

class climada_petals.hazard.landslide.Landslide[source]

Bases: climada.hazard.base.Hazard

Landslide Hazard set generation.

__init__()[source]

Empty constructor.

classmethod from_hist(bbox, input_gdf, res=0.0083333)[source]

Set historic landslide (ls) raster hazard from historical point records, for example as can be retrieved from the NASA COOLR initiative, which is the largest global ls repository, for a specific geographic extent. Points are assigned to the gridcell they fall into, and the whole grid- cell hence counts as equally affected. Event frequencies from an incomplete dataset are not meaningful and hence aren’t set by default. probabilistic calculations! Use the probabilistic method for this!

See tutorial for details; the global ls catalog from NASA COOLR can bedownloaded from https://maps.nccs.nasa.gov/arcgis/apps/webappviewer/index.html?id=824ea5864ec8423fb985b33ee6bc05b7

Note

The grid which is generated has the same projection as the geodataframe with point occurrences. By default, this is EPSG:4326, which is a non- projected, geographic CRS. This means, depending on where on the globe the analysis is performed, the area per gridcell differs vastly. Consider this when setting your resoluton (e.g. at the equator, 1° ~ 111 km). In turn, one can use projected CRS which preserve angles and areas within the reference area for which they are defined. To do this, reproject the input_gdf to the desired projection. For more on projected & geographic CRS, see https://desktop.arcgis.com/en/arcmap/10.3/guide-books/map-projections/about-projected-coordinate-systems.htm

Parameters
  • bbox (tuple) – (minx, miny, maxx, maxy) geographic extent of interest

  • input_gdf (str or or geopandas geodataframe) – path to shapefile (.shp) with ls point data or already laoded gdf

  • res (float) – resolution in units of the input_gdf crs of the final grid cells which are created. Whith EPSG:4326, this is degrees. Default is 0.008333.

Returns

Landslide – instance filled with historic LS hazard set for either point hazards or polygons with specified surrounding extent.

Return type

Landslide

set_ls_hist(*args, **kwargs)[source]

This function is deprecated, use Landslide.from_hist instead.

classmethod from_prob(bbox, path_sourcefile, corr_fact=10000000.0, n_years=500, dist='poisson')[source]

Set probabilistic landslide hazard (fraction, intensity and frequency) for a defined bounding box and time period from a raster. The hazard data for which this function is explicitly written is readily provided by UNEP & the Norwegian Geotechnical Institute (NGI), and can be downloaded and unzipped from https://preview.grid.unep.ch/index.php?preview=data&events=landslides&evcat=2&lang=eng for precipitation-triggered landslide and from https://preview.grid.unep.ch/index.php?preview=data&events=landslides&evcat=1&lang=eng for earthquake-triggered landslides. It works of course with any similar raster file. Original data is given in expected annual probability and percentage of pixel of occurrence of a potentially destructive landslide event x 1000000 (so be sure to adjust this by setting the correction factor). More details can be found in the landslide tutorial and under above- mentioned links.

Events are sampled from annual occurrence probabilites via binomial or poisson distribution; intensity takes a binary value (0 - no ls occurrence; 1 - ls occurrence) and fraction stores the actual the occurrence count (0 to n) per grid cell. Frequency is occurrence count / n_years.

Impact functions, since they act on the intensity, should hence be in the form of a step function, defining impact for intensity 0 and (close to) 1.

Parameters
  • bbox (tuple) – (minx, miny, maxx, maxy) geographic extent of interest

  • path_sourcefile (str) – path to UNEP/NGI ls hazard file (.tif)

  • corr_fact (float or int) – factor by which to divide the values in the original probability file, in case it is not scaled to [0,1]. Default is 1’000’000

  • n_years (int) – sampling period

  • dist (str)

  • distribution to sample from. ‘poisson’ (default) and ‘binom’

Returns

Landslide – probabilistic LS hazard

Return type

climada.hazard.Landslide instance

See also

sample_events_from_probs

set_ls_prob(*args, **kwargs)[source]

This function is deprecated, use Landslide.from_prob instead.

climada_petals.hazard.low_flow module

class climada_petals.hazard.low_flow.LowFlow(pool=None)[source]

Bases: climada.hazard.base.Hazard

Contains river low flow events (surface water scarcity). The intensity of the hazard is number of days below a threshold (defined as percentile in reference data). The method set_from_nc can be used to create a LowFlow hazard set populated with data based on gridded hydrological model runs as provided by the ISIMIP project (https://www.isimip.org/), e.g. ISIMIP2a/b. grid cells with a minimum number of days below threshold per month are clustered in space (lat/lon) and time (monthly) to identify and set connected events.

clus_thresh_t

maximum time difference in months to be counted as$ connected points during clustering, default = 1

Type

int

clus_thresh_xy

maximum spatial grid cell distance in number of cells to be counted as connected points during clustering, default = 2

Type

int

min_samples

Minimum amount of data points in one cluster to consider as event, default = 1.

Type

1

date_start

for each event, the date of the first month of the event (ordinal) Note: Hazard attribute ‘date’ contains the date of maximum event intensity.

Type

np.array(int)

date_end

for each event, the date of the last month of the event (ordinal)

Type

np.array(int)

resolution

spatial resoultion of gridded discharge input data in degree lat/lon, default = 0.5°

Type

float

clus_thresh_t = 1
clus_thresh_xy = 2
min_samples = 1
resolution = 0.5
__init__(pool=None)[source]

Empty constructor.

set_from_nc(*args, **kwargs)[source]

This function is deprecated, use LowFlow.from_netcdf instead.

classmethod from_netcdf(input_dir=None, centroids=None, countries=None, reg=None, bbox=None, percentile=2.5, min_intensity=1, min_number_cells=1, min_days_per_month=1, yearrange=(2001, 2005), yearrange_ref=(1971, 2005), gh_model=None, cl_model=None, scenario='historical', scenario_ref='historical', soc='histsoc', soc_ref='histsoc', fn_str_var='co2_dis_global_daily', keep_dis_data=False, yearchunks='default', mask_threshold=('mean', 1))[source]

Wrapper to fill hazard from NetCDF file containing variable dis (daily), e.g. as provided from from ISIMIP Water Sectior (Global): https://esg.pik-potsdam.de/search/isimip/

Parameters
  • input_dir (string) – path to input data directory. In this folder, netCDF files with gridded hydrological model output are required, containing the variable dis (discharge) on a daily temporal resolution as f.i. provided by the ISIMIP project (https://www.isimip.org/)

  • centroids (Centroids) – centroids (area that is considered, reg and country must be None)

  • countries (list of countries ISO3) – selection of countries (reg must be None!) [not yet implemented]

  • reg (list of regions) – can be set with region code if whole areas are considered (if not None, countries and centroids are ignored) [not yet implemented]

  • bbox (tuple of four floats) – bounding box: (lon min, lat min, lon max, lat max)

  • percentile (float) – percentile used to compute threshold, 0.0 < percentile < 100.0

  • min_intensity (int) – minimum intensity (nr of days) in an event event; events with lower max. intensity are dropped

  • min_number_cells (int) – minimum spatial extent (nr of grid cells) in an event event; events with lower geographical extent are dropped

  • min_days_per_month (int) – minimum nr of days below threshold in a month; months with lower nr of days below threshold are not considered for the event creation (clustering)

  • yearrange (int tuple) – year range for hazard set, f.i. (2001, 2005)

  • yearrange_ref (int tuple) – year range for reference (threshold), f.i. (1971, 2000)

  • gh_model (str) – abbrev. hydrological model (only when input_dir is selected) f.i. ‘H08’, ‘CLM45’, ‘ORCHIDEE’, ‘LPJmL’, ‘WaterGAP2’, ‘JULES-W1’, ‘MATSIRO’

  • cl_model (str) – abbrev. climate model (only when input_dir is selected) f.i. ‘gfdl-esm2m’, ‘hadgem2-es’, ‘ipsl-cm5a-lr’, ‘miroc5’, ‘gswp3’, ‘wfdei’, ‘princeton’, ‘watch’

  • scenario (str) – climate change scenario (only when input_dir is selected) f.i. ‘historical’, ‘rcp26’, ‘rcp60’, ‘hist’

  • scenario_ref (str) – climate change scenario for reference (only when input_dir is selected)

  • soc (str) – socio-economic trajectory (only when input_dir is selected) f.i. ‘histsoc’, # historical trajectory ‘2005soc’, # constant at 2005 level ‘rcp26soc’, # RCP6.0 trajectory ‘rcp60soc’, # RCP6.0 trajectory ‘pressoc’ # constant at pre-industrial socio-economic level

  • soc_ref (str) – csocio-economic trajectory for reference, like soc. (only when input_dir is selected)

  • fn_str_var (str) – FileName STRing depending on VARiable and ISIMIP simuation round

  • keep_dis_data (boolean) – keep monthly data (variable ndays = days below threshold) as dataframe (attribute “data”) and save additional field ‘relative_dis’ (relative discharge compared to the long term)

  • yearchunks – list of year chunks corresponding to each nc flow file. If set to ‘default’, uses the chunking corresponding to the scenario.

  • mask_threshold – tuple with threshold value [1] for criterion [0] for mask: Threshold below which the grid is masked out. e.g.: (‘mean’, 1.) –> grid cells with a mean discharge below 1 are ignored (‘percentile’, .3) –> grid cells with a value of the computed percentile discharge values below 0.3 are ignored. default: (‘mean’, 1}). Set to None for no threshold. Provide a list of tuples for multiple thresholds.

Raises

NameError

Returns

hazard set with lowflow calculated from netcdf file containing discharge data

Return type

LowFlow

set_intensity_from_clusters(centroids=None, min_intensity=1, min_number_cells=1, yearrange=(2001, 2005), yearrange_ref=(1971, 2005), gh_model=None, cl_model=None, scenario='historical', scenario_ref='historical', soc='histsoc', soc_ref='histsoc', fn_str_var='co2_dis_global_daily', keep_dis_data=False)[source]

Build low flow hazards with events from clustering and centroids and (re)set attributes.

events_from_clusters(centroids)[source]

Initiate hazard events from connected clusters found in self.lowflow_df

Parameters

centroids (Centroids)

identify_clusters(clus_thresh_xy=None, clus_thresh_t=None, min_samples=None)[source]

call clustering functions to identify the clusters inside the dataframe

Parameters
  • clus_thresh_xy (int) – new value of maximum grid cell distance (number of grid cells) to be counted as connected points during clustering

  • clus_thresh_t (int) – new value of maximum timse step difference (months) to be counted as connected points during clustering

  • min_samples (int) – new value or minimum amount of data points in one cluster to retain the cluster as an event, smaller clusters will be ignored

Return type

pandas.DataFrame

filter_events(min_intensity=1, min_number_cells=1)[source]

Remove events with max intensity below min_intensity or spatial extend below min_number_cells

Parameters
  • min_intensity (int or float) – Minimum criterion for intensity

  • min_number_cells (int or float) – Minimum crietrion for number of grid cell

Return type

Hazard

climada_petals.hazard.relative_cropyield module

class climada_petals.hazard.relative_cropyield.RelativeCropyield(pool=None)[source]

Bases: climada.hazard.base.Hazard

Agricultural climate risk: Relative Cropyield (relative to historical mean); Each year corresponds to one hazard event; Based on modelled crop yield, from ISIMIP (www.isimip.org, required input data). Attributes as defined in Hazard and the here defined additional attributes.

crop_type

crop type (‘whe’ for wheat, ‘mai’ for maize, ‘soy’ for soybeans and ‘ric’ for rice)

Type

str

intensity_def

intensity defined as: ‘Yearly Yield’ [t/(ha*y)], ‘Relative Yield’, or ‘Percentile’

Type

str

__init__(pool=None)[source]

Empty constructor.

set_from_isimip_netcdf(*args, **kwargs)[source]

This function is deprecated, use RelativeCropyield.from_isimip_netcdf instead.

classmethod from_isimip_netcdf(input_dir=None, filename=None, bbox=None, yearrange=None, ag_model=None, cl_model=None, bias_corr=None, scenario=None, soc=None, co2=None, crop=None, irr=None, fn_str_var=None)[source]

Wrapper to fill hazard from crop yield NetCDF file. Build and tested for output from ISIMIP2 and ISIMIP3, but might also work for other NetCDF containing gridded crop model output from other sources.

Parameters
  • input_dir (Path or str) – path to input data directory, default: {CONFIG.exposures.crop_production.local_data}/Input/Exposure

  • filename (string) – name of netcdf file in input_dir. If filename is given, the other parameters specifying the model run are not required!

  • bbox (list of four floats) – bounding box: [lon min, lat min, lon max, lat max]

  • yearrange (int tuple) – year range for hazard set, f.i. (1976, 2005)

  • ag_model (str) – abbrev. agricultural model (only when input_dir is selected) f.i. ‘clm-crop’, ‘gepic’,’lpjml’,’pepic’

  • cl_model (str) – abbrev. climate model (only when input_dir is selected) f.i. [‘gfdl-esm2m’, ‘hadgem2-es’,’ipsl-cm5a-lr’,’miroc5’

  • bias_corr (str) – bias correction of climate forcing, f.i. ‘ewembi’ (ISIMIP2b, default) or ‘w5e5’ (ISIMIP3b)

  • scenario (str) – climate change scenario (only when input_dir is selected) f.i. ‘historical’ or ‘rcp60’ or ‘ISIMIP2a’

  • soc (str) – socio-economic trajectory (only when input_dir is selected) f.i. ‘2005soc’ or ‘histsoc’

  • co2 (str) – CO2 forcing scenario (only when input_dir is selected) f.i. ‘co2’ or ‘2005co2’

  • crop (str) – crop type (only when input_dir is selected) f.i. ‘whe’, ‘mai’, ‘soy’ or ‘ric’

  • irr (str) – irrigation type (only when input_dir is selected) f.i ‘noirr’ or ‘irr’

  • fn_str_var (str) – FileName STRing depending on VARiable and ISIMIP simuation round

Return type

RelativeCropyield

Raises

NameError

calc_mean(yearrange_mean=None, save=False, output_dir=None)[source]

Calculates mean of the hazard for a given reference time period

Parameters
  • yearrange_mean (array) – time period used to calculate the mean intensity default: 1976-2005 (historical)

  • save (boolean) – save mean to file? default: False

  • output_dir (str or Path) – path of output directory, default: {CONFIG.exposures.crop_production.local_data}/Output

Returns

contains mean value over the given reference time period for each centroid

Return type

hist_mean(array)

set_rel_yield_to_int(*args, **kwargs)[source]

This function is deprecated, use function rel_yield_to_int instead.

set_percentile_to_int(*args, **kwargs)[source]

This function is deprecated, use function percentile_to_int instead.

plot_intensity_cp(event=None, dif=False, axis=None, **kwargs)[source]

Plots intensity with predefined settings depending on the intensity definition

Parameters
  • event (int or str) – event_id or event_name

  • dif (boolean) – variable signilizing whether absolute values or the difference between future and historic are plotted (False: his/fut values; True: difference = fut-his)

  • axis (geoaxes) – axes to plot on

Return type

axes (geoaxes)

plot_time_series(event=None)[source]

Plots a time series of intensities (a series of sub plots)

Parameters

event (int or str) – event_id or event_name

Return type

figure

climada_petals.hazard.river_flood module

class climada_petals.hazard.river_flood.RiverFlood[source]

Bases: climada.hazard.base.Hazard

Contains flood events Flood intensities are calculated by means of the CaMa-Flood global hydrodynamic model

fla_event

total flooded area for every event

Type

1d array(n_events)

fla_annual

total flooded area for every year

Type

1d array (n_years)

fla_ann_av

average flooded area per year

Type

float

fla_ev_av

average flooded area per event

Type

float

fla_ann_centr

flooded area in every centroid for every event

Type

2d array(n_years x n_centroids)

fla_ev_centr

flooded area in every centroid for every event

Type

2d array(n_events x n_centroids)

__init__()[source]

Empty constructor

classmethod from_nc(dph_path=None, frc_path=None, origin=False, centroids=None, countries=None, reg=None, shape=None, ISINatIDGrid=False, years=None)[source]

Wrapper to fill hazard from nc_flood file

Parameters
  • dph_path (string) – Flood file to read (depth)

  • frc_path (string) – Flood file to read (fraction)

  • origin (bool) – Historical or probabilistic event

  • centroids (Centroids) – centroids to extract

  • countries (list of countries ISO3) – selection of countries (reg must be None!)

  • reg (list of regions) – can be set with region code if whole areas are considered (if not None, countries and centroids are ignored)

  • ISINatIDGrid (Bool) – Indicates whether ISIMIP_NatIDGrid is used

  • years (int list) – years that are considered

Returns

haz

Return type

RiverFlood instance

Raises

NameError

set_from_nc(*args, **kwargs)[source]

This function is deprecated, use RiverFlood.from_nc instead.

Function allows to exclude flood impacts that are caused in areas exposed discharge trends other than the selected one. (This function is only needed for very specific applications)

Raises

NameError

exclude_returnlevel(frc_path)[source]

Function allows to exclude flood impacts below a certain return level by manipulating flood fractions in a way that the array flooded more frequently than the treshold value is excluded. (This function is only needed for very specific applications)

Raises

NameError

set_flooded_area(save_centr=False)[source]
Calculates flooded area for hazard. sets yearly flooded area and

flooded area per event

Raises

MemoryError

set_flood_volume(save_centr=False)[source]
Calculates flooded area for hazard. sets yearly flooded area and

flooded area per event

Raises

MemoryError

climada_petals.hazard.tc_rainfield module

class climada_petals.hazard.tc_rainfield.TCRain(pool=None)[source]

Bases: climada.hazard.base.Hazard

Contains rainfall from tropical cyclone events.

intensity_thres = 0.1

intensity threshold for storage in mm

__init__(pool=None)[source]

Empty constructor.

set_from_tracks(*args, **kwargs)[source]

This function is deprecated, use TCRain.from_tracks instead.

classmethod from_tracks(tracks, centroids=None, dist_degree=3, description='', pool=None, intensity_thres=None)[source]

Computes rainfield from tracks based on the RCLIPER model. Parallel process.

Parameters
  • tracks (TCTracks) – tracks of events

  • centroids (Centroids, optional) – Centroids where to model TC. Default: global centroids.

  • disr_degree (int) – distance (in degrees) from node within which the rainfield is processed (default 3 deg,~300km)

  • description (str, optional) – description of the events

  • pool (pathos.pool, optional) – Pool that will be used for parallel computation of wind fields. Default: None

  • intensity_thres (float, optional) – Wind speeds (in mm) below this threshold are stored as 0. Default: .1

Returns

haz – New TCRain object with data from tracks.

Return type

TCRain

climada_petals.hazard.tc_surge_bathtub module

class climada_petals.hazard.tc_surge_bathtub.TCSurgeBathtub[source]

Bases: climada.hazard.base.Hazard

TC surge heights in m, a bathtub model with wind-surge relationship and inland decay.

__init__()[source]

Initialize values.

Parameters
  • haz_type (str, optional) – acronym of the hazard type (e.g. ‘TC’).

  • pool (pathos.pool, optional) – Pool that will be used for parallel computation when applicable. Default: None

Examples

Fill hazard values by hand:

>>> haz = Hazard('TC')
>>> haz.intensity = sparse.csr_matrix(np.zeros((2, 2)))
>>> ...

Take hazard values from file:

>>> haz = Hazard.from_mat(HAZ_DEMO_MAT, 'demo')
static from_tc_winds(wind_haz, topo_path, inland_decay_rate=0.2, add_sea_level_rise=0.0)[source]

Compute tropical cyclone surge from input winds.

Parameters
  • wind_haz (TropCyclone) – Tropical cyclone wind hazard object.

  • topo_path (str) – Path to a raster file containing gridded elevation data.

  • inland_decay_rate (float, optional) – Decay rate of surge when moving inland in meters per km. Set to 0 to deactivate this effect. The default value of 0.2 is taken from Section 5.2.1 of the monograph Pielke and Pielke (1997): Hurricanes: their nature and impacts on society. https://rogerpielkejr.com/2016/10/10/hurricanes-their-nature-and-impacts-on-society/

  • add_sea_level_rise (float, optional) – Sea level rise effect in meters to be added to surge height.

climada_petals.hazard.tc_tracks_forecast module

class climada_petals.hazard.tc_tracks_forecast.TCForecast(pool=None)[source]

Bases: climada.hazard.tc_tracks.TCTracks

An extension of the TCTracks construct adapted to forecast tracks obtained from numerical weather prediction runs.

data

Same as in parent class, adding the following attributes - ensemble_member (int) - is_ensemble (bool; if False, the simulation is a high resolution deterministic run

Type

list of xarray.Dataset

fetch_ecmwf(path=None, files=None, target_dir=None, remote_dir=None)[source]

Fetch and read latest ECMWF TC track predictions from the FTP dissemination server into instance. Use path or files argument to use local files instead.

Assumes file naming conventions consistent with ECMWF: all files are assumed to have ‘tropical_cyclone’ and ‘ECEP’ in their name, denoting tropical cyclone ensemble forecast files.

Parameters
  • path (str, list(str), optional) – A location in the filesystem. Either a path to a single BUFR TC track file, or a folder containing only such files, or a globbing pattern. Passed to climada.util.files_handler.get_file_names

  • files (file-like, optional) – An explicit list of file objects, bypassing get_file_names

  • target_dir (str, optional) – An existing directory in the filesystem. When set, downloaded BUFR files will be saved here, otherwise they will be downloaded as temporary files.

  • remote_dir (str, optional) – If set, search the ECMWF FTP folder for forecast files in the directory; otherwise defaults to the latest. Format: yyyymmddhhmmss, e.g. 20200730120000

static fetch_bufr_ftp(target_dir=None, remote_dir=None)[source]

Fetch and read latest ECMWF TC track predictions from the FTP dissemination server. If target_dir is set, the files get downloaded persistently to the given location. A list of opened file-like objects gets returned.

Parameters
  • target_dir (str) – An existing directory to write the files to. If None, the files get returned as tempfiles.

  • remote_dir (str, optional) – If set, search this ftp folder for forecast files; defaults to the latest. Format: yyyymmddhhmmss, e.g. 20200730120000

Return type

[filelike]

read_one_bufr_tc(file, id_no=None)[source]

Read a single BUFR TC track file tailored to the ECMWF TC track predictions format.

Parameters
  • file (str, filelike) – Path object, string, or file-like object

  • id_no (int) – Numerical ID; optional. Else use date + random int.

static get_value_from_bufr_array(var)[source]

climada_petals.hazard.wildfire module

class climada_petals.hazard.wildfire.WildFire[source]

Bases: climada.hazard.base.Hazard

Contains wild fire events.

Wildfires comprise the challenge that the definition of an event is unclear. Reporting standards vary accross regions and over time. Hence, to have consistency, we consider an event as a whole fire season. A fire season is defined as a whole year (Jan-Dec in the NHS, Jul-Jun in SHS). This allows consistent risk assessment across the globe and over time. Hazard for which events refer to a fire season have the tag ‘WFseason’.

In order to perform concrete case studies or calibrate impact functions, events can be displayed as single fires. In that case they have the tag ‘WFsingle’.

date_end

integer date corresponding to the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1 (ordinal format of datetime library). Represents last day of a wild fire instance where the fire was still active.

Type

array

n_fires

number of single fires in a fire season

Type

array

__init__()[source]

Empty constructor.

class FirmsParams(clean_thresh: int = 30, days_thres_firms: int = 2, clus_thres_firms: int = 15, remove_minor_fires_firms: bool = True, minor_fire_thres_firms: int = 3)[source]

Bases: object

DataClass as container for firms parameters.

clean_thresh

Minimal confidence value for the data from MODIS instrument to be use as input

Type

int, default = 30

days_thres_firms

Minimum number of days to consider different fires

Type

int, default = 2

clus_thres_firms

Clustering factor which multiplies instrument resolution

Type

int, default = 15

remove_minor_fires_firms

removes FIRMS fires below defined theshold of entries

Type

bool, default = True

minor_fire_thres_firms

number of FIRMS entries required to be considered a fire

Type

int, default = 3

clean_thresh: int = 30
days_thres_firms: int = 2
clus_thres_firms: int = 15
remove_minor_fires_firms: bool = True
minor_fire_thres_firms: int = 3
__init__(clean_thresh: int = 30, days_thres_firms: int = 2, clus_thres_firms: int = 15, remove_minor_fires_firms: bool = True, minor_fire_thres_firms: int = 3) None
class ProbaParams(blurr_steps: int = 4, prop_proba: float = 0.21, max_it_propa: int = 500000)[source]

Bases: object

DataClass as container for parameters for generation of probabilistic events.

PLEASE BE AWARE: Parameter values did not undergo any calibration.

blurr_steps

steps with exponential decay for fire propagation matrix

Type

int, default = 4

prop_proba
Type

float, default = 0.21

max_it_propa
Type

float, default = 500000

blurr_steps: int = 4
prop_proba: float = 0.21
max_it_propa: int = 500000
__init__(blurr_steps: int = 4, prop_proba: float = 0.21, max_it_propa: int = 500000) None
classmethod from_hist_fire_FIRMS(df_firms, centr_res_factor=1.0, centroids=None)[source]

Parse FIRMS data and generate historical fires by temporal and spatial clustering. Single fire events are defined as a set of data points that are geographically close and/or have consecutive dates. The unique identification is made in two steps. First a temporal clustering is applied to cleaned data obtained from FIRMS. Data points with acquisition dates more than days_thres_firms days apart are in different temporal clusters. Second, for each temporal cluster, unique event are identified by performing a spatial clustering. This is done iteratively until all firms data points are assigned to an event.

This method sets the attributes self.n_fires, self.date_end, in addition to all attributes required by the hazard class.

This method creates a centroids raster if centroids=None with resolution given by centr_res_factor. The centroids can be retrieved from Wildfire.centroids()

Parameters
  • df_firms (pd.DataFrame) – FIRMS data as pd.Dataframe (https://firms.modaps.eosdis.nasa.gov/download/)

  • centr_res_factor (float, optional, default=1.0) – resolution factor with respect to the satellite data to use for centroids creation. Hence, if MODIS data (1 km res) is used and centr_res_factor is set to 0.2, the grid spacing of the generated centroids will equal 5 km (=1/0.2). If centroids are defined, this parameter has no effect.

  • centroids (Centroids, optional) – centroids in degrees to map data, centroids need to be on a regular raster grid in order for the clustrering to work.

Returns

haz

Return type

WildFire instance

set_hist_fire_FIRMS(*args, **kwargs)[source]

This function is deprecated, use WildFire.from_hist_fire_FIRMS instead.

classmethod from_hist_fire_seasons_FIRMS(df_firms, centr_res_factor=1.0, centroids=None, hemisphere=None, year_start=None, year_end=None, keep_all_fires=False)[source]

Parse FIRMS data and generate historical fire seasons.

Individual fires are created using temporal and spatial clustering according to the ‘set_hist_fire_FIRMS’ method. single fires are then summarized to seasons using max intensity at each centroid for each year.

This method sets the attributes self.n_fires, self.date_end, in addition to all attributes required by the hazard class.

This method creates a centroids raster if centroids=None with resolution given by centr_res_factor. The centroids can be retrieved from Wildfire.centroids()

Parameters
  • df_firms (pd.DataFrame) – FIRMS data as pd.Dataframe (https://firms.modaps.eosdis.nasa.gov/download/)

  • centr_res_factor (float, optional, default=1.0) – resolution factor with respect to the satellite data to use for centroids creation

  • centroids (Centroids, optional) – centroids in degrees to map data, centroids need to be on a regular grid in order for the clustrering to work.

  • hemisphere (str, optional) – ‘SHS’ or ‘NHS’ to define fire seasons. The hemisphere parameter is only used for the definition of the start of the fire season

  • year_start (int, optional) – start year; FIRMS fires before that are cut; no cut if not specified

  • year_end (int, optional) – end year; FIRMS fires after that are cut; no cut if not specified

  • keep_all_fires (bool, optional) – keep list of all individual fires; default is False to save memory. If set to true, fires are stored in self.hist_fire_seasons

Returns

haz

Return type

WildFire instance

set_hist_fire_seasons_FIRMS(*args, **kwargs)[source]

This function is deprecated, use WildFire.from_hist_fire_seasons_FIRMS instead.

set_proba_fire_seasons(n_fire_seasons=1, n_ignitions=None, keep_all_fires=False)[source]

Generate probabilistic fire seasons.

Fire seasons are created by running n probabilistic fires per year which are then summarized into a probabilistic fire season by calculating the max intensity at each centroid for each probabilistic fire season. Probabilistic fires are created using the logic described in the method ‘_run_one_bushfire’.

The fire propagation matrix can be assigned separately, if that is not done it will be generated on the available historic fire (seasons).

Intensities are drawn randomly from historic events. Thus, this method requires at least one fire to draw from.

This method modifies self (climada.hazard.WildFire instance) by adding probabilistic wildfire seasons.

Parameters
  • self (climada.Hazard.WildFire) – must have calculated historic fire seasons before

  • n_fire_seasons (int, optional) – number of fire seasons to be generated

  • n_ignitions (array, optional) – [min, max]: min/max of uniform distribution to sample from, in order to determin n_fire per probabilistic year set. If none, min/max is taken from hist.

  • keep_all_fires (bool, optional) – keep detailed list of all fires; default is False to save memory.

combine_fires(event_id_merge=None, remove_rest=False, probabilistic=False)[source]

Combine events that are identified as different fire to one event

Orig fires are removed and a new fire id created; max intensity at overlapping centroids is assigned.

This method modifies self (climada.hazard.WildFire instance) by combining single fires.

Parameters
  • event_id_merge (array of int, optional) – events to be merged

  • remove_rest (bool, optional) – if set to true, only the merged event is returned.

  • probabilistic (bool, optional) – differentiate, because probabilistic events have no date.

summarize_fires_to_seasons(year_start=None, year_end=None, hemisphere=None)[source]

Summarize historic fires into fire seasons.

Fires are summarized by taking the max intensity at each grid point.

This method modifies self (climada.hazard.WildFire instance) by summarizing individual fires into seasons.

Parameters
  • year_start (int, optional) – start year; fires before that are cut; no cut if not specified

  • year_end (int, optional) – end year; fires after that are cut; no cut if not specified

  • hemisphere (str, optional) – ‘SHS’ or ‘NHS’ to define fire seasons

plot_fire_prob_matrix()[source]

Plots fire propagation probability matrix as contour plot. At this point just to check the matrix but could easily be improved to normal map.

Parameters

self (climada.hazard.WildFire instance)

Returns

contour plot – contour plot of fire_propa_matrix

Return type

plt