This repository was archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Probability Count
Kelvin edited this page May 20, 2021
·
11 revisions
probability.get_count(
search_items,
location_type,
csv=False,
output_dir='/output'
)
Delivers the total count of properties with flood risk within the location broken down by depth threshold, return period and year.
This method returns an array of ProbabilityCount
product for the given IDs. All location types EXCEPT property IDs are accepted. Optionally creates a csv file.
(More information on the Probability Count product can be found on the Probability Count Page on the First Street Foundation API Data Dictionary)
-
search_items:
list/file of SearchItems
, non-property parcels to retrieve probability count for. -
location_type:
string
, one of{neighborhood, city, zcta, tract, county, cd, state}
, for the search item type. -
csv:
bool
, whether to create a CSV for the retrieved data. -
output_dir:
string
, location to output the created CSV (ifcsv
is True).
python -m firststreet -p probability.get_count -s 7924;631054 -l neighborhood
python -m firststreet -p probability.get_count -s 1935265;3958002 -l city
python -m firststreet -p probability.get_count -s 50158;43935 -l zcta
python -m firststreet -p probability.get_count -s 39061007100;39153531702 -l tract
python -m firststreet -p probability.get_count -s 19047;39027 -l county
python -m firststreet -p probability.get_count -s 3903;3915 -l cd
python -m firststreet -p probability.get_count -s 19;39 -l state
python -m firststreet -p probability.get_count -s 37.16314,-76.55782;38.50303,-106.72863 -l county
python -m firststreet -p probability.get_count -s "New York";"Ohio" -l state
python -m firststreet -p probability.get_count -s sample_property.txt -l property
python -m firststreet -p probability.get_count -s sample_neighborhood.txt -l neighborhood
python -m firststreet -p probability.get_count -s sample_city.txt -l city
python -m firststreet -p probability.get_count -s sample_zcta.txt -l zcta
python -m firststreet -p probability.get_count -s sample_tract.txt -l tract
python -m firststreet -p probability.get_count -s sample_county.txt -l county
python -m firststreet -p probability.get_count -s sample_cd.txt -l cd
python -m firststreet -p probability.get_count -s sample_state.txt -l state
# Contents of sample.py
# Create a `FirstStreet` object.
import firststreet
fs = firststreet.FirstStreet("api-key")
# Call probability.get_count on a list of FSIDs
probability_count = fs.probability.get_count(search_items=[7924, 631054], location_type="neighborhood", csv=True)
probability_count = fs.probability.get_count(search_items=[1935265, 3958002], location_type="city", csv=True)
probability_count = fs.probability.get_count(search_items=[50158, 43935], location_type="zcta", csv=True)
probability_count = fs.probability.get_count(search_items=[39061007100, 39153531702], location_type="tract", csv=True)
probability_count = fs.probability.get_count(search_items=[19047, 39027], location_type="county", csv=True)
probability_count = fs.probability.get_count(search_items=[3903, 3915], location_type="cd", csv=True)
probability_count = fs.probability.get_count(search_items=[19, 39], location_type="state", csv=True)
# Call probability_count on a lat/lng or address
probability_count = fs.probability.get_count(search_items=[(37.16314,-76.55782)], location_type="county", csv=True)
probability_count = fs.probability.get_count(search_items=["New York"], location_type="state", csv=True)
# Call probability.get_count on a file of SearchItems
probability_count = fs.probability.get_count(search_items="sample_neighborhood.txt", location_type="neighborhood", csv=True)
probability_count = fs.probability.get_count(search_items="sample_city.txt", location_type="city", csv=True)
probability_count = fs.probability.get_count(search_items="sample_zcta.txt", location_type="zcta", csv=True)
probability_count = fs.probability.get_count(search_items="sample_tract.txt", location_type="tract", csv=True)
probability_count = fs.probability.get_count(search_items="sample_county.txt", location_type="county", csv=True)
probability_count = fs.probability.get_count(search_items="sample_cd.txt", location_type="cd", csv=True)
probability_count = fs.probability.get_count(search_items="sample_state.txt", location_type="state", csv=True)
Key | Type | Description | Example |
---|---|---|---|
fsid | str | 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 |
count | Array[dict] | The total count of properties with flood risk within the location broken down by depth threshold, return period and year. The low, mid, high count is returned as an array of dictionary within the associated threshold, return period and year. Available depth bins returned as an array of dict begin at 0-5cm of flooding (displayed as "0") and are provided in 5 cm increments up to 120-125cm of flooding (displayed as "120"). Everything with greater than 125cm of flooding is bulked together at 125. Depth bins are broken down by the following return periods as an array of dictionary - 500, 250, 100, 20, 5, and 2 years. The years available within the an array of dictionary model are 2020 and 2050. | See below |
Key | Type | Description | Example |
---|---|---|---|
year | int | The year (2020 or 2050) the probability was calculated for. | 2020 |
data | Array[dict] | A collection of Probability Count Data | See below |
Key | Type | Description | Example |
---|---|---|---|
returnPeriod | int | The return period (500, 100, 20, 5, or 2 years) that the depth was calculated for. 2 year return period is only available in coastal areas. | 500 |
data | Array[dict] | A collection of Probability Bin Count Data | See below |
Key | Type | Description | Example |
---|---|---|---|
threshold | string | The depth of flooding (in centimeters) that the probability was calculated for. Available depth bins begin at 0-5cm of flooding (displayed as “0”) and are provided in 5 cm increments up to 120-125cm of flooding (displayed as “120"). Everything with greater than 125cm of flooding is bulked together at 125. Flood depth is calculated at the lowest elevation of the building footprint (largest if more than 1 exists, or property centroid where footprint does not exist). | 0 |
data | Dict | Depth Count Bin Data | See below |
Key | Type | Description | Example |
---|---|---|---|
low | int | The total count of properties that exist in that return period and depth bin, based on the low scenario of the RCP 4.5 emissions curve. | 125 |
mid | int | The total count of properties that exist in that return period and depth bin, based on the mid scenario of the RCP 4.5 emissions curve. | 150 |
high | int | The total count of properties that exist in that return period and depth bin, based on the high scenario of the RCP 4.5 emissions curve. | 175 |
-
Installation
-
Usage
-
Products
-
Update