-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from openearthplatforminitiative/feat/text-abo…
…ut-flood-api feat: add flood description and examples
- Loading branch information
Showing
8 changed files
with
176 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const response = await fetch( | ||
'https://api-test.openepi.io/flood/summary?' + | ||
new URLSearchParams({ | ||
lon: '33.575897', | ||
lat: '-1.375532', | ||
}) | ||
); | ||
const json = await response.json(); | ||
|
||
// Get the minimum forecasted discharge | ||
const minDischarge = json.queried_location.features[0].properties.min_dis; | ||
|
||
console.log(`Minimum forecasted discharge: ${minDischarge}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from httpx import Client | ||
|
||
with Client() as client: | ||
response = client.get( | ||
url="https://api-test.openepi.io/flood/detailed", | ||
params={"lon": 33.575897, "lat": -1.375532}, | ||
) | ||
|
||
# Get the minimum forecasted discharge | ||
json = response.json() | ||
peak_day = json["queried_location"]["features"][0]["properties"]["min_dis"] | ||
|
||
print(f"Minimum forecasted discharge: {peak_day}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const response = await fetch( | ||
'https://api-test.openepi.io/flood/summary?' + | ||
new URLSearchParams({ | ||
lon: '33.575897', | ||
lat: '-1.375532', | ||
}) | ||
); | ||
const json = await response.json(); | ||
|
||
// Get the forecasted peak day | ||
const peakDay = json.queried_location.features[0].properties.peak_day; | ||
|
||
console.log(`Forecasted peak day: ${peakDay}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from httpx import Client | ||
|
||
with Client() as client: | ||
response = client.get( | ||
url="https://api-test.openepi.io/flood/summary", | ||
params={"lon": 33.575897, "lat": -1.375532}, | ||
) | ||
|
||
# Get the forecasted peak day | ||
json = response.json() | ||
peak_day = json["queried_location"]["features"][0]["properties"]["peak_day"] | ||
|
||
print(f"Forecasted peak day: {peak_day}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const response = await fetch( | ||
'https://api-test.openepi.io/flood/threshold?' + | ||
new URLSearchParams({ | ||
lon: '33.575897', | ||
lat: '-1.375532', | ||
}) | ||
); | ||
const json = await response.json(); | ||
|
||
// Get the 2-year return period threshold | ||
const threshold2y = json.queried_location.features[0].properties.threshold_2y; | ||
|
||
console.log(`2-year return period threshold in m^3/s: ${threshold2y} m^3/s`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from httpx import Client | ||
|
||
with Client() as client: | ||
response = client.get( | ||
url="https://api-test.openepi.io/flood/threshold", | ||
params={"lon": 33.575897, "lat": -1.375532}, | ||
) | ||
|
||
# Get the 2-year return period threshold | ||
json = response.json() | ||
threshold_2y = json["queried_location"]["features"][0]["properties"]["threshold_2y"] | ||
|
||
print(f"2-year return period threshold: {threshold_2y} m^3/s") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters