Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Probability Cumulative

Kelvin edited this page Oct 28, 2020 · 12 revisions

Probability Cumulative Method

probability.get_cumulative(
    search_items, 
    csv=False, 
    output_dir='/output'
)

Returns an array of ProbabilityCumulative product for the given property IDs. Only property IDs are accepted. Optionally creates a csv file.

Arguments:

  • search_items: list/file of SearchItems, property parcels to retrieve probability cumulative for.
  • csv: bool, whether to create a CSV for the retrieved data.
  • output_dir: string, location to output the created CSV (if csv is True).

Example (Command Line):

# Call probability.get_cumulative on a list with 2 FSIDs
python -m firststreet -p probability.get_cumulative -i 190836953;392804911

# Call probability.get_cumulative on a file of SearchItems
python -m firststreet -p probability.get_cumulative -f sample.txt

Example (Python File):

# Contents of sample.py
# Create a `FirstStreet` object.  
import firststreet
fs = firststreet.FirstStreet("api-key")

# Call probability.get_cumulative on a list with 2 property FSIDs
probability_cumulative = fs.probability.get_cumulative([190836953, 193139123])

# Call probability.get_cumulative on a file of SearchItems
probability_cumulative = fs.probability.get_cumulative("sample.txt", csv=True)

Probability Cumulative Objects

ProbabilityCumulative Object

Key Type Description Example
fsid int First Street ID (FSID) is a unique identifier assigned to each location. 392804911
valid_id bool Whether the input FSID returned valid data from the server. True
cumulative Array of dict The risk likelihood (% probability) for flooding to the building footprint broken down by depth threshold and cumulative year. The low, mid, high likelihood is returned as an array of dictionary within the associated threshold and cumulative year. Available depth thresholds include >0cm, >15cm, and >30cm, returned as an array of dictionary and are broken down by the following cumulative years within the array of dictionary - 2035, and 2050, where 2035=15 years and 2050=30 years. See below

Cumulative Dictionary

Key Type Description Example
year int The cumulative year (where 2020 = current annual risk, 2025 = risk over 5 years, 2030 = risk over 10 years, in 5 year increments up through 2050, where 2050 = risk over 30 years) the probability was calculated for. 2035
data Array of Dict A collection of Cumulative Data See below

Cumulative Data

Key Type Description Example
threshold string The depth threshold in centimeters (0, 15cm, or 30cm) that the probability was calculated for. 0
data List Threshold Data object See below

Threshold Data

Key Type Description Example
low int The likelihood (% probability) of flooding given as a value from 0-1 (rounded to two decimal places), at the specified depth, over the cumulative period of time, based on the low scenario of the RCP 4.5 emissions curve. 26
mid int The likelihood (% probability) of flooding given as a value from 0-1 (rounded to two decimal places), at the specified depth, over the cumulative period of time, based on the mid scenario of the RCP 4.5 emissions curve. 34
high int The likelihood (% probability) of flooding given as a value from 0-1 (rounded to two decimal places), at the specified depth, over the cumulative period of time, based on the high scenario of the RCP 4.5 emissions curve. 45

Clone this wiki locally