Skip to content

Commit

Permalink
scale precipitation value, add data description in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
p-phung committed Dec 5, 2024
1 parent 7fd100c commit 110f738
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
Near real-time rainfall monitoring. Part of the project RIPOSTE for Cameroon Red Cross Society.

## Description
The pipeline roughly consists of three steps:
Data consumed:
- Level 3 IMERG Early Run: PPS Near Real-time, see https://gpm.nasa.gov/data/directory
- Value: 1-day precipitation accumulation (mm)
- Link to download: https://jsimpsonhttps.pps.eosdis.nasa.gov/imerg/gis/early/
- Temporal range: most recent past days (e.g. last 14 days)

- Extract daily data on rainfall measurement of the past days (e.g. last 14 days) from [NOAA's GPM](https://gpm.nasa.gov/data/directory)
The pipeline roughly consists of three steps:
- Extract the 1-day data on rainfall measurement as above.
- Transform the data into pre-defined areas (health districts) and calculate average rainfall of the past days. Then determine which area has its average rainfall higher than pre-defined thresholds.
- Send this data as alert to the EspoCRM for the NS.

Expand Down
3 changes: 2 additions & 1 deletion nrt_rainfall_pipeline/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def compute_rainfall(self, country: str, dateend):

def __calculate_average_raster(self):
"""
Scale precipitation x0.1
Sum precipiatation per cell of all raster files and take average per cell
"""
all_files = glob.glob(f'{self.inputGPM}/{self.country}_*.tif')
Expand All @@ -68,7 +69,7 @@ def __calculate_average_raster(self):
with rasterio.open(f) as src:
result_profile = src.profile
result_array = result_array + src.read()
result_array = result_array/n
result_array = result_array*0.1/n

file_name = f"{self.country}_{self.datestart.strftime('%Y-%m-%d')}_{self.dateend.strftime('%Y-%m-%d')}"
with rasterio.open(f"{self.inputGPM}/{file_name}.tif", 'w', **result_profile) as dst:
Expand Down

0 comments on commit 110f738

Please sign in to comment.