Skip to content

Commit

Permalink
Add reader for Operational Global Hydro-Estimator Satellite Rainfall …
Browse files Browse the repository at this point in the history
…Estimates
  • Loading branch information
uba committed Nov 7, 2024
1 parent 9a4a95d commit 0f7b8a6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tathu/satellite/ghe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# This file is part of TATHU - Tracking and Analysis of Thunderstorms.
# Copyright (C) 2022 INPE.
#
# TATHU - Tracking and Analysis of Thunderstorms is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#

import numpy as np
from netCDF4 import Dataset

from tathu.utils import array2raster

'''
Operational Hydro-Estimator Satellite Rainfall Estimates
https://noaa-ghe-pds.s3.amazonaws.com/index.html#rain_rate
'''

# Date format
DATE_REGEX = '\d{12}'
DATE_FORMAT = '%Y%m%d%H%M' # e.g. 2018040813 => 08 April 2018 - 13:00 UTC
GLOBAL_EXTENT = [-180.0, -65.0, 180.0, 65.0]

def sat2grid(path):
nc = Dataset(path)
data = nc.variables['rain'][:]
data = np.ma.masked_where(data < nc.variables['rain'].valid_range[0], data)
data = np.ma.masked_where(data > nc.variables['rain'].valid_range[1], data)
return array2raster(data, GLOBAL_EXTENT, nodata=nc.variables['rain']._FillValue)

0 comments on commit 0f7b8a6

Please sign in to comment.