Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
spatialthoughts committed Dec 26, 2023
1 parent c2f2a1f commit 2197798
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions code/python_remote_sensing/time_series_processing_xee.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@
"source": [
"### Aggregating the Time-Series\n",
"\n",
"We have a irregular time-series with a lot of noise. Let's create a monthly NDVI time-series by computing the monthly average NDVI. We can use XArray's `resample()` method to aggregate the time-series by Months and coompute the mean. We specify `MS` to indicate aggregating by month start."
"We have a irregular time-series with a lot of noise. Let's create a monthly NDVI time-series by computing the monthly average NDVI. We can use XArray's `resample()` method to aggregate the time-series by Months and coompute the mean. We specify *time* as `MS` to indicate aggregating by month start and *label* as `left` to indicate we want the start of the month as our series labels.\n",
"\n",
"Reference [Pandas Offset Aliases](https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases)"
],
"metadata": {
"id": "h1BNPkpox4GW"
Expand All @@ -244,7 +246,7 @@
{
"cell_type": "code",
"source": [
"time_series_aggregated = original_time_series.resample(time='MS').mean()\n",
"time_series_aggregated = original_time_series.resample(time='MS', label='left').mean()\n",
"time_series_aggregated"
],
"metadata": {
Expand All @@ -271,7 +273,7 @@
"metadata": {
"id": "-5J0g36ZljdQ"
},
"execution_count": null,
"execution_count": 46,
"outputs": []
},
{
Expand All @@ -296,9 +298,9 @@
"height": 673
},
"id": "aim3uBoq66C0",
"outputId": "abab27ca-6200-4c1c-f2e9-3fae9e661d21"
"outputId": "aa490d4f-ba09-4253-ef46-9a4313b41d91"
},
"execution_count": 17,
"execution_count": 47,
"outputs": [
{
"output_type": "display_data",
Expand Down Expand Up @@ -352,6 +354,19 @@
" image.rio.to_raster(output_path, driver='COG')\n",
" print(f'Created file at {output_path}')"
]
},
{
"cell_type": "markdown",
"source": [
"### Exercise\n",
"\n",
"Aggregate the time-series to 15-day interval. Apply gap-filling to fill missing values.\n",
"\n",
"*Hint: Refer to Reference [Pandas Offset Aliases](https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases) for appropriate string value for the time parameter.*"
],
"metadata": {
"id": "KcwzF0PxlsrG"
}
}
]
}

0 comments on commit 2197798

Please sign in to comment.