metobs_toolkit.station.Station.get_gee_timeseries_data#

Station.get_gee_timeseries_data(gee_manager: GEEDynamicDatasetManager, startdt_utc: datetime | Timestamp | str | None = None, enddt_utc: datetime | Timestamp | str | None = None, obstypes: list = ['temp'], get_all_bands: bool = False, drive_filename: str = None, drive_folder: str = 'gee_timeseries_data', force_direct_transfer: bool = False, force_to_drive: bool = False, initialize_gee: bool = True) DataFrame | None[source]#

Extract time series data from GEE.

Extracts time series (extraction at station locations) data from a Google Earth Engine (GEE) dynamic dataset for a specified time range and observation types.

If the data request is small, GEE sends the data directly. If not, the data will be written to a CSV file and saved on your Google Drive. In this case, you can import the model data by using the Dataset.import_gee_data_from_file() method.

Parameters:
  • gee_manager (GEEDynamicDatasetManager) – The dynamic dataset manager instance describing the target GEE dataset.

  • startdt_utc (datetime or str, optional) – The start datetime in UTC for the time series data. If None, the station’s start datetime (converted to UTC) is used.

  • enddt_utc (datetime or str, optional) – The end datetime in UTC for the time series data. If None, the station’s end datetime (converted to UTC) is used.

  • obstypes (list of str, optional) – List of observation types to extract. Defaults to [“temp”].

  • get_all_bands (bool, optional) – If True, extracts all bands from the dataset. Defaults to False.

  • drive_filename (str, optional) – The filename of the CSV file to use when saving the data to Google Drive. If None, a default name is generated.

  • drive_folder (str, optional) – The folder name in Google Drive where the file will be saved. Defaults to “gee_timeseries_data”.

  • force_direct_transfer (bool, optional) – If True, forces direct data transfer instead of using Google Drive. Defaults to False.

  • force_to_drive (bool, optional) – If True, forces saving the data to Google Drive. Defaults to False.

  • initialize_gee (bool, optional) – If True, initialize the Google Earth Engine API before fetching data. Default is True.

Returns:

A DataFrame containing the extracted time series data. Returns None if no data is retrieved.

Return type:

pandas.DataFrame or None

Note

If a timezone-unaware datetime is given as an argument, it is interpreted as if it has the same timezone as the observations.

Warning

This method makes use of the GEE API. Make sure that you have access and user rights to use the GEE API.

Warning

When extracting large amounts of data, the time series data will be written to a file and saved on your Google Drive. In this case, you can import the model data by using the Dataset.import_gee_data_from_file() method.

Notes

  • The method creates ModelTimeSeries instances for each valid observation type in the extracted data and appends them to the station’s model data.

  • If no data is returned by the GEE API request, a warning is logged and the method returns None.