data.GHCNDaily¶
Global
Import path: earth2studio.data.GHCNDaily
Documentation¶
Bases: _GHCNBase
NOAA's Global Historical Climatology Network Daily (GHCN-D) is a dataset that contains daily climate summaries from land surface stations across the globe.
Parameters:
-
stations(list[str]) –GHCN station IDs (11-character strings, e.g.
"USW00023273") to attempt to fetch data from. -
time_tolerance(TimeTolerance, default:timedelta64(0)) –Time tolerance window for filtering observations. Accepts a single value (symmetric +/- window) or a tuple (lower, upper) for asymmetric windows, by default np.timedelta64(0)
-
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
GHCNDaily.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 ghcnd-stations.txt which can be accessed with
GHCNDaily.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 (column ids) to return. Must be in the GHCNDaily lexicon.
-
fields(str | list[str] | Schema | None, default:None) –Fields to include in output, by default None (all fields).
Returns:
-
DataFrame–GHCN data frame
available
classmethod
¶
available(time: datetime | datetime64) -> bool
Check if given date time is available by verifying the partition exists on S3.
Parameters:
-
time(datetime | datetime64) –Date time to check
Returns:
-
bool–If date time is available