<jupyter_start><jupyter_text>Time serie<jupyter_code>import pandas as pd

def ee_array_to_df(arr, list_of_bands):
    """Transforms client-side ee.Image.getRegion array to pandas.DataFrame."""
    df = pd.DataFrame(arr)

    # Rearrange the header.
    headers = df.iloc[0]
    df = pd.DataFrame(df.values[1:], columns=headers)

    # Remove rows without data inside.
    df = df[['longitude', 'latitude', 'time', *list_of_bands]].dropna()

    # Convert the data to numeric values.
    for band in list_of_bands:
        df[band] = pd.to_numeric(df[band], errors='coerce')

    # Convert the time field into a datetime.
    df['datetime'] = pd.to_datetime(df['time'], unit='ms')

    # Keep the columns of interest.
    df = df[['time','datetime',  *list_of_bands]]

    return df
import geopandas as gpd
fpath_hotspots = 'methane_hotspots_start_date=2021-03-01_end_date=2021-03-04.geojson'
hotspots = gpd.read_file(fpath_hotspots)<jupyter_output><empty_output><jupyter_text>Timeseries<jupyter_code>start_date="2021-02-01"
end_date = "2021-04-01"
roi = ee.Geometry.Polygon(list(hotspots.iloc[1].geometry.exterior.coords))
im_coll = (ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CH4')
           .filterBounds(roi)
           .filterDate(ee.Date(start_date),ee.Date(end_date))
           .map(lambda img: img.set('date', ee.Date(img.date()).format('YYYYMMdd')))
           .sort('date'))

region_im = im_coll.getRegion(roi, 2000).getInfo()
timestamplist = (im_coll.aggregate_array('date')
                 .map(lambda d: ee.String('T').cat(ee.String(d)))
                 .getInfo())
#timestamplist
df_mth = ee_array_to_df(region_im, ['CH4_column_volume_mixing_ratio_dry_air'])
ax = df_mth.plot(x="datetime", y="CH4_column_volume_mixing_ratio_dry_air")
ax.set_ylim(1700, 2000)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14689578713968957, 'fraction_numerical': 0.028824833702882482, 'mean_word_length': 4.388059701492537, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '65193', 'license': 'Apache-2.0', 'n_tokens_mistral': 728, 'n_tokens_neox': 678, 'n_words': 106, 'path': 'notebooks/extract_hotspots.ipynb', 'repo_name': 'unit8co/u8-hacktheclimate', 'size': '1804'}