data.GHCNHourly¶
Global
Import path: earth2studio.data.GHCNHourly
Documentation¶
Bases: _GHCNBase
NOAA's Global Historical Climatology Network Hourly (GHCNh) is a global database of hourly surface observations that supersedes the Integrated Surface Database (ISD). It compiles observations from thousands of stations worldwide into a common data model with consistent CSV encoding.
Parameters:
-
stations(list[str]) –Station IDs in GHCN station format (11 characters), e.g.
"USW00013874"for Atlanta Hartsfield-Jackson. UseGHCNHourly.get_stations_bboxto discover IDs by geographic area. -
time_tolerance(TimeTolerance, default:timedelta64(10, 'm')) –Time tolerance window for filtering observations. Accepts a single value (symmetric ± window) or a tuple (lower, upper) for asymmetric windows, by default np.timedelta64(10, 'm')
-
cache(bool, default:True) –Cache data source on local memory, by default True
-
verbose(bool, default:True) –Print download progress and missing data warnings, by default True
-
async_timeout(int, default:600) –Time in sec after which download will be cancelled if not finished successfully, by default 600
-
async_workers(int, default:16) –Maximum number of concurrent async fetch tasks, by default 16
-
retries(int, default:3) –Number of retry attempts per failed fetch task with exponential backoff, by default 3
Warning
This is a remote data source and can potentially download a large amount of data to your local machine for large requests.
Note
To help get a list of possible station IDs, this class includes
GHCNHourly.get_stations_bbox which accepts a lat-lon bounding box and
will return known station IDs. For more information on the stations, users
should consult the ghcnh-station-list.csv file accessible via
GHCNHourly.get_station_metadata.
Note
Additional information on the data repository can be referenced here:
Example
__call__ ¶
__call__(
time: datetime | list[datetime] | TimeArray,
variable: str | list[str] | VariableArray,
fields: str | list[str] | Schema | None = None,
) -> DataFrame
Function to get data.
Parameters:
-
time(datetime | list[datetime] | TimeArray) –Timestamps to return data for (UTC).
-
variable(str | list[str] | VariableArray) –String, list of strings or array of strings that refer to variables to return.
-
fields(str | list[str] | Schema | None, default:None) –Fields to include in output, by default None (all fields).
Returns:
-
DataFrame–Data frame
fetch
async
¶
fetch(
time: datetime | list[datetime] | TimeArray,
variable: str | list[str] | VariableArray,
fields: str | list[str] | Schema | None = None,
) -> DataFrame
Async function to get data.
Parameters:
-
time(datetime | list[datetime] | TimeArray) –Timestamps to return data for (UTC).
-
variable(str | list[str] | VariableArray) –String, list of strings or array of strings that refer to variables to return. Must be in the GHCNh lexicon.
-
fields(str | list[str] | Schema | None, default:None) –Fields to include in output, by default None (all fields).
Returns:
-
DataFrame–GHCNh data frame
available
classmethod
¶
available(time: datetime | datetime64) -> bool
Check if the given date time is available for this data source.
Parameters:
-
time(datetime | datetime64) –Date time to check
Returns:
-
bool–If date time is available