152 extract timeseries to point
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# %pip install -U geemap
# %pip install -U geemap
Import libraries¶
In [ ]:
Copied!
import matplotlib.pyplot as plt
import ee
import geemap
import matplotlib.pyplot as plt
import ee
import geemap
In [ ]:
Copied!
Map = geemap.Map()
Map
Map = geemap.Map()
Map
Specify Latitude, Longitude, & Date¶
In [ ]:
Copied!
# Define the latitude and longitude
lat = 28.60
lon = 77.22
# Define time range
start_date = "2000-01-01"
end_date = "2015-12-31"
# Define the latitude and longitude
lat = 28.60
lon = 77.22
# Define time range
start_date = "2000-01-01"
end_date = "2015-12-31"
Extract ERA5-Land Daily Timeseries¶
In [ ]:
Copied!
# Initialize image collection
image_collection = ee.ImageCollection("ECMWF/ERA5_LAND/DAILY_AGGR")
# Define bands of interest (must match available band names exactly)
band_names = ["temperature_2m_min", "temperature_2m_max", "total_precipitation_sum"]
# Define the scale
scale = 11132
# Extract time series at specified latitude and longitude
result = geemap.extract_timeseries_to_point(
lat=lat,
lon=lon,
image_collection=image_collection,
band_names=band_names,
start_date=start_date,
end_date=end_date,
scale=scale,
)
# Preview results
print(result.shape)
result.head()
# Initialize image collection
image_collection = ee.ImageCollection("ECMWF/ERA5_LAND/DAILY_AGGR")
# Define bands of interest (must match available band names exactly)
band_names = ["temperature_2m_min", "temperature_2m_max", "total_precipitation_sum"]
# Define the scale
scale = 11132
# Extract time series at specified latitude and longitude
result = geemap.extract_timeseries_to_point(
lat=lat,
lon=lon,
image_collection=image_collection,
band_names=band_names,
start_date=start_date,
end_date=end_date,
scale=scale,
)
# Preview results
print(result.shape)
result.head()
Extract CHIRPS Daily Precipitation Timeseries¶
In [ ]:
Copied!
# Initialize image collection
image_collection = ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY")
# Define the band name
band_names = ["precipitation"]
# Define the scale
scale = 5566
# Extract time series at specified latitude and longitude
result = geemap.extract_timeseries_to_point(
lat=lat,
lon=lon,
image_collection=image_collection,
band_names=band_names,
start_date=start_date,
end_date=end_date,
scale=scale,
)
# Preview results
print(result.shape)
result.head()
# Initialize image collection
image_collection = ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY")
# Define the band name
band_names = ["precipitation"]
# Define the scale
scale = 5566
# Extract time series at specified latitude and longitude
result = geemap.extract_timeseries_to_point(
lat=lat,
lon=lon,
image_collection=image_collection,
band_names=band_names,
start_date=start_date,
end_date=end_date,
scale=scale,
)
# Preview results
print(result.shape)
result.head()
Extract MODIS Terra Vegetation Indices Timeseries¶
In [ ]:
Copied!
# Initialize image collection
image_collection = ee.ImageCollection("MODIS/061/MOD13Q1")
# Define the band names
band_names = ["NDVI", "EVI"]
# Define the scale
scale = 250
# Extract time series at specified latitude and longitude
result = geemap.extract_timeseries_to_point(
lat=28.60,
lon=77.22,
image_collection=image_collection,
band_names=band_names,
start_date=start_date,
end_date=end_date,
scale=scale,
)
# Preview results
print(result.shape)
result.head()
# Initialize image collection
image_collection = ee.ImageCollection("MODIS/061/MOD13Q1")
# Define the band names
band_names = ["NDVI", "EVI"]
# Define the scale
scale = 250
# Extract time series at specified latitude and longitude
result = geemap.extract_timeseries_to_point(
lat=28.60,
lon=77.22,
image_collection=image_collection,
band_names=band_names,
start_date=start_date,
end_date=end_date,
scale=scale,
)
# Preview results
print(result.shape)
result.head()
Plot the Timeseries¶
In [ ]:
Copied!
# Simple plot
plt.figure(figsize=(12, 5))
for band in ["NDVI", "EVI"]:
plt.plot(
result["time"], result[band] * 0.0001, label=band
) # apply scale factor of 0.0001
plt.title(f"NDVI & EVI Time Series at {lat, lon}")
plt.xlabel("Date")
plt.ylabel("Value")
plt.legend()
plt.tight_layout()
plt.show()
# Simple plot
plt.figure(figsize=(12, 5))
for band in ["NDVI", "EVI"]:
plt.plot(
result["time"], result[band] * 0.0001, label=band
) # apply scale factor of 0.0001
plt.title(f"NDVI & EVI Time Series at {lat, lon}")
plt.xlabel("Date")
plt.ylabel("Value")
plt.legend()
plt.tight_layout()
plt.show()